forked from WeibelLab-Teaching/cogs121-sp16-ass1
-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.js
38 lines (32 loc) · 941 Bytes
/
models.js
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
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var UserSchema = new Schema({
"twitterID": String,
"token": String,
"username": String,
"displayName": String,
"photo": String
});
//SocketIO Schema
var NewsFeedSchema = new Schema({
"user": String,
"message": String,
"posted": Date
});
var CommentSchema = new Schema({
// 'userID': { type: Schema.Types.ObjectId, ref: 'User' },
"text" : String
});
var DrinkSchema = new Schema({
"name": String,
"upvotes" : { type: Number, default: 0 },
"downvotes" : { type: Number, default: 0 },
"type": String,
"description": String,
"comments": [CommentSchema]
});
exports.NewsFeed = mongoose.model('NewsFeed', NewsFeedSchema);
exports.User = mongoose.model('User', UserSchema);
exports.Drink = mongoose.model('Drink', DrinkSchema);
exports.Comment = mongoose.model('Comment', DrinkSchema);
// exports.Vote = mongoose.model('Vote', DrinkSchema);