Skip to content

Latest commit

 

History

History
115 lines (77 loc) · 2 KB

APIv1 DB Schemas.md

File metadata and controls

115 lines (77 loc) · 2 KB

API v1 - DB Schemas

There are all of the DB Schemas from this API version. You can go back here.

Table of content

Graphic Diagram

You can see a the logical schema of the DB in the image below.

Diagram

DB Schema: User

Important

  • The fields _id and __v are assigned by MongoDB, the client can't change it.
  • the config field is reserved for the client. Use an unique id for each front-end. { "official-client": {...} }
  • Any ObjectId with a different key than _id represents a relation with other document.

Struct

{
 "_id": ObjectID, // Assigned by MongoDB
 "username": String,
 "password": String,
 "tasksCompleted": [ObjectID],
 "courses": [{ "_id": ObjectID, "isAdmin": Boolean }],
 "config": { <client>: {}, <client>: {}, ... }, // Any JSON, the server wont validate a format, you can put anything you need.
}

DB Schema: Course

Struct

{
 "_id": ObjectID, // Assigned by MongoDB
 "classcode": String,
 "password": String
}

DB Schema: Subject

Struct

{
 "_id": ObjectID, // Assigned by MongoDB
 "course": ObjectID,
 "name": String,
 "teacherName": String,
 "teacherEmail": String,
 "links": [String]
}

DB Schema: Task

Struct

{
 "_id": ObjectID, // Assigned by MongoDB
 "subject": ObjectID,
 "open": Date,
 "close": Date,
 "name": String,
 "description": String,
 "links": [String]
}

DB Schema: Session

Important

  • The starts and ends fields only needs the time value, the day part of the date will be ignored.

Struct

{
 "_id": ObjectID, // Assigned by MongoDB
 "subject": ObjectID,
 "starts": Date,
 "ends": Date,
 "classroom": String,
 "links": [String]
}