This repository has been archived by the owner on Aug 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathshopTable.js
104 lines (84 loc) · 2.25 KB
/
shopTable.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => {
class Shop extends Model {
//
}
Shop.init(
{
id: {
type: DataTypes.UUID,
primaryKey: true,
allowNull: false,
},
userId: {
allowNull: false,
type: DataTypes.UUID,
},
tourTitle: {
type: DataTypes.STRING(64),
allowNull: false,
},
tourDesc: {
type: DataTypes.STRING(2048),
allowNull: false,
},
tourDuration: {
type: DataTypes.STRING(32),
allowNull: false,
},
finalTimings: {
type: DataTypes.STRING(64),
allowNull: false,
},
finalDays: {
type: DataTypes.STRING(128),
allowNull: false,
},
finalItinerary: {
type: DataTypes.STRING(256),
allowNull: false,
},
finalLocations: {
type: DataTypes.STRING(128),
allowNull: false,
},
tourImage: {
type: DataTypes.STRING(64),
allowNull: false,
},
tourPax: {
type: DataTypes.STRING(4),
allowNull: false,
},
tourRevision: {
type: DataTypes.STRING(4),
allowNull: false,
},
tourPrice: {
type: DataTypes.STRING(8),
allowNull: false,
},
hidden: {
type: DataTypes.STRING(8),
allowNull: false,
},
},
{
sequelize,
tableName: 'Shop',
},
)
Shop.associate = (models) => {
Shop.hasMany(models.Booking, {
onDelete: 'cascade',
sourceKey: 'id',
foreignKey: 'listingId',
})
Shop.hasMany(models.Review, {
onDelete: 'cascade',
sourceKey: 'id',
foreignKey: 'tourId',
})
}
return Shop
}