Skip to content

Database Schema

Chinmay Deshmukh edited this page Apr 24, 2020 · 5 revisions

We currently have a User schema, and a Task schema. We are using Mongoose to define these schemas as well mapping models to a MongoDB document.

User Schema

For a user, we have these properties:

{
    email: {
    type: String,
    required: true,
    unique: true
    },
    name: {
        type: String, 
    }, 
    picture: {
        type: String
    },
    themePreference: {
        type: String
    },
    startTime: {
        type: Date,
    },
    endTime: {
        type: Date
    }
}
  • email is the unique ID for each user
  • name is the full name of the user
  • picture is an image url of the user's profile picture
  • themePreference is the theme choosen by the user for the app
  • startTime is the time chosen by the user as the start time for their daily working hours
  • endTime is the time chosen by the user as the end time for their daily working hours

Task Schema

    user: {
        type: String,
        required: true
    },
    taskId: {
        type: String,
        required: true,
        unique: true
    },
    title: {
        type: String,
        required: true,
    },
    description: {
        type: String,
    },
    location: {
        type: String,
    },
    priority: {
        type: Number
    },
    duration: {
        type: Number,
        required: true
    },
    startDate: {
        type: Date,
        required: true
    },
    endDate: {
        type: Date,
        required: true
    },
    reminderDate: {
        type: Date
    },
    isComplete: {
        type: Boolean
    }
  • user references the user schema unique id
  • taskId is the unique id for the task
  • title is the name of the task
  • description is the description of the task
  • location is the location of the task
  • priority is the priority where 5 is the highest and 1 is the lowest
  • duration is the number of minutes the task requires
  • startDate is the date when the task is scheduled to start
  • endDate is the date when the task is scheduled to end
  • reminderDate is the date when the user wants to schedule a reminder
  • isComplete states whether the task has been completed or not
Clone this wiki locally