-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.js
71 lines (67 loc) · 1.11 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
60
61
62
63
64
65
66
67
68
69
70
71
const Schema = require('mongoose').Schema;
const mongoose= require("mongoose");
const UserSchema = new mongoose.Schema({
vbank_num: {
type: String,
},
vbank_date: {
type: Number,
},
vbank_name: {
type: String,
},
});
const User = mongoose.model("User", UserSchema);
const CardSchema = new mongoose.Schema({
_id: {
type: String,
required: true,
},
pg: {
type: String,
required: true,
},
period: {
type: Number,
required: true,
},
paid_at: {
type: Number,
},
status: {
type: String,
},
user: {
type: Schema.ObjectId,
ref: "User",
required: true,
},
});
const Card = mongoose.model("Card", CardSchema);
const OrderSchema = new mongoose.Schema({
_id: {
type: String,
required: true,
},
amount: {
type: Number,
required: true,
},
paid_at: {
type: Number,
},
status: {
type: String,
},
user: {
type: Schema.ObjectId,
ref: "User",
required: true,
},
card: {
type: String,
ref: "Card",
},
});
const Order = mongoose.model("Order", OrderSchema);
module.exports = { User, Card, Order };