Open amandarwang001 opened 5 years ago
We will using MongoDB with Mongoose. Structure will be determined once user stories are compiled in conjunction with development of the Data Flow Diagram.
@ashannon1990 - Take a look at the initial database notes when you have a chance: https://github.com/code-team-42/tutor-dev/blob/master/docs/database/database-notes.md . Next step is to model it.
``const mongoose = require("mongoose"); const Schema = mongoose.Schema;
const studentSchema = new Schema({ username: { type: String, required: true }, email: { type: String, required: true }, name: { type: String, required: true }, mobileNumber: { type: String, required: true }, contactPreference: { email: { type: Boolean, default: true }, text: { type: Boolean, default: false } }, yearInSchool: String, subjects: [{ type: String, required: true }], });
const Student = mongoose.model("Student", studentSchema); module.exports = Student;
//-------------------------------------------------------
const tutorSchema = new Schema({ username: { type: String, required: true }, email: { type: String, required: true }, name: { type: String, required: true }, mobileNumber: { type: String, required: true }, subjects: [{ subjectName: { type: String, required: true }, subjectLevel: { type: String, required: true } }], contactPreference: { email: { type: Boolean, default: true }, text: { type: Boolean, default: false } }, chatCapability: { withStudent: Boolean, withAdmn: Boolean }, availability: [{ dates: [Date], scheduleUpTo: Number, allowRecurring: Boolean }], dashboard: { numberOfSessions: Number, hoursWorkedThisWeek: Number, upcommingSessions: [{ date: Date, time: String, subject: String, studentName: String }] } });
const Tutor = mongoose.model("Tutor", tutorSchema); module.exports = Tutor;
//---------------------------------------------
const adminSchema = new Schema({ username: { type: String, required: true }, name: { type: String, required: true }, email: { type: String, required: true }, mobileNumber: { type: String, required: true }, dashboard: { // Universit Ticket Resolution, // University Access } });
const Admin = mongoose.model("Admin", adminSchema); module.exports = Admin;
//-----------------------------------------------------
const coursesSchema = new Schema({ textBook: [String], curriculumLink: String })
const Courses = mongoose.model("Courses", coursesSchema); module.exports = Courses;
//----------------------------------------
const canvasSchema = new Schema({ linkToTutorSystem: String })
const Canvas = mongoose.model("Canvas", canvasSchema); module.exports = Canvas;
//------------------------------------------
const facultySchema = new Schema({ username: { type: String, required: true }, email: { type: String, required: true }, name: { type: String, required: true }, mobileNumber: { type: String, required: true }, reminderSettings: { courseBeginning: { type: Boolean, default: true }, gradeThreshold: Number } })
const Faculty = mongoose.model("Faculty", facultySchema); module.exports = Faculty;
//------------------------------------------
const tutorSessionSchema = new Schema({ student: { username: { type: String, required: true }, email: { type: String, required: true }, name: { type: String, required: true }, mobileNumber: { type: String, required: true } }, requestedAt: { type: Date, default: Date.now }, type: { synchronous: { time: String }, asynchronous: { questions: [String], answers: [String] } }, tutor: { username: { type: String, required: true }, email: { type: String, required: true }, name: { type: String, required: true }, mobileNumber: { type: String, required: true } }, status: { currentStatus: { type: String, required: true }, reasonIfCancelled: String }, studentReview: { type: String, required: true }, tutorReview: { type: String, required: true }, facultyNotes: [String], adminNotes: [String], //Online help/support section available, storeSessionsForYears: Number, //Way to apply for the program from a public facing website lastMinuteIssue: { needReplacement: {type: Boolean, default: false }, reason: { type: String, required: true} } })
const TutorSessions = mongoose.model("TutorSessions", tutorSessionSchema); module.exports = TutorSessions;
//------------------------------------------
const calendarSchema = new Schema({ tutorAvailability: { dates: [Date], times: [String] }, systemDowntime: { dates: [Date], times: [String], reasons: [String] }, studentRequestOptions: { courses: [String], level: [String], date: [Date], time: [String] }, //automatic reminders })
const Calendar = mongoose.model("Calendar", calendarSchema); module.exports = Calendar;
//----------------------------------------
const processSchema = new Schema({ tutorRequestByStudent: { course: String, date: Date, time: String }, //online help?? })
const Process = mongoose.model("Process", processSchema); module.exports = Process
Anthony (Dan)