-
Notifications
You must be signed in to change notification settings - Fork 0
/
railRoute.js
51 lines (49 loc) · 1.46 KB
/
railRoute.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
import * as mongoose from 'mongoose';
const RailRouteSchema = mongoose.Schema(
{
trainId: {
type: mongoose.ObjectId,
required: [true, 'Train ID of the rail route is required']
},
ticketsCost: {
type: Map,
of: Number,
required: [true, 'Tickets cost map of the rail route is required']
},
departure: {
stopId: {
type: mongoose.ObjectId,
required: [true, 'Departure stop ID of the rail route is required']
},
date: {
type: Date,
required: [true, 'Departure stop of the rail is required']
}
},
arrival: {
stopId: {
type: mongoose.ObjectId,
required: [true, 'Arrival stop ID of the rail route is required']
},
date: {
type: Date,
required: [true, 'Arrival date of the rail is required']
}
},
stops: [{
stopId: {
type: mongoose.ObjectId,
required: [true, 'Stop ID of the rail route is required']
},
date: {
type: Date,
required: [true, 'Stop date of the rail is required']
}
}]
},
{
timestamps: true
}
);
export default mongoose.model('RailRoute', RailRouteSchema);
export { RailRouteSchema };