/
schema.js
48 lines (42 loc) · 1010 Bytes
/
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
const { Schema } = require("mongoose");
const imageSchema = new Schema({
name: String,
desc: String,
img: {
data: Buffer,
contentType: String,
},
});
const userSchema = new Schema({
userName: String,
userEmail: String,
gitHubLink: String,
linkedInLink: String,
password: String,
company: String,
designation: String,
postsLiked: [String],
followers: [Schema.Types.ObjectId],
following: [Schema.Types.ObjectId],
posts: [Schema.Types.ObjectId],
skills: [String],
resetPasswordToken: String,
});
const postSchema = new Schema({
postTimeStamp: { type: Date, default: Date.now },
likeCount: Number,
comments: [
{
postedBy: String,
commentText: String,
},
],
userId: Schema.Types.ObjectId,
postText: String,
tagsRelatedToPost: [String],
userName: String,
imageRelatedToPosts: [{ type: Schema.Types.ObjectId, ref: 'Images' }]
});
exports.imageSchema = imageSchema;
exports.postSchema = postSchema;
exports.userSchema = userSchema;