forked from rdegges/svcc-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.js
59 lines (51 loc) · 2.42 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId;
/**
* Our User model.
*
* This is how we create, edit, delete, and retrieve user accounts via MongoDB.
*/
module.exports.User = mongoose.model('User', new Schema({
id: ObjectId,
username: { type: String, required: '{PATH} is required.' },
firstName: { type: String, required: '{PATH} is required.' },
lastName: { type: String, required: '{PATH} is required.' },
email: { type: String, required: '{PATH} is required.', unique: true },
password: { type: String, required: '{PATH} is required.' },
data: Object,
}));
module.exports.Post = mongoose.model('Post', new Schema({
id: ObjectId,
title: { type: String, required: '{PATH} is required.' },
name: { type: String, required: '{PATH} is required.', unique: true },
author: { type: String, required: '{PATH} is required.' },
text: { type: String, required: '{PATH} is required.' },
}));
module.exports.Publication = mongoose.model('Publication', new Schema({
id: ObjectId,
name: { type: String, required: '{PATH} is required.', unique: true },
title: { type: String, required: '{PATH} is required.' },
author: { type: String, required: '{PATH} is required.' },
team: { type: String, required: '{PATH} is required.' },
url: { type: String, required: '{PATH} is required.' },
text: { type: String, required: '{PATH} is required.' },
}));
module.exports.Project = mongoose.model('Project', new Schema({
id: ObjectId,
name: { type: String, required: '{PATH} is required.', unique: true },
title: { type: String, required: '{PATH} is required.' },
author: { type: String, required: '{PATH} is required.' },
team: { type: String, required: '{PATH} is required.' },
text: { type: String, required: '{PATH} is required.' },
}));
module.exports.Team = mongoose.model('Team', new Schema({
id: ObjectId,
name: { type: String, required: '{PATH} is required.', unique: true },
firstName: { type: String, required: '{PATH} is required.' },
lastName: { type: String, required: '{PATH} is required.' },
email: { type: String, required: '{PATH} is required.', unique: true },
bio: { type: String, required: '{PATH} is required.' },
urls: { type: Object, required: '{PATH} is required.' },
}));
// MEDIA MODEL GOES HERE