whitelabel-db 1.1.84 → 1.1.86
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/index.d.ts +6 -0
- package/dist/index.js +14 -1
- package/dist/libs/database.js +12 -0
- package/dist/migrations/015-create-facilities-tables.d.ts +3 -0
- package/dist/migrations/015-create-facilities-tables.js +119 -0
- package/dist/migrations/016-create-amenities-tables.d.ts +3 -0
- package/dist/migrations/016-create-amenities-tables.js +119 -0
- package/dist/migrations/017-add-upsert-indexes-amenities-facilities.d.ts +3 -0
- package/dist/migrations/017-add-upsert-indexes-amenities-facilities.js +56 -0
- package/dist/migrations/018-link-room-amenities-to-hotels.d.ts +3 -0
- package/dist/migrations/018-link-room-amenities-to-hotels.js +47 -0
- package/dist/models/Amenity.d.ts +9 -0
- package/dist/models/Amenity.js +47 -0
- package/dist/models/AmenityTranslation.d.ts +8 -0
- package/dist/models/AmenityTranslation.js +52 -0
- package/dist/models/Facility.d.ts +11 -0
- package/dist/models/Facility.js +52 -0
- package/dist/models/FacilityTranslation.d.ts +8 -0
- package/dist/models/FacilityTranslation.js +52 -0
- package/dist/models/Hotel.d.ts +6 -0
- package/dist/models/Hotel.js +15 -0
- package/dist/models/HotelFacility.d.ts +9 -0
- package/dist/models/HotelFacility.js +49 -0
- package/dist/models/RoomAmenity.d.ts +11 -0
- package/dist/models/RoomAmenity.js +64 -0
- package/package.json +1 -1
- package/dist/libs/translation.d.ts +0 -4
- package/dist/libs/translation.js +0 -21
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ export { HotelAccessibility } from './models/HotelAccessibility';
|
|
|
14
14
|
export { Referral } from './models/Referral';
|
|
15
15
|
export { Feedback } from './models/Feedback';
|
|
16
16
|
export { HotelRate } from './models/HotelRate';
|
|
17
|
+
export { Facility } from './models/Facility';
|
|
18
|
+
export { HotelFacility } from './models/HotelFacility';
|
|
19
|
+
export { FacilityTranslation } from './models/FacilityTranslation';
|
|
20
|
+
export { Amenity } from './models/Amenity';
|
|
21
|
+
export { RoomAmenity } from './models/RoomAmenity';
|
|
22
|
+
export { AmenityTranslation } from './models/AmenityTranslation';
|
|
17
23
|
export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
|
|
18
24
|
export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, PromoCodeRequest, PromoCodeResponse, EsimplyPackage, Addon, AddonResponse, } from './libs/liteapiv3';
|
|
19
25
|
export { LiteApiUser, LiteApiUserRequest } from './libs/liteapiuser';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LiteApiUser = exports.LiteApiClientV3 = exports.LiteApiClient = exports.HotelRate = exports.Feedback = exports.Referral = exports.HotelAccessibility = exports.Guest = exports.HotelTranslation = exports.Role = exports.Booking = exports.Project = exports.User = exports.Hotel = exports.Country = exports.City = exports.Agency = exports.runMigrations = exports.connect = void 0;
|
|
3
|
+
exports.LiteApiUser = exports.LiteApiClientV3 = exports.LiteApiClient = exports.AmenityTranslation = exports.RoomAmenity = exports.Amenity = exports.FacilityTranslation = exports.HotelFacility = exports.Facility = exports.HotelRate = exports.Feedback = exports.Referral = exports.HotelAccessibility = exports.Guest = exports.HotelTranslation = exports.Role = exports.Booking = exports.Project = exports.User = exports.Hotel = exports.Country = exports.City = exports.Agency = exports.runMigrations = exports.connect = void 0;
|
|
4
4
|
var database_1 = require("./libs/database");
|
|
5
5
|
Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return database_1.connect; } });
|
|
6
6
|
var migration_1 = require("./libs/migration");
|
|
@@ -33,6 +33,19 @@ var Feedback_1 = require("./models/Feedback");
|
|
|
33
33
|
Object.defineProperty(exports, "Feedback", { enumerable: true, get: function () { return Feedback_1.Feedback; } });
|
|
34
34
|
var HotelRate_1 = require("./models/HotelRate");
|
|
35
35
|
Object.defineProperty(exports, "HotelRate", { enumerable: true, get: function () { return HotelRate_1.HotelRate; } });
|
|
36
|
+
// New normalized models
|
|
37
|
+
var Facility_1 = require("./models/Facility");
|
|
38
|
+
Object.defineProperty(exports, "Facility", { enumerable: true, get: function () { return Facility_1.Facility; } });
|
|
39
|
+
var HotelFacility_1 = require("./models/HotelFacility");
|
|
40
|
+
Object.defineProperty(exports, "HotelFacility", { enumerable: true, get: function () { return HotelFacility_1.HotelFacility; } });
|
|
41
|
+
var FacilityTranslation_1 = require("./models/FacilityTranslation");
|
|
42
|
+
Object.defineProperty(exports, "FacilityTranslation", { enumerable: true, get: function () { return FacilityTranslation_1.FacilityTranslation; } });
|
|
43
|
+
var Amenity_1 = require("./models/Amenity");
|
|
44
|
+
Object.defineProperty(exports, "Amenity", { enumerable: true, get: function () { return Amenity_1.Amenity; } });
|
|
45
|
+
var RoomAmenity_1 = require("./models/RoomAmenity");
|
|
46
|
+
Object.defineProperty(exports, "RoomAmenity", { enumerable: true, get: function () { return RoomAmenity_1.RoomAmenity; } });
|
|
47
|
+
var AmenityTranslation_1 = require("./models/AmenityTranslation");
|
|
48
|
+
Object.defineProperty(exports, "AmenityTranslation", { enumerable: true, get: function () { return AmenityTranslation_1.AmenityTranslation; } });
|
|
36
49
|
var liteapi_1 = require("./libs/liteapi");
|
|
37
50
|
Object.defineProperty(exports, "LiteApiClient", { enumerable: true, get: function () { return liteapi_1.LiteApiClient; } });
|
|
38
51
|
var liteapiv3_1 = require("./libs/liteapiv3");
|
package/dist/libs/database.js
CHANGED
|
@@ -25,6 +25,12 @@ const HotelAccessibility_1 = require("../models/HotelAccessibility");
|
|
|
25
25
|
const Referral_1 = require("../models/Referral");
|
|
26
26
|
const Feedback_1 = require("../models/Feedback");
|
|
27
27
|
const HotelRate_1 = require("../models/HotelRate");
|
|
28
|
+
const Facility_1 = require("../models/Facility");
|
|
29
|
+
const HotelFacility_1 = require("../models/HotelFacility");
|
|
30
|
+
const FacilityTranslation_1 = require("../models/FacilityTranslation");
|
|
31
|
+
const Amenity_1 = require("../models/Amenity");
|
|
32
|
+
const RoomAmenity_1 = require("../models/RoomAmenity");
|
|
33
|
+
const AmenityTranslation_1 = require("../models/AmenityTranslation");
|
|
28
34
|
const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
35
|
const connection = new sequelize_typescript_1.Sequelize({
|
|
30
36
|
dialect: 'postgres',
|
|
@@ -48,6 +54,12 @@ const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, functio
|
|
|
48
54
|
Referral_1.Referral,
|
|
49
55
|
Feedback_1.Feedback,
|
|
50
56
|
HotelRate_1.HotelRate,
|
|
57
|
+
Facility_1.Facility,
|
|
58
|
+
HotelFacility_1.HotelFacility,
|
|
59
|
+
FacilityTranslation_1.FacilityTranslation,
|
|
60
|
+
Amenity_1.Amenity,
|
|
61
|
+
RoomAmenity_1.RoomAmenity,
|
|
62
|
+
AmenityTranslation_1.AmenityTranslation,
|
|
51
63
|
],
|
|
52
64
|
});
|
|
53
65
|
return connection
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
function up(queryInterface) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
// Create facilities table
|
|
17
|
+
yield queryInterface.createTable('facilities', {
|
|
18
|
+
id: {
|
|
19
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
20
|
+
primaryKey: true,
|
|
21
|
+
allowNull: false,
|
|
22
|
+
},
|
|
23
|
+
name: {
|
|
24
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
},
|
|
27
|
+
createdAt: {
|
|
28
|
+
type: sequelize_1.DataTypes.DATE,
|
|
29
|
+
allowNull: false,
|
|
30
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
31
|
+
},
|
|
32
|
+
updatedAt: {
|
|
33
|
+
type: sequelize_1.DataTypes.DATE,
|
|
34
|
+
allowNull: false,
|
|
35
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
// Create hotel_facilities join table
|
|
39
|
+
yield queryInterface.createTable('hotel_facilities', {
|
|
40
|
+
hotelId: {
|
|
41
|
+
type: sequelize_1.DataTypes.STRING,
|
|
42
|
+
primaryKey: true,
|
|
43
|
+
allowNull: false,
|
|
44
|
+
references: {
|
|
45
|
+
model: 'static_hotels',
|
|
46
|
+
key: 'id',
|
|
47
|
+
},
|
|
48
|
+
onUpdate: 'CASCADE',
|
|
49
|
+
onDelete: 'CASCADE',
|
|
50
|
+
},
|
|
51
|
+
facilityId: {
|
|
52
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
53
|
+
primaryKey: true,
|
|
54
|
+
allowNull: false,
|
|
55
|
+
references: {
|
|
56
|
+
model: 'facilities',
|
|
57
|
+
key: 'id',
|
|
58
|
+
},
|
|
59
|
+
onUpdate: 'CASCADE',
|
|
60
|
+
onDelete: 'CASCADE',
|
|
61
|
+
},
|
|
62
|
+
createdAt: {
|
|
63
|
+
type: sequelize_1.DataTypes.DATE,
|
|
64
|
+
allowNull: false,
|
|
65
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
66
|
+
},
|
|
67
|
+
updatedAt: {
|
|
68
|
+
type: sequelize_1.DataTypes.DATE,
|
|
69
|
+
allowNull: false,
|
|
70
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
// Create facility_translations table
|
|
74
|
+
yield queryInterface.createTable('facility_translations', {
|
|
75
|
+
facilityId: {
|
|
76
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
77
|
+
primaryKey: true,
|
|
78
|
+
allowNull: false,
|
|
79
|
+
references: {
|
|
80
|
+
model: 'facilities',
|
|
81
|
+
key: 'id',
|
|
82
|
+
},
|
|
83
|
+
onUpdate: 'CASCADE',
|
|
84
|
+
onDelete: 'CASCADE',
|
|
85
|
+
},
|
|
86
|
+
language: {
|
|
87
|
+
type: sequelize_1.DataTypes.STRING(10),
|
|
88
|
+
primaryKey: true,
|
|
89
|
+
allowNull: false,
|
|
90
|
+
},
|
|
91
|
+
name: {
|
|
92
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
93
|
+
allowNull: false,
|
|
94
|
+
},
|
|
95
|
+
createdAt: {
|
|
96
|
+
type: sequelize_1.DataTypes.DATE,
|
|
97
|
+
allowNull: false,
|
|
98
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
99
|
+
},
|
|
100
|
+
updatedAt: {
|
|
101
|
+
type: sequelize_1.DataTypes.DATE,
|
|
102
|
+
allowNull: false,
|
|
103
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
// Add indexes for better performance
|
|
107
|
+
yield queryInterface.addIndex('hotel_facilities', ['facilityId']);
|
|
108
|
+
yield queryInterface.addIndex('facility_translations', ['language']);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
exports.up = up;
|
|
112
|
+
function down(queryInterface) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
yield queryInterface.dropTable('facility_translations');
|
|
115
|
+
yield queryInterface.dropTable('hotel_facilities');
|
|
116
|
+
yield queryInterface.dropTable('facilities');
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
exports.down = down;
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
function up(queryInterface) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
// Create amenities table
|
|
17
|
+
yield queryInterface.createTable('amenities', {
|
|
18
|
+
id: {
|
|
19
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
20
|
+
primaryKey: true,
|
|
21
|
+
allowNull: false,
|
|
22
|
+
},
|
|
23
|
+
name: {
|
|
24
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
},
|
|
27
|
+
createdAt: {
|
|
28
|
+
type: sequelize_1.DataTypes.DATE,
|
|
29
|
+
allowNull: false,
|
|
30
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
31
|
+
},
|
|
32
|
+
updatedAt: {
|
|
33
|
+
type: sequelize_1.DataTypes.DATE,
|
|
34
|
+
allowNull: false,
|
|
35
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
// Create room_amenities join table
|
|
39
|
+
yield queryInterface.createTable('room_amenities', {
|
|
40
|
+
roomId: {
|
|
41
|
+
type: sequelize_1.DataTypes.BIGINT,
|
|
42
|
+
primaryKey: true,
|
|
43
|
+
allowNull: false,
|
|
44
|
+
},
|
|
45
|
+
amenityId: {
|
|
46
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
47
|
+
primaryKey: true,
|
|
48
|
+
allowNull: false,
|
|
49
|
+
references: {
|
|
50
|
+
model: 'amenities',
|
|
51
|
+
key: 'id',
|
|
52
|
+
},
|
|
53
|
+
onUpdate: 'CASCADE',
|
|
54
|
+
onDelete: 'CASCADE',
|
|
55
|
+
},
|
|
56
|
+
order: {
|
|
57
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
58
|
+
allowNull: false,
|
|
59
|
+
defaultValue: 0,
|
|
60
|
+
},
|
|
61
|
+
createdAt: {
|
|
62
|
+
type: sequelize_1.DataTypes.DATE,
|
|
63
|
+
allowNull: false,
|
|
64
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
65
|
+
},
|
|
66
|
+
updatedAt: {
|
|
67
|
+
type: sequelize_1.DataTypes.DATE,
|
|
68
|
+
allowNull: false,
|
|
69
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
// Create amenity_translations table
|
|
73
|
+
yield queryInterface.createTable('amenity_translations', {
|
|
74
|
+
amenityId: {
|
|
75
|
+
type: sequelize_1.DataTypes.INTEGER,
|
|
76
|
+
primaryKey: true,
|
|
77
|
+
allowNull: false,
|
|
78
|
+
references: {
|
|
79
|
+
model: 'amenities',
|
|
80
|
+
key: 'id',
|
|
81
|
+
},
|
|
82
|
+
onUpdate: 'CASCADE',
|
|
83
|
+
onDelete: 'CASCADE',
|
|
84
|
+
},
|
|
85
|
+
language: {
|
|
86
|
+
type: sequelize_1.DataTypes.STRING(10),
|
|
87
|
+
primaryKey: true,
|
|
88
|
+
allowNull: false,
|
|
89
|
+
},
|
|
90
|
+
name: {
|
|
91
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
92
|
+
allowNull: false,
|
|
93
|
+
},
|
|
94
|
+
createdAt: {
|
|
95
|
+
type: sequelize_1.DataTypes.DATE,
|
|
96
|
+
allowNull: false,
|
|
97
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
98
|
+
},
|
|
99
|
+
updatedAt: {
|
|
100
|
+
type: sequelize_1.DataTypes.DATE,
|
|
101
|
+
allowNull: false,
|
|
102
|
+
defaultValue: sequelize_1.DataTypes.NOW,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
// Add indexes for better performance
|
|
106
|
+
yield queryInterface.addIndex('room_amenities', ['amenityId']);
|
|
107
|
+
yield queryInterface.addIndex('room_amenities', ['roomId']);
|
|
108
|
+
yield queryInterface.addIndex('amenity_translations', ['language']);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
exports.up = up;
|
|
112
|
+
function down(queryInterface) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
yield queryInterface.dropTable('amenity_translations');
|
|
115
|
+
yield queryInterface.dropTable('room_amenities');
|
|
116
|
+
yield queryInterface.dropTable('amenities');
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
exports.down = down;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
function up(queryInterface) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
// Add unique constraints for upsert operations on translation tables
|
|
16
|
+
yield queryInterface.addConstraint('amenity_translations', {
|
|
17
|
+
fields: ['amenityId', 'language'],
|
|
18
|
+
type: 'unique',
|
|
19
|
+
name: 'amenity_translation_unique',
|
|
20
|
+
});
|
|
21
|
+
yield queryInterface.addConstraint('facility_translations', {
|
|
22
|
+
fields: ['facilityId', 'language'],
|
|
23
|
+
type: 'unique',
|
|
24
|
+
name: 'facility_translation_unique',
|
|
25
|
+
});
|
|
26
|
+
yield queryInterface.addIndex('amenity_translations', ['amenityId', 'language'], {
|
|
27
|
+
name: 'idx_amenity_translation_upsert',
|
|
28
|
+
unique: true,
|
|
29
|
+
});
|
|
30
|
+
yield queryInterface.addIndex('facility_translations', ['facilityId', 'language'], {
|
|
31
|
+
name: 'idx_facility_translation_upsert',
|
|
32
|
+
unique: true,
|
|
33
|
+
});
|
|
34
|
+
// Add indexes for the join tables to optimize bulk operations
|
|
35
|
+
yield queryInterface.addIndex('room_amenities', ['roomId', 'amenityId'], {
|
|
36
|
+
name: 'idx_room_amenities_composite',
|
|
37
|
+
});
|
|
38
|
+
yield queryInterface.addIndex('hotel_facilities', ['hotelId', 'facilityId'], {
|
|
39
|
+
name: 'idx_hotel_facilities_composite',
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.up = up;
|
|
44
|
+
function down(queryInterface) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
// Remove indexes
|
|
47
|
+
yield queryInterface.removeIndex('room_amenities', 'idx_room_amenities_composite');
|
|
48
|
+
yield queryInterface.removeIndex('hotel_facilities', 'idx_hotel_facilities_composite');
|
|
49
|
+
yield queryInterface.removeIndex('amenity_translations', 'idx_amenity_translation_upsert');
|
|
50
|
+
yield queryInterface.removeIndex('facility_translations', 'idx_facility_translation_upsert');
|
|
51
|
+
// Remove constraints
|
|
52
|
+
yield queryInterface.removeConstraint('amenity_translations', 'amenity_translation_unique');
|
|
53
|
+
yield queryInterface.removeConstraint('facility_translations', 'facility_translation_unique');
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
exports.down = down;
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
function up(queryInterface) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
// Add hotelId column to room_amenities table
|
|
17
|
+
yield queryInterface.addColumn('room_amenities', 'hotelId', {
|
|
18
|
+
type: sequelize_1.DataTypes.STRING,
|
|
19
|
+
allowNull: true,
|
|
20
|
+
references: {
|
|
21
|
+
model: 'static_hotels',
|
|
22
|
+
key: 'id',
|
|
23
|
+
},
|
|
24
|
+
onUpdate: 'CASCADE',
|
|
25
|
+
onDelete: 'CASCADE',
|
|
26
|
+
});
|
|
27
|
+
// Add index for better performance
|
|
28
|
+
yield queryInterface.addIndex('room_amenities', ['hotelId'], {
|
|
29
|
+
name: 'idx_room_amenities_hotel_id',
|
|
30
|
+
});
|
|
31
|
+
// Add composite index for filtering
|
|
32
|
+
yield queryInterface.addIndex('room_amenities', ['hotelId', 'amenityId'], {
|
|
33
|
+
name: 'idx_room_amenities_hotel_amenity',
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.up = up;
|
|
38
|
+
function down(queryInterface) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
// Remove indexes
|
|
41
|
+
yield queryInterface.removeIndex('room_amenities', 'idx_room_amenities_hotel_amenity');
|
|
42
|
+
yield queryInterface.removeIndex('room_amenities', 'idx_room_amenities_hotel_id');
|
|
43
|
+
// Remove column
|
|
44
|
+
yield queryInterface.removeColumn('room_amenities', 'hotelId');
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.down = down;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { RoomAmenity } from './RoomAmenity';
|
|
3
|
+
import { AmenityTranslation } from './AmenityTranslation';
|
|
4
|
+
export declare class Amenity extends Model<Partial<Amenity>> {
|
|
5
|
+
id: number;
|
|
6
|
+
name: string;
|
|
7
|
+
roomAmenities: RoomAmenity[];
|
|
8
|
+
translations: AmenityTranslation[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Amenity = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const RoomAmenity_1 = require("./RoomAmenity");
|
|
15
|
+
const AmenityTranslation_1 = require("./AmenityTranslation");
|
|
16
|
+
let Amenity = class Amenity extends sequelize_typescript_1.Model {
|
|
17
|
+
};
|
|
18
|
+
exports.Amenity = Amenity;
|
|
19
|
+
__decorate([
|
|
20
|
+
sequelize_typescript_1.PrimaryKey,
|
|
21
|
+
(0, sequelize_typescript_1.Column)({
|
|
22
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
23
|
+
allowNull: false,
|
|
24
|
+
}),
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], Amenity.prototype, "id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
sequelize_typescript_1.Unique,
|
|
29
|
+
(0, sequelize_typescript_1.Column)({
|
|
30
|
+
type: sequelize_typescript_1.DataType.TEXT,
|
|
31
|
+
allowNull: false,
|
|
32
|
+
}),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], Amenity.prototype, "name", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, sequelize_typescript_1.HasMany)(() => RoomAmenity_1.RoomAmenity),
|
|
37
|
+
__metadata("design:type", Array)
|
|
38
|
+
], Amenity.prototype, "roomAmenities", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, sequelize_typescript_1.HasMany)(() => AmenityTranslation_1.AmenityTranslation),
|
|
41
|
+
__metadata("design:type", Array)
|
|
42
|
+
], Amenity.prototype, "translations", void 0);
|
|
43
|
+
exports.Amenity = Amenity = __decorate([
|
|
44
|
+
(0, sequelize_typescript_1.Table)({
|
|
45
|
+
tableName: 'amenities',
|
|
46
|
+
})
|
|
47
|
+
], Amenity);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AmenityTranslation = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Amenity_1 = require("./Amenity");
|
|
15
|
+
let AmenityTranslation = class AmenityTranslation extends sequelize_typescript_1.Model {
|
|
16
|
+
};
|
|
17
|
+
exports.AmenityTranslation = AmenityTranslation;
|
|
18
|
+
__decorate([
|
|
19
|
+
sequelize_typescript_1.PrimaryKey,
|
|
20
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Amenity_1.Amenity),
|
|
21
|
+
(0, sequelize_typescript_1.Unique)('amenity_translation_unique'),
|
|
22
|
+
(0, sequelize_typescript_1.Column)({
|
|
23
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
24
|
+
allowNull: false,
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], AmenityTranslation.prototype, "amenityId", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
sequelize_typescript_1.PrimaryKey,
|
|
30
|
+
(0, sequelize_typescript_1.Unique)('amenity_translation_unique'),
|
|
31
|
+
(0, sequelize_typescript_1.Column)({
|
|
32
|
+
type: sequelize_typescript_1.DataType.STRING(10),
|
|
33
|
+
allowNull: false,
|
|
34
|
+
}),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AmenityTranslation.prototype, "language", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, sequelize_typescript_1.Column)({
|
|
39
|
+
type: sequelize_typescript_1.DataType.TEXT,
|
|
40
|
+
allowNull: false,
|
|
41
|
+
}),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], AmenityTranslation.prototype, "name", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Amenity_1.Amenity),
|
|
46
|
+
__metadata("design:type", Amenity_1.Amenity)
|
|
47
|
+
], AmenityTranslation.prototype, "amenity", void 0);
|
|
48
|
+
exports.AmenityTranslation = AmenityTranslation = __decorate([
|
|
49
|
+
(0, sequelize_typescript_1.Table)({
|
|
50
|
+
tableName: 'amenity_translations',
|
|
51
|
+
})
|
|
52
|
+
], AmenityTranslation);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { Hotel } from './Hotel';
|
|
3
|
+
import { HotelFacility } from './HotelFacility';
|
|
4
|
+
import { FacilityTranslation } from './FacilityTranslation';
|
|
5
|
+
export declare class Facility extends Model<Partial<Facility>> {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
hotelFacilities: HotelFacility[];
|
|
9
|
+
translations: FacilityTranslation[];
|
|
10
|
+
hotels: Hotel[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Facility = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Hotel_1 = require("./Hotel");
|
|
15
|
+
const HotelFacility_1 = require("./HotelFacility");
|
|
16
|
+
const FacilityTranslation_1 = require("./FacilityTranslation");
|
|
17
|
+
let Facility = class Facility extends sequelize_typescript_1.Model {
|
|
18
|
+
};
|
|
19
|
+
exports.Facility = Facility;
|
|
20
|
+
__decorate([
|
|
21
|
+
sequelize_typescript_1.PrimaryKey,
|
|
22
|
+
(0, sequelize_typescript_1.Column)({
|
|
23
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
24
|
+
allowNull: false,
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], Facility.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
sequelize_typescript_1.Unique,
|
|
30
|
+
(0, sequelize_typescript_1.Column)({
|
|
31
|
+
type: sequelize_typescript_1.DataType.TEXT,
|
|
32
|
+
allowNull: false,
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Facility.prototype, "name", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, sequelize_typescript_1.HasMany)(() => HotelFacility_1.HotelFacility),
|
|
38
|
+
__metadata("design:type", Array)
|
|
39
|
+
], Facility.prototype, "hotelFacilities", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, sequelize_typescript_1.HasMany)(() => FacilityTranslation_1.FacilityTranslation),
|
|
42
|
+
__metadata("design:type", Array)
|
|
43
|
+
], Facility.prototype, "translations", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, sequelize_typescript_1.BelongsToMany)(() => Hotel_1.Hotel, () => HotelFacility_1.HotelFacility),
|
|
46
|
+
__metadata("design:type", Array)
|
|
47
|
+
], Facility.prototype, "hotels", void 0);
|
|
48
|
+
exports.Facility = Facility = __decorate([
|
|
49
|
+
(0, sequelize_typescript_1.Table)({
|
|
50
|
+
tableName: 'facilities',
|
|
51
|
+
})
|
|
52
|
+
], Facility);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FacilityTranslation = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Facility_1 = require("./Facility");
|
|
15
|
+
let FacilityTranslation = class FacilityTranslation extends sequelize_typescript_1.Model {
|
|
16
|
+
};
|
|
17
|
+
exports.FacilityTranslation = FacilityTranslation;
|
|
18
|
+
__decorate([
|
|
19
|
+
sequelize_typescript_1.PrimaryKey,
|
|
20
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Facility_1.Facility),
|
|
21
|
+
(0, sequelize_typescript_1.Unique)('facility_translation_unique'),
|
|
22
|
+
(0, sequelize_typescript_1.Column)({
|
|
23
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
24
|
+
allowNull: false,
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], FacilityTranslation.prototype, "facilityId", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
sequelize_typescript_1.PrimaryKey,
|
|
30
|
+
(0, sequelize_typescript_1.Unique)('facility_translation_unique'),
|
|
31
|
+
(0, sequelize_typescript_1.Column)({
|
|
32
|
+
type: sequelize_typescript_1.DataType.STRING(10),
|
|
33
|
+
allowNull: false,
|
|
34
|
+
}),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], FacilityTranslation.prototype, "language", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, sequelize_typescript_1.Column)({
|
|
39
|
+
type: sequelize_typescript_1.DataType.TEXT,
|
|
40
|
+
allowNull: false,
|
|
41
|
+
}),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], FacilityTranslation.prototype, "name", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Facility_1.Facility),
|
|
46
|
+
__metadata("design:type", Facility_1.Facility)
|
|
47
|
+
], FacilityTranslation.prototype, "facility", void 0);
|
|
48
|
+
exports.FacilityTranslation = FacilityTranslation = __decorate([
|
|
49
|
+
(0, sequelize_typescript_1.Table)({
|
|
50
|
+
tableName: 'facility_translations',
|
|
51
|
+
})
|
|
52
|
+
], FacilityTranslation);
|
package/dist/models/Hotel.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { Model } from 'sequelize-typescript';
|
|
|
2
2
|
import { AvailabilityResult } from '../libs/liteapi';
|
|
3
3
|
import { HotelAccessibility } from './HotelAccessibility';
|
|
4
4
|
import { HotelTranslation } from './HotelTranslation';
|
|
5
|
+
import { HotelFacility } from './HotelFacility';
|
|
6
|
+
import { Facility as FacilityModel } from './Facility';
|
|
7
|
+
import { RoomAmenity as RoomAmenityModel } from './RoomAmenity';
|
|
5
8
|
export type HotelImage = {
|
|
6
9
|
url: string;
|
|
7
10
|
thumbnailUrl: string;
|
|
@@ -107,6 +110,9 @@ export declare class Hotel extends Model<Partial<Hotel>> {
|
|
|
107
110
|
video?: string;
|
|
108
111
|
accessibility: HotelAccessibility;
|
|
109
112
|
translations: HotelTranslation[];
|
|
113
|
+
hotelFacilityRelations: HotelFacility[];
|
|
114
|
+
normalizedFacilities: FacilityModel[];
|
|
115
|
+
roomAmenities: RoomAmenityModel[];
|
|
110
116
|
static includeTranslations(options: any, language?: string): any;
|
|
111
117
|
static applyTranslations(hotel: Hotel): Hotel;
|
|
112
118
|
static findOneWithTranslation(options: any, language?: string): Promise<Hotel>;
|
package/dist/models/Hotel.js
CHANGED
|
@@ -22,6 +22,9 @@ exports.Hotel = void 0;
|
|
|
22
22
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
23
23
|
const HotelAccessibility_1 = require("./HotelAccessibility");
|
|
24
24
|
const HotelTranslation_1 = require("./HotelTranslation");
|
|
25
|
+
const HotelFacility_1 = require("./HotelFacility");
|
|
26
|
+
const Facility_1 = require("./Facility");
|
|
27
|
+
const RoomAmenity_1 = require("./RoomAmenity");
|
|
25
28
|
let Hotel = class Hotel extends sequelize_typescript_1.Model {
|
|
26
29
|
// Include translations in the options
|
|
27
30
|
static includeTranslations(options, language) {
|
|
@@ -449,6 +452,18 @@ __decorate([
|
|
|
449
452
|
(0, sequelize_typescript_1.HasMany)(() => HotelTranslation_1.HotelTranslation),
|
|
450
453
|
__metadata("design:type", Array)
|
|
451
454
|
], Hotel.prototype, "translations", void 0);
|
|
455
|
+
__decorate([
|
|
456
|
+
(0, sequelize_typescript_1.HasMany)(() => HotelFacility_1.HotelFacility),
|
|
457
|
+
__metadata("design:type", Array)
|
|
458
|
+
], Hotel.prototype, "hotelFacilityRelations", void 0);
|
|
459
|
+
__decorate([
|
|
460
|
+
(0, sequelize_typescript_1.BelongsToMany)(() => Facility_1.Facility, () => HotelFacility_1.HotelFacility),
|
|
461
|
+
__metadata("design:type", Array)
|
|
462
|
+
], Hotel.prototype, "normalizedFacilities", void 0);
|
|
463
|
+
__decorate([
|
|
464
|
+
(0, sequelize_typescript_1.HasMany)(() => RoomAmenity_1.RoomAmenity),
|
|
465
|
+
__metadata("design:type", Array)
|
|
466
|
+
], Hotel.prototype, "roomAmenities", void 0);
|
|
452
467
|
exports.Hotel = Hotel = __decorate([
|
|
453
468
|
(0, sequelize_typescript_1.Table)({
|
|
454
469
|
tableName: 'static_hotels',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { Hotel } from './Hotel';
|
|
3
|
+
import { Facility } from './Facility';
|
|
4
|
+
export declare class HotelFacility extends Model<Partial<HotelFacility>> {
|
|
5
|
+
hotelId: string;
|
|
6
|
+
facilityId: number;
|
|
7
|
+
hotel: Hotel;
|
|
8
|
+
facility: Facility;
|
|
9
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HotelFacility = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Hotel_1 = require("./Hotel");
|
|
15
|
+
const Facility_1 = require("./Facility");
|
|
16
|
+
let HotelFacility = class HotelFacility extends sequelize_typescript_1.Model {
|
|
17
|
+
};
|
|
18
|
+
exports.HotelFacility = HotelFacility;
|
|
19
|
+
__decorate([
|
|
20
|
+
sequelize_typescript_1.PrimaryKey,
|
|
21
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Hotel_1.Hotel),
|
|
22
|
+
(0, sequelize_typescript_1.Column)({
|
|
23
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
24
|
+
allowNull: false,
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], HotelFacility.prototype, "hotelId", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
sequelize_typescript_1.PrimaryKey,
|
|
30
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Facility_1.Facility),
|
|
31
|
+
(0, sequelize_typescript_1.Column)({
|
|
32
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
33
|
+
allowNull: false,
|
|
34
|
+
}),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], HotelFacility.prototype, "facilityId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Hotel_1.Hotel),
|
|
39
|
+
__metadata("design:type", Hotel_1.Hotel)
|
|
40
|
+
], HotelFacility.prototype, "hotel", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Facility_1.Facility),
|
|
43
|
+
__metadata("design:type", Facility_1.Facility)
|
|
44
|
+
], HotelFacility.prototype, "facility", void 0);
|
|
45
|
+
exports.HotelFacility = HotelFacility = __decorate([
|
|
46
|
+
(0, sequelize_typescript_1.Table)({
|
|
47
|
+
tableName: 'hotel_facilities',
|
|
48
|
+
})
|
|
49
|
+
], HotelFacility);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { Amenity } from './Amenity';
|
|
3
|
+
import { Hotel } from './Hotel';
|
|
4
|
+
export declare class RoomAmenity extends Model<Partial<RoomAmenity>> {
|
|
5
|
+
roomId: number;
|
|
6
|
+
hotelId: string;
|
|
7
|
+
amenityId: number;
|
|
8
|
+
order: number;
|
|
9
|
+
amenity: Amenity;
|
|
10
|
+
hotel: Hotel;
|
|
11
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RoomAmenity = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Amenity_1 = require("./Amenity");
|
|
15
|
+
const Hotel_1 = require("./Hotel");
|
|
16
|
+
let RoomAmenity = class RoomAmenity extends sequelize_typescript_1.Model {
|
|
17
|
+
};
|
|
18
|
+
exports.RoomAmenity = RoomAmenity;
|
|
19
|
+
__decorate([
|
|
20
|
+
sequelize_typescript_1.PrimaryKey,
|
|
21
|
+
(0, sequelize_typescript_1.Column)({
|
|
22
|
+
type: sequelize_typescript_1.DataType.BIGINT,
|
|
23
|
+
allowNull: false,
|
|
24
|
+
}),
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], RoomAmenity.prototype, "roomId", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Hotel_1.Hotel),
|
|
29
|
+
(0, sequelize_typescript_1.Column)({
|
|
30
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
31
|
+
allowNull: true,
|
|
32
|
+
}),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], RoomAmenity.prototype, "hotelId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
sequelize_typescript_1.PrimaryKey,
|
|
37
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Amenity_1.Amenity),
|
|
38
|
+
(0, sequelize_typescript_1.Column)({
|
|
39
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
40
|
+
allowNull: false,
|
|
41
|
+
}),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], RoomAmenity.prototype, "amenityId", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, sequelize_typescript_1.Column)({
|
|
46
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
47
|
+
allowNull: false,
|
|
48
|
+
defaultValue: 0,
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Number)
|
|
51
|
+
], RoomAmenity.prototype, "order", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Amenity_1.Amenity),
|
|
54
|
+
__metadata("design:type", Amenity_1.Amenity)
|
|
55
|
+
], RoomAmenity.prototype, "amenity", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Hotel_1.Hotel),
|
|
58
|
+
__metadata("design:type", Hotel_1.Hotel)
|
|
59
|
+
], RoomAmenity.prototype, "hotel", void 0);
|
|
60
|
+
exports.RoomAmenity = RoomAmenity = __decorate([
|
|
61
|
+
(0, sequelize_typescript_1.Table)({
|
|
62
|
+
tableName: 'room_amenities',
|
|
63
|
+
})
|
|
64
|
+
], RoomAmenity);
|
package/package.json
CHANGED
package/dist/libs/translation.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTranslationFallback = void 0;
|
|
4
|
-
const sequelize_1 = require("sequelize");
|
|
5
|
-
const HotelTranslation_1 = require("../models/HotelTranslation");
|
|
6
|
-
function getTranslationFallback(language = 'en', attributes) {
|
|
7
|
-
return {
|
|
8
|
-
include: [
|
|
9
|
-
{
|
|
10
|
-
model: HotelTranslation_1.HotelTranslation,
|
|
11
|
-
as: 'translations',
|
|
12
|
-
attributes,
|
|
13
|
-
where: {
|
|
14
|
-
[sequelize_1.Op.or]: [{ language }],
|
|
15
|
-
},
|
|
16
|
-
required: false,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
exports.getTranslationFallback = getTranslationFallback;
|