-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.js
78 lines (72 loc) · 1.58 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
72
73
74
75
76
77
78
import mongoose from 'mongoose'
export const Payer = mongoose.model('Payer', new mongoose.Schema({
name: String
}))
export const RoomType = mongoose.model('RoomType', new mongoose.Schema({
hotel: String,
size: Number,
price: Number
}))
export const Event = mongoose.model('Event', new mongoose.Schema({
name: String,
location: String,
date: Date
}))
export const Transport = mongoose.model('Transport', new mongoose.Schema({
type: {
type: String,
enum: ['Plane', 'Train', 'Bus', 'Car']
},
ticketId: String,
time: Date,
pickup: {
type: String,
enum: ['Animateka', 'GoOpti', 'Own/None']
},
payer: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Payer'
}
}))
export const Room = mongoose.model('Room', new mongoose.Schema({
name: String,
type: {
type: mongoose.Schema.Types.ObjectId,
ref: 'RoomType'
}
}))
export const Guest = mongoose.model('Guest', new mongoose.Schema({
name: String,
email: String,
phone: String,
country: String,
organisation: String,
arrival: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Transport'
},
arrivalPayer: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Payer'
},
departure: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Transport'
},
departurePayer: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Payer'
},
accommodation: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Room'
},
accomodationPayer: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Payer'
},
events: [{
type: mongoose.Schema.Types.ObjectId,
ref: 'Event'
}]
}))