Skip to content

Database Schema

Chinmay Deshmukh edited this page May 1, 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,
    },
    points: {
        type: Number,
    },
    unlockedItems: [
        {
            type: String,
        },
    ],
}
  • 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
  • points is the amount of points the user has accumulated from the gamification features
  • unlockedItems are a list of items the user has unlocked from the gamification features

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,
    }
    dueDate: {
        type: Date,
        required: true,
    },
    travelTime: {
        type: Number,
        required: true,
    },
    reminderType: {
        type: Number,
        required: false,
    },
    earliestDate: {
        type: Date,
        required: true,
    },
    category: {
        type: Number,
    },

  • 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
  • dueDate is the date the task is due
  • travelTime is the time taken to travel between task locations
  • reminderType is the type of reminder
  • earliestDate is the earliest date a task can be scheduled
  • category is the nature of the task
Clone this wiki locally