whitelabel-db 1.1.51 → 1.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/migrations/004-add-hotels-columns.d.ts +3 -0
- package/dist/migrations/004-add-hotels-columns.js +54 -0
- package/dist/migrations/005-add-translations-columns.d.ts +3 -0
- package/dist/migrations/005-add-translations-columns.js +103 -0
- package/dist/migrations/006-add-rates-columns.d.ts +3 -0
- package/dist/migrations/006-add-rates-columns.js +49 -0
- package/dist/models/Hotel.d.ts +3 -0
- package/dist/models/Hotel.js +21 -0
- package/dist/models/HotelRate.d.ts +2 -0
- package/dist/models/HotelRate.js +14 -0
- package/dist/models/HotelTranslation.d.ts +4 -0
- package/dist/models/HotelTranslation.js +32 -3
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.down = exports.up = void 0;
|
|
13
|
+
// Purpose: Add markdownDescription, importantInfo, hotelType columns to static_hotels table.
|
|
14
|
+
const sequelize_1 = require("sequelize");
|
|
15
|
+
const columns = [
|
|
16
|
+
{ name: 'markdownDescription', type: sequelize_1.DataTypes.TEXT, allowNull: true },
|
|
17
|
+
{ name: 'importantInfo', type: sequelize_1.DataTypes.TEXT, allowNull: true },
|
|
18
|
+
{
|
|
19
|
+
name: 'hotelType',
|
|
20
|
+
type: sequelize_1.DataTypes.STRING,
|
|
21
|
+
allowNull: true,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
try {
|
|
26
|
+
// Add all columns in parallel
|
|
27
|
+
yield Promise.all(columns.map((column) => queryInterface.addColumn('static_hotels', column.name, {
|
|
28
|
+
type: column.type,
|
|
29
|
+
allowNull: column.allowNull,
|
|
30
|
+
})));
|
|
31
|
+
console.log('All columns added successfully.');
|
|
32
|
+
console.log('All columns added successfully.');
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.error('Error while adding columns:', error.message);
|
|
36
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
exports.up = up;
|
|
40
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
try {
|
|
42
|
+
// Remove columns
|
|
43
|
+
for (const column of columns.reverse()) {
|
|
44
|
+
console.log(`Removing column: ${column.name}`);
|
|
45
|
+
yield queryInterface.removeColumn('static_hotels', column.name);
|
|
46
|
+
}
|
|
47
|
+
console.log('All columns removed successfully.');
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error('Error while removing columns:', error.message);
|
|
51
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
exports.down = down;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.down = exports.up = void 0;
|
|
13
|
+
const sequelize_1 = require("sequelize");
|
|
14
|
+
const columnsToAdd = [
|
|
15
|
+
{ name: 'hotelType', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
16
|
+
{ name: 'parking', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
17
|
+
{
|
|
18
|
+
name: 'createdAt',
|
|
19
|
+
type: sequelize_1.DataTypes.DATE,
|
|
20
|
+
allowNull: false,
|
|
21
|
+
defaultValue: new Date(),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'updatedAt',
|
|
25
|
+
type: sequelize_1.DataTypes.DATE,
|
|
26
|
+
allowNull: false,
|
|
27
|
+
defaultValue: new Date(),
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
try {
|
|
32
|
+
// Add new columns in parallel
|
|
33
|
+
yield Promise.all(columnsToAdd.map((column) => queryInterface.addColumn('static_hotels_translations', column.name, {
|
|
34
|
+
type: column.type,
|
|
35
|
+
allowNull: column.allowNull,
|
|
36
|
+
defaultValue: column === null || column === void 0 ? void 0 : column.defaultValue,
|
|
37
|
+
})));
|
|
38
|
+
console.log('New columns added successfully.');
|
|
39
|
+
// Modify existing columns
|
|
40
|
+
yield Promise.all([
|
|
41
|
+
queryInterface.changeColumn('static_hotels_translations', 'name', {
|
|
42
|
+
type: sequelize_1.DataTypes.STRING,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
}),
|
|
45
|
+
queryInterface.changeColumn('static_hotels_translations', 'city', {
|
|
46
|
+
type: sequelize_1.DataTypes.STRING,
|
|
47
|
+
allowNull: true,
|
|
48
|
+
}),
|
|
49
|
+
queryInterface.changeColumn('static_hotels_translations', 'country', {
|
|
50
|
+
type: sequelize_1.DataTypes.STRING,
|
|
51
|
+
allowNull: true,
|
|
52
|
+
}),
|
|
53
|
+
queryInterface.changeColumn('static_hotels_translations', 'id', {
|
|
54
|
+
type: sequelize_1.DataTypes.UUID,
|
|
55
|
+
allowNull: false,
|
|
56
|
+
defaultValue: sequelize_1.DataTypes.UUIDV4,
|
|
57
|
+
primaryKey: true,
|
|
58
|
+
}),
|
|
59
|
+
]);
|
|
60
|
+
console.log('Column constraints updated successfully.');
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error('Error in migration:', error.message);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
exports.up = up;
|
|
68
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
try {
|
|
70
|
+
// Revert constraint changes
|
|
71
|
+
yield Promise.all([
|
|
72
|
+
queryInterface.changeColumn('static_hotels_translations', 'name', {
|
|
73
|
+
type: sequelize_1.DataTypes.STRING,
|
|
74
|
+
allowNull: false,
|
|
75
|
+
}),
|
|
76
|
+
queryInterface.changeColumn('static_hotels_translations', 'city', {
|
|
77
|
+
type: sequelize_1.DataTypes.STRING,
|
|
78
|
+
allowNull: false,
|
|
79
|
+
}),
|
|
80
|
+
queryInterface.changeColumn('static_hotels_translations', 'country', {
|
|
81
|
+
type: sequelize_1.DataTypes.STRING,
|
|
82
|
+
allowNull: false,
|
|
83
|
+
}),
|
|
84
|
+
queryInterface.changeColumn('static_hotels_translations', 'id', {
|
|
85
|
+
type: sequelize_1.DataTypes.UUID,
|
|
86
|
+
allowNull: false,
|
|
87
|
+
primaryKey: true,
|
|
88
|
+
}),
|
|
89
|
+
]);
|
|
90
|
+
console.log('Reverted column constraints.');
|
|
91
|
+
// Remove newly added columns
|
|
92
|
+
for (const column of columnsToAdd.reverse()) {
|
|
93
|
+
console.log(`Removing column: ${column.name}`);
|
|
94
|
+
yield queryInterface.removeColumn('static_hotels_translations', column.name);
|
|
95
|
+
}
|
|
96
|
+
console.log('All columns removed successfully.');
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
console.error('Error in rollback:', error.message);
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
exports.down = down;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.down = exports.up = void 0;
|
|
13
|
+
// Purpose: Add amountTotal, boardType columns to hotel_rates table.
|
|
14
|
+
const sequelize_1 = require("sequelize");
|
|
15
|
+
const columns = [
|
|
16
|
+
{ name: 'amountTotal', type: sequelize_1.DataTypes.FLOAT, allowNull: true },
|
|
17
|
+
{ name: 'boardType', type: sequelize_1.DataTypes.STRING(10), allowNull: false },
|
|
18
|
+
];
|
|
19
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
try {
|
|
21
|
+
// Add all columns in parallel
|
|
22
|
+
yield Promise.all(columns.map((column) => queryInterface.addColumn('hotel_rates', column.name, {
|
|
23
|
+
type: column.type,
|
|
24
|
+
allowNull: column.allowNull,
|
|
25
|
+
})));
|
|
26
|
+
console.log('All columns added successfully.');
|
|
27
|
+
console.log('All columns added successfully.');
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error('Error while adding columns:', error.message);
|
|
31
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
exports.up = up;
|
|
35
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
// Remove columns
|
|
38
|
+
for (const column of columns.reverse()) {
|
|
39
|
+
console.log(`Removing column: ${column.name}`);
|
|
40
|
+
yield queryInterface.removeColumn('hotel_rates', column.name);
|
|
41
|
+
}
|
|
42
|
+
console.log('All columns removed successfully.');
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error('Error while removing columns:', error.message);
|
|
46
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
exports.down = down;
|
package/dist/models/Hotel.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export declare class Hotel extends Model<Partial<Hotel>> {
|
|
|
65
65
|
id: string;
|
|
66
66
|
name: string;
|
|
67
67
|
hotelDescription: string;
|
|
68
|
+
markdownDescription: string;
|
|
69
|
+
importantInfo: string;
|
|
68
70
|
currency: string;
|
|
69
71
|
country: string;
|
|
70
72
|
city: string;
|
|
@@ -78,6 +80,7 @@ export declare class Hotel extends Model<Partial<Hotel>> {
|
|
|
78
80
|
main_photo: string;
|
|
79
81
|
thumbnail: string;
|
|
80
82
|
hotelTypeId: number;
|
|
83
|
+
hotelType: string;
|
|
81
84
|
chainId: number;
|
|
82
85
|
airportCode: string;
|
|
83
86
|
stars: number;
|
package/dist/models/Hotel.js
CHANGED
|
@@ -38,6 +38,20 @@ __decorate([
|
|
|
38
38
|
}),
|
|
39
39
|
__metadata("design:type", String)
|
|
40
40
|
], Hotel.prototype, "hotelDescription", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, sequelize_typescript_1.Column)({
|
|
43
|
+
type: sequelize_typescript_1.DataType.TEXT,
|
|
44
|
+
allowNull: true,
|
|
45
|
+
}),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], Hotel.prototype, "markdownDescription", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, sequelize_typescript_1.Column)({
|
|
50
|
+
type: sequelize_typescript_1.DataType.TEXT,
|
|
51
|
+
allowNull: false,
|
|
52
|
+
}),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], Hotel.prototype, "importantInfo", void 0);
|
|
41
55
|
__decorate([
|
|
42
56
|
(0, sequelize_typescript_1.Column)({
|
|
43
57
|
type: sequelize_typescript_1.DataType.STRING,
|
|
@@ -135,6 +149,13 @@ __decorate([
|
|
|
135
149
|
}),
|
|
136
150
|
__metadata("design:type", Number)
|
|
137
151
|
], Hotel.prototype, "hotelTypeId", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
(0, sequelize_typescript_1.Column)({
|
|
154
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
155
|
+
allowNull: true,
|
|
156
|
+
}),
|
|
157
|
+
__metadata("design:type", String)
|
|
158
|
+
], Hotel.prototype, "hotelType", void 0);
|
|
138
159
|
__decorate([
|
|
139
160
|
sequelize_typescript_1.Index,
|
|
140
161
|
(0, sequelize_typescript_1.Column)({
|
package/dist/models/HotelRate.js
CHANGED
|
@@ -53,6 +53,13 @@ __decorate([
|
|
|
53
53
|
}),
|
|
54
54
|
__metadata("design:type", Number)
|
|
55
55
|
], HotelRate.prototype, "amount", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, sequelize_typescript_1.Column)({
|
|
58
|
+
type: sequelize_typescript_1.DataType.FLOAT,
|
|
59
|
+
allowNull: true,
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:type", Number)
|
|
62
|
+
], HotelRate.prototype, "amountTotal", void 0);
|
|
56
63
|
__decorate([
|
|
57
64
|
(0, sequelize_typescript_1.Column)({
|
|
58
65
|
type: sequelize_typescript_1.DataType.FLOAT,
|
|
@@ -73,6 +80,13 @@ __decorate([
|
|
|
73
80
|
}),
|
|
74
81
|
__metadata("design:type", Boolean)
|
|
75
82
|
], HotelRate.prototype, "refundable", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, sequelize_typescript_1.Column)({
|
|
85
|
+
type: sequelize_typescript_1.DataType.STRING(10),
|
|
86
|
+
allowNull: false,
|
|
87
|
+
}),
|
|
88
|
+
__metadata("design:type", String)
|
|
89
|
+
], HotelRate.prototype, "boardType", void 0);
|
|
76
90
|
exports.HotelRate = HotelRate = __decorate([
|
|
77
91
|
(0, sequelize_typescript_1.Table)({
|
|
78
92
|
tableName: 'hotel_rates',
|
|
@@ -21,6 +21,7 @@ __decorate([
|
|
|
21
21
|
(0, sequelize_typescript_1.Column)({
|
|
22
22
|
type: sequelize_typescript_1.DataType.UUID,
|
|
23
23
|
allowNull: false,
|
|
24
|
+
defaultValue: sequelize_typescript_1.DataType.UUIDV4,
|
|
24
25
|
}),
|
|
25
26
|
__metadata("design:type", String)
|
|
26
27
|
], HotelTranslation.prototype, "id", void 0);
|
|
@@ -47,7 +48,7 @@ __decorate([
|
|
|
47
48
|
__decorate([
|
|
48
49
|
(0, sequelize_typescript_1.Column)({
|
|
49
50
|
type: sequelize_typescript_1.DataType.STRING(512),
|
|
50
|
-
allowNull:
|
|
51
|
+
allowNull: true,
|
|
51
52
|
}),
|
|
52
53
|
__metadata("design:type", String)
|
|
53
54
|
], HotelTranslation.prototype, "name", void 0);
|
|
@@ -76,7 +77,7 @@ __decorate([
|
|
|
76
77
|
sequelize_typescript_1.Index,
|
|
77
78
|
(0, sequelize_typescript_1.Column)({
|
|
78
79
|
type: sequelize_typescript_1.DataType.STRING,
|
|
79
|
-
allowNull:
|
|
80
|
+
allowNull: true,
|
|
80
81
|
}),
|
|
81
82
|
__metadata("design:type", String)
|
|
82
83
|
], HotelTranslation.prototype, "country", void 0);
|
|
@@ -84,7 +85,7 @@ __decorate([
|
|
|
84
85
|
sequelize_typescript_1.Index,
|
|
85
86
|
(0, sequelize_typescript_1.Column)({
|
|
86
87
|
type: sequelize_typescript_1.DataType.STRING,
|
|
87
|
-
allowNull:
|
|
88
|
+
allowNull: true,
|
|
88
89
|
}),
|
|
89
90
|
__metadata("design:type", String)
|
|
90
91
|
], HotelTranslation.prototype, "city", void 0);
|
|
@@ -116,6 +117,13 @@ __decorate([
|
|
|
116
117
|
}),
|
|
117
118
|
__metadata("design:type", Array)
|
|
118
119
|
], HotelTranslation.prototype, "rooms", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, sequelize_typescript_1.Column)({
|
|
122
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
123
|
+
allowNull: true,
|
|
124
|
+
}),
|
|
125
|
+
__metadata("design:type", String)
|
|
126
|
+
], HotelTranslation.prototype, "hotelType", void 0);
|
|
119
127
|
__decorate([
|
|
120
128
|
(0, sequelize_typescript_1.Column)({
|
|
121
129
|
type: sequelize_typescript_1.DataType.ARRAY(sequelize_typescript_1.DataType.JSONB),
|
|
@@ -123,6 +131,27 @@ __decorate([
|
|
|
123
131
|
}),
|
|
124
132
|
__metadata("design:type", Array)
|
|
125
133
|
], HotelTranslation.prototype, "reviews", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, sequelize_typescript_1.Column)({
|
|
136
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
137
|
+
allowNull: true,
|
|
138
|
+
}),
|
|
139
|
+
__metadata("design:type", String)
|
|
140
|
+
], HotelTranslation.prototype, "parking", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
(0, sequelize_typescript_1.Column)({
|
|
143
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
144
|
+
allowNull: false,
|
|
145
|
+
}),
|
|
146
|
+
__metadata("design:type", Date)
|
|
147
|
+
], HotelTranslation.prototype, "createdAt", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
(0, sequelize_typescript_1.Column)({
|
|
150
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
151
|
+
allowNull: false,
|
|
152
|
+
}),
|
|
153
|
+
__metadata("design:type", Date)
|
|
154
|
+
], HotelTranslation.prototype, "updatedAt", void 0);
|
|
126
155
|
exports.HotelTranslation = HotelTranslation = __decorate([
|
|
127
156
|
(0, sequelize_typescript_1.Table)({
|
|
128
157
|
tableName: 'static_hotels_translations',
|