-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodels.coffee
61 lines (55 loc) · 1.55 KB
/
models.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Copyright (C) 2013 Avi Romanoff <aviromanoff at gmail.com>
# Contains the Mongoose models used server-side
# for the app. Note that these models are NOT
# identical to the Backbone models used on the
# client, though there is a great deal of overlap.
mongoose = require 'mongoose'
AccountSchema = new mongoose.Schema
_id: String
nickname: String
is_new:
type: Boolean
default: true
firstrun:
type: Boolean
default: true
details:
type: Boolean
default: false
migrate:
type: Boolean
default: false
updated:
type: Date
default: new Date 0 # Start off at the beginning of UNIX time so it's initially stale.
CourseSchema = new mongoose.Schema
owner: String
title: String
teacher: String
jbha_id: # content id as found on the jbha.org homework website
type: String
index:
unique: false
sparse: true
info_items: [{tab: String, title: String, content: String}] # Non-homework tab items, e.g department info & course overview
assignments: [{ type: mongoose.Schema.ObjectId, ref: 'assignment' }]
AssignmentSchema = new mongoose.Schema
owner: String
date: Number
title: String
details: String
jbha_id: # content id as found on the jbha.org homework website
type: String
index:
unique: false
sparse: true
archived:
type: Boolean
default: false
done:
type: Boolean
default: false
module.exports =
Account: mongoose.model 'account', AccountSchema
Course: mongoose.model 'course', CourseSchema
Assignment: mongoose.model 'assignment', AssignmentSchema