-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjavascript
41 lines (37 loc) · 1023 Bytes
/
javascript
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
import mongoose from "mongoose";
const propertySchema = new mongoose.Schema({
property_id: { type: String },
name: { type: String },
});
const usersSchema = new mongoose.Schema({
from: {
user_id: { type: String },
keep: { type: Boolean, default: true, required: true }
},
to: {
user_id: { type: String },
keep: { type: Boolean, default: true, required: true }
}
});
const replyToSchema = new mongoose.Schema({
enquiry_id: { type: String },
title: { type: String },
topic: { type: String },
});
const enquirySchema = new mongoose.Schema(
{
enquiry_id: { type: String, required: true },
content: { type: String, minlength: 10 },
email: { type: String },
title: { type: String, required: true },
topic: { type: String, required: true },
read: { type: Boolean, default: false },
property: propertySchema,
replyTo: replyToSchema,
users: usersSchema
},
{
timestamps: true,
}
);
export const Enquiry = mongoose.model("Enquiry", enquirySchema);