forked from FinalsClub/KNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.js
More file actions
73 lines (60 loc) · 1.32 KB
/
schema.js
File metadata and controls
73 lines (60 loc) · 1.32 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
/* vim: set ts=2: */
var mongoose = require('mongoose')
, Schema = mongoose.Schema;
var RATING_MAX = 100;
var RATING_MIN = 0;
var Karma = new Schema ({
action : Action
, timestamp : Date
, user : Schema.ObjectId
});
var Note = new Schema({
filename : String
, owner : Schema.ObjectId
, size : Number
, course : Course
, campus : Campus
, votes : [Vote]
, subjects : [Subject]
, tags : [Tag]
});
var Vote = new Schema({
user : Schema.ObjectId
, up : Boolean
});
var Action = new Schema({
shortname : String
, description : String
, karma_value : Number
, icon : String
});
var Campus = new Schema({
courses : [Course]
, address : String
, city : String
, state : String
});
var Course = new Schema({
title : String
, professor : Professor
, subject : Subject
, midtermExams : [Date]
, finalExam : Date
});
var Professor = new Schema({
name : String
, title : String
});
var Subject = new Schema({
title : String
, description : String
, tags = [Tag]
});
var Tag = new Schema({
title : String
, description : String
});
// filename | placeholder for path to local file or to s3 file
// owner | foreign key to a user object, TODO: Create user schema
// size | size of the file in bytes,
// TODO: make a pretty-print method that gives owner name and size in MiB