-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathschema.js
66 lines (63 loc) · 1.71 KB
/
schema.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
60
61
62
63
64
65
66
(function() {
module.exports = function(mongoose) {
var Schema;
Schema = (function() {
function Schema(mongoose) {
var BlogSchema, CategorySchema, CommentSchema, MapSchema, MediaSchema, ObjectId, PostSchema, UserSchema;
Schema = mongoose.Schema;
ObjectId = Schema.ObjectId;
UserSchema = new Schema({
username: String,
password: String,
acive: Boolean,
created: Date
});
CategorySchema = new Schema({
permaLink: String,
title: String
});
CommentSchema = new Schema({
title: String,
text: String,
date: Date
});
PostSchema = new Schema({
id: ObjectId,
author: String,
title: String,
permaLink: String,
body: String,
date: Date,
categories: [String],
comments: [CommentSchema],
publish: Boolean
});
BlogSchema = new Schema({
url: String,
title: String,
updated: Date
});
MapSchema = new Schema({
id: ObjectId,
permaLink: String,
content: String
});
MediaSchema = new Schema({
id: ObjectId,
title: String,
url: String,
type: String,
date: Date
});
mongoose.model('user', UserSchema);
mongoose.model('blog', BlogSchema);
mongoose.model('category', CategorySchema);
mongoose.model('post', PostSchema);
mongoose.model('map', MapSchema);
mongoose.model('media', MediaSchema);
}
return Schema;
})();
return new Schema(mongoose);
};
}).call(this);