whitelabel-db 1.1.95 → 1.1.96
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 +1 -12
- package/dist/index.js +1 -27
- package/dist/libs/database.d.ts +1 -1
- package/dist/libs/database.js +7 -32
- package/dist/libs/liteapiv3.d.ts +5 -17
- package/dist/libs/liteapiv3.js +3 -52
- package/dist/libs/migration.js +3 -27
- package/dist/models/Booking.d.ts +0 -6
- package/dist/models/Booking.js +0 -42
- package/dist/models/Guest.d.ts +0 -12
- package/dist/models/Guest.js +3 -74
- package/dist/models/Hotel.d.ts +0 -7
- package/dist/models/Hotel.js +0 -23
- package/dist/models/Project.d.ts +0 -7
- package/dist/models/Project.js +0 -33
- package/dist/models/Search.d.ts +8 -0
- package/dist/models/{Facility.js → Search.js} +33 -24
- package/dist/models/User.d.ts +0 -3
- package/dist/models/User.js +0 -21
- package/package.json +1 -1
- package/dist/migrations/010-add-user-resetToken.d.ts +0 -3
- package/dist/migrations/010-add-user-resetToken.js +0 -44
- package/dist/migrations/011-add-project-resceotToke.d.ts +0 -3
- package/dist/migrations/011-add-project-resceotToke.js +0 -40
- package/dist/migrations/012-add-otp-expire.d.ts +0 -3
- package/dist/migrations/012-add-otp-expire.js +0 -44
- package/dist/migrations/013-add-bookings-payment.d.ts +0 -3
- package/dist/migrations/013-add-bookings-payment.js +0 -48
- package/dist/migrations/014-add-hotel-placeid.d.ts +0 -3
- package/dist/migrations/014-add-hotel-placeid.js +0 -29
- package/dist/migrations/015-create-facilities-tables.d.ts +0 -3
- package/dist/migrations/015-create-facilities-tables.js +0 -119
- package/dist/migrations/016-create-amenities-tables.d.ts +0 -3
- package/dist/migrations/016-create-amenities-tables.js +0 -119
- package/dist/migrations/017-add-upsert-indexes-amenities-facilities.d.ts +0 -3
- package/dist/migrations/017-add-upsert-indexes-amenities-facilities.js +0 -56
- package/dist/migrations/018-link-room-amenities-to-hotels.d.ts +0 -3
- package/dist/migrations/018-link-room-amenities-to-hotels.js +0 -47
- package/dist/migrations/019-add-marketsegment-project.d.ts +0 -3
- package/dist/migrations/019-add-marketsegment-project.js +0 -31
- package/dist/migrations/020-booking-source.d.ts +0 -3
- package/dist/migrations/020-booking-source.js +0 -47
- package/dist/migrations/021-add-analytics-indexes.d.ts +0 -3
- package/dist/migrations/021-add-analytics-indexes.js +0 -91
- package/dist/migrations/022-add-project-isactive.d.ts +0 -3
- package/dist/migrations/022-add-project-isactive.js +0 -40
- package/dist/migrations/023-add-anonymous-user-support.d.ts +0 -3
- package/dist/migrations/023-add-anonymous-user-support.js +0 -104
- package/dist/models/Amenity.d.ts +0 -9
- package/dist/models/Amenity.js +0 -47
- package/dist/models/AmenityTranslation.d.ts +0 -8
- package/dist/models/AmenityTranslation.js +0 -52
- package/dist/models/AnalyticsSummary.d.ts +0 -13
- package/dist/models/AnalyticsSummary.js +0 -122
- package/dist/models/Collection.d.ts +0 -19
- package/dist/models/Collection.js +0 -90
- package/dist/models/CollectionItem.d.ts +0 -18
- package/dist/models/CollectionItem.js +0 -84
- package/dist/models/CollectionItemCustomField.d.ts +0 -10
- package/dist/models/CollectionItemCustomField.js +0 -67
- package/dist/models/Creator.d.ts +0 -12
- package/dist/models/Creator.js +0 -82
- package/dist/models/Facility.d.ts +0 -11
- package/dist/models/FacilityTranslation.d.ts +0 -8
- package/dist/models/FacilityTranslation.js +0 -52
- package/dist/models/HotelFacility.d.ts +0 -9
- package/dist/models/HotelFacility.js +0 -49
- package/dist/models/RoomAmenity.d.ts +0 -11
- package/dist/models/RoomAmenity.js +0 -64
package/dist/index.d.ts
CHANGED
|
@@ -14,17 +14,6 @@ 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 { AnalyticsSummary } from './models/AnalyticsSummary';
|
|
18
|
-
export { Facility } from './models/Facility';
|
|
19
|
-
export { HotelFacility } from './models/HotelFacility';
|
|
20
|
-
export { FacilityTranslation } from './models/FacilityTranslation';
|
|
21
|
-
export { Amenity } from './models/Amenity';
|
|
22
|
-
export { RoomAmenity } from './models/RoomAmenity';
|
|
23
|
-
export { AmenityTranslation } from './models/AmenityTranslation';
|
|
24
|
-
export { Creator } from './models/Creator';
|
|
25
|
-
export { Collection, CollectionStatus } from './models/Collection';
|
|
26
|
-
export { CollectionItem, CollectionType } from './models/CollectionItem';
|
|
27
|
-
export { CollectionItemCustomField } from './models/CollectionItemCustomField';
|
|
28
17
|
export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
|
|
29
|
-
export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3,
|
|
18
|
+
export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, VoucherRequest, VoucherResponse, EsimplyPackage, Addon, AddonResponse, } from './libs/liteapiv3';
|
|
30
19
|
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.
|
|
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;
|
|
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,32 +33,6 @@ 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
|
-
var AnalyticsSummary_1 = require("./models/AnalyticsSummary");
|
|
37
|
-
Object.defineProperty(exports, "AnalyticsSummary", { enumerable: true, get: function () { return AnalyticsSummary_1.AnalyticsSummary; } });
|
|
38
|
-
// New normalized models
|
|
39
|
-
var Facility_1 = require("./models/Facility");
|
|
40
|
-
Object.defineProperty(exports, "Facility", { enumerable: true, get: function () { return Facility_1.Facility; } });
|
|
41
|
-
var HotelFacility_1 = require("./models/HotelFacility");
|
|
42
|
-
Object.defineProperty(exports, "HotelFacility", { enumerable: true, get: function () { return HotelFacility_1.HotelFacility; } });
|
|
43
|
-
var FacilityTranslation_1 = require("./models/FacilityTranslation");
|
|
44
|
-
Object.defineProperty(exports, "FacilityTranslation", { enumerable: true, get: function () { return FacilityTranslation_1.FacilityTranslation; } });
|
|
45
|
-
var Amenity_1 = require("./models/Amenity");
|
|
46
|
-
Object.defineProperty(exports, "Amenity", { enumerable: true, get: function () { return Amenity_1.Amenity; } });
|
|
47
|
-
var RoomAmenity_1 = require("./models/RoomAmenity");
|
|
48
|
-
Object.defineProperty(exports, "RoomAmenity", { enumerable: true, get: function () { return RoomAmenity_1.RoomAmenity; } });
|
|
49
|
-
var AmenityTranslation_1 = require("./models/AmenityTranslation");
|
|
50
|
-
Object.defineProperty(exports, "AmenityTranslation", { enumerable: true, get: function () { return AmenityTranslation_1.AmenityTranslation; } });
|
|
51
|
-
// Collection and Creator models
|
|
52
|
-
var Creator_1 = require("./models/Creator");
|
|
53
|
-
Object.defineProperty(exports, "Creator", { enumerable: true, get: function () { return Creator_1.Creator; } });
|
|
54
|
-
var Collection_1 = require("./models/Collection");
|
|
55
|
-
Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return Collection_1.Collection; } });
|
|
56
|
-
Object.defineProperty(exports, "CollectionStatus", { enumerable: true, get: function () { return Collection_1.CollectionStatus; } });
|
|
57
|
-
var CollectionItem_1 = require("./models/CollectionItem");
|
|
58
|
-
Object.defineProperty(exports, "CollectionItem", { enumerable: true, get: function () { return CollectionItem_1.CollectionItem; } });
|
|
59
|
-
Object.defineProperty(exports, "CollectionType", { enumerable: true, get: function () { return CollectionItem_1.CollectionType; } });
|
|
60
|
-
var CollectionItemCustomField_1 = require("./models/CollectionItemCustomField");
|
|
61
|
-
Object.defineProperty(exports, "CollectionItemCustomField", { enumerable: true, get: function () { return CollectionItemCustomField_1.CollectionItemCustomField; } });
|
|
62
36
|
var liteapi_1 = require("./libs/liteapi");
|
|
63
37
|
Object.defineProperty(exports, "LiteApiClient", { enumerable: true, get: function () { return liteapi_1.LiteApiClient; } });
|
|
64
38
|
var liteapiv3_1 = require("./libs/liteapiv3");
|
package/dist/libs/database.d.ts
CHANGED
package/dist/libs/database.js
CHANGED
|
@@ -25,17 +25,6 @@ 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");
|
|
34
|
-
const AnalyticsSummary_1 = require("../models/AnalyticsSummary");
|
|
35
|
-
const Creator_1 = require("../models/Creator");
|
|
36
|
-
const Collection_1 = require("../models/Collection");
|
|
37
|
-
const CollectionItem_1 = require("../models/CollectionItem");
|
|
38
|
-
const CollectionItemCustomField_1 = require("../models/CollectionItemCustomField");
|
|
39
28
|
const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
29
|
const connection = new sequelize_typescript_1.Sequelize({
|
|
41
30
|
dialect: 'postgres',
|
|
@@ -59,30 +48,16 @@ const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, functio
|
|
|
59
48
|
Referral_1.Referral,
|
|
60
49
|
Feedback_1.Feedback,
|
|
61
50
|
HotelRate_1.HotelRate,
|
|
62
|
-
Facility_1.Facility,
|
|
63
|
-
HotelFacility_1.HotelFacility,
|
|
64
|
-
FacilityTranslation_1.FacilityTranslation,
|
|
65
|
-
Amenity_1.Amenity,
|
|
66
|
-
RoomAmenity_1.RoomAmenity,
|
|
67
|
-
AmenityTranslation_1.AmenityTranslation,
|
|
68
|
-
AnalyticsSummary_1.AnalyticsSummary,
|
|
69
|
-
Creator_1.Creator,
|
|
70
|
-
Collection_1.Collection,
|
|
71
|
-
CollectionItem_1.CollectionItem,
|
|
72
|
-
CollectionItemCustomField_1.CollectionItemCustomField,
|
|
73
51
|
],
|
|
74
52
|
});
|
|
75
|
-
|
|
76
|
-
|
|
53
|
+
return connection
|
|
54
|
+
.authenticate()
|
|
55
|
+
.then(() => {
|
|
77
56
|
console.log('Database connection has been established successfully.');
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return connection;
|
|
82
|
-
}
|
|
83
|
-
catch (err) {
|
|
57
|
+
return connection.sync();
|
|
58
|
+
})
|
|
59
|
+
.catch((err) => {
|
|
84
60
|
console.error('Unable to connect to the database:', err);
|
|
85
|
-
|
|
86
|
-
}
|
|
61
|
+
});
|
|
87
62
|
});
|
|
88
63
|
exports.connect = connect;
|
package/dist/libs/liteapiv3.d.ts
CHANGED
|
@@ -109,8 +109,6 @@ export interface PrebookRateRequestV3 {
|
|
|
109
109
|
usePaymentSdk?: boolean;
|
|
110
110
|
payment: {
|
|
111
111
|
descriptorSuffix?: string;
|
|
112
|
-
gateway?: string;
|
|
113
|
-
useOwnSecretKey?: boolean;
|
|
114
112
|
};
|
|
115
113
|
trackingId?: string;
|
|
116
114
|
voucherCode?: string;
|
|
@@ -156,12 +154,6 @@ export interface PrebookRateV3 {
|
|
|
156
154
|
checkin: string;
|
|
157
155
|
checkout: string;
|
|
158
156
|
paymentTypes: string[];
|
|
159
|
-
creditLine: {
|
|
160
|
-
remainingCredit: number;
|
|
161
|
-
currency: string;
|
|
162
|
-
};
|
|
163
|
-
secretKey?: string;
|
|
164
|
-
publishableKey?: string;
|
|
165
157
|
}
|
|
166
158
|
export interface GuestInfoV3 {
|
|
167
159
|
guestFirstName: string;
|
|
@@ -322,7 +314,7 @@ export interface GuestBookingV3 {
|
|
|
322
314
|
updatedAt: string;
|
|
323
315
|
deletedAt: string;
|
|
324
316
|
}
|
|
325
|
-
export interface
|
|
317
|
+
export interface VoucherResponse {
|
|
326
318
|
id: number;
|
|
327
319
|
voucher_code: string;
|
|
328
320
|
discount_type: string;
|
|
@@ -341,7 +333,7 @@ export interface PromoCodeResponse {
|
|
|
341
333
|
terms_and_conditions: string | null;
|
|
342
334
|
category?: string;
|
|
343
335
|
}
|
|
344
|
-
export interface
|
|
336
|
+
export interface VoucherRequest {
|
|
345
337
|
voucher_code: string;
|
|
346
338
|
discount_type: string;
|
|
347
339
|
discount_value: number;
|
|
@@ -384,12 +376,8 @@ export declare class LiteApiClientV3 {
|
|
|
384
376
|
getGuests(): Promise<GuestV3[]>;
|
|
385
377
|
getGuest(guestId: number): Promise<GuestV3>;
|
|
386
378
|
getGuestBookings(guestId: number): Promise<GuestBookingV3[]>;
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
updatePromoCode(data: PromoCodeRequest, promoCodeId: number): Promise<string>;
|
|
390
|
-
getPromoCode(promoCodeId: number): Promise<PromoCodeResponse>;
|
|
391
|
-
updatePromoCodeStatus(promoCodeId: number, status: 'active' | 'inactive'): Promise<string>;
|
|
392
|
-
deletePromoCode(promoCodeId: number): Promise<string>;
|
|
379
|
+
createVoucher(data: VoucherRequest): Promise<VoucherResponse>;
|
|
380
|
+
getVouchers(): Promise<VoucherResponse[]>;
|
|
393
381
|
getEsimplyPackages(options: {
|
|
394
382
|
countryCode: string;
|
|
395
383
|
}): Promise<EsimplyPackage[]>;
|
|
@@ -401,5 +389,5 @@ export declare class LiteApiClientV3 {
|
|
|
401
389
|
points: number;
|
|
402
390
|
currency: string;
|
|
403
391
|
guestId: number;
|
|
404
|
-
}): Promise<
|
|
392
|
+
}): Promise<VoucherResponse>;
|
|
405
393
|
}
|
package/dist/libs/liteapiv3.js
CHANGED
|
@@ -84,7 +84,7 @@ class LiteApiClientV3 {
|
|
|
84
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
85
|
return (yield (0, axios_1.default)({
|
|
86
86
|
method: 'post',
|
|
87
|
-
url: `${this.bookingBaseUrl}/v3.0/rates/prebook
|
|
87
|
+
url: `${this.bookingBaseUrl}/v3.0/rates/prebook`,
|
|
88
88
|
data: options,
|
|
89
89
|
headers: {
|
|
90
90
|
'X-API-Key': this.apiKey,
|
|
@@ -160,8 +160,7 @@ class LiteApiClientV3 {
|
|
|
160
160
|
})).data.data;
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
|
|
164
|
-
createPromoCode(data) {
|
|
163
|
+
createVoucher(data) {
|
|
165
164
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
165
|
return (yield (0, axios_1.default)({
|
|
167
166
|
method: 'post',
|
|
@@ -174,7 +173,7 @@ class LiteApiClientV3 {
|
|
|
174
173
|
})).data.voucher;
|
|
175
174
|
});
|
|
176
175
|
}
|
|
177
|
-
|
|
176
|
+
getVouchers() {
|
|
178
177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
179
178
|
return (yield (0, axios_1.default)({
|
|
180
179
|
url: `${this.voucherBaseUrl}/vouchers`,
|
|
@@ -184,54 +183,6 @@ class LiteApiClientV3 {
|
|
|
184
183
|
})).data.vouchers;
|
|
185
184
|
});
|
|
186
185
|
}
|
|
187
|
-
updatePromoCode(data, promoCodeId) {
|
|
188
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
-
return (yield (0, axios_1.default)({
|
|
190
|
-
method: 'put',
|
|
191
|
-
url: `${this.voucherBaseUrl}/vouchers/${promoCodeId}`,
|
|
192
|
-
data,
|
|
193
|
-
headers: {
|
|
194
|
-
'X-API-Key': this.apiKey,
|
|
195
|
-
'content-type': 'application/json',
|
|
196
|
-
},
|
|
197
|
-
})).data.message;
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
getPromoCode(promoCodeId) {
|
|
201
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
-
return (yield (0, axios_1.default)({
|
|
203
|
-
url: `${this.voucherBaseUrl}/vouchers/${promoCodeId}`,
|
|
204
|
-
headers: {
|
|
205
|
-
'X-API-Key': this.apiKey,
|
|
206
|
-
},
|
|
207
|
-
})).data.voucher;
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
updatePromoCodeStatus(promoCodeId, status) {
|
|
211
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
-
return (yield (0, axios_1.default)({
|
|
213
|
-
method: 'put',
|
|
214
|
-
url: `${this.voucherBaseUrl}/vouchers/${promoCodeId}/status`,
|
|
215
|
-
data: { status },
|
|
216
|
-
headers: {
|
|
217
|
-
'X-API-Key': this.apiKey,
|
|
218
|
-
'content-type': 'application/json',
|
|
219
|
-
},
|
|
220
|
-
})).data.message;
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
deletePromoCode(promoCodeId) {
|
|
224
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
-
return (yield (0, axios_1.default)({
|
|
226
|
-
method: 'delete',
|
|
227
|
-
url: `${this.voucherBaseUrl}/vouchers/${promoCodeId}`,
|
|
228
|
-
headers: {
|
|
229
|
-
'X-API-Key': this.apiKey,
|
|
230
|
-
},
|
|
231
|
-
})).data.message;
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
// VOUCHERS ENDS HERE
|
|
235
186
|
getEsimplyPackages(options) {
|
|
236
187
|
return __awaiter(this, void 0, void 0, function* () {
|
|
237
188
|
return (yield (0, axios_1.default)({
|
package/dist/libs/migration.js
CHANGED
|
@@ -44,37 +44,14 @@ const runMigrations = (sequelize) => __awaiter(void 0, void 0, void 0, function*
|
|
|
44
44
|
console.error(`Migrations directory not found at: ${migrationsPath}`);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
// Ensure SequelizeMeta table exists - this handles cases where sync() didn't create it
|
|
48
|
-
try {
|
|
49
|
-
yield sequelize.query(`
|
|
50
|
-
CREATE TABLE IF NOT EXISTS "SequelizeMeta" (
|
|
51
|
-
"name" VARCHAR(255) NOT NULL,
|
|
52
|
-
PRIMARY KEY ("name")
|
|
53
|
-
);
|
|
54
|
-
`);
|
|
55
|
-
console.log('SequelizeMeta table ensured to exist');
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
console.error('Error creating SequelizeMeta table:', error);
|
|
59
|
-
throw error;
|
|
60
|
-
}
|
|
61
47
|
// Read and sort migration files
|
|
62
48
|
const migrationFiles = fs_1.default
|
|
63
49
|
.readdirSync(migrationsPath)
|
|
64
50
|
.filter((file) => file.match(/^\d{3}-.+\.ts$/) || file.match(/^\d{3}-.+\.js$/)) // Matches .ts and .js files
|
|
65
51
|
.filter((file) => !file.endsWith('.d.ts')) // Exclude .d.ts files
|
|
66
52
|
.sort(); // Sort files by name
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
const [results] = yield sequelize.query('SELECT name FROM "SequelizeMeta"');
|
|
71
|
-
executedMigrations = results.map((row) => row.name);
|
|
72
|
-
console.log(`Found ${executedMigrations.length} previously executed migrations`);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
console.error('Unexpected error fetching executed migrations:', error);
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
53
|
+
const [results] = yield sequelize.query('SELECT name FROM "SequelizeMeta"');
|
|
54
|
+
const executedMigrations = results.map((row) => row.name);
|
|
78
55
|
for (const file of migrationFiles) {
|
|
79
56
|
if (!executedMigrations.includes(file)) {
|
|
80
57
|
const migration = yield Promise.resolve(`${path_1.default.join(migrationsPath, file)}`).then(s => __importStar(require(s)));
|
|
@@ -82,11 +59,10 @@ const runMigrations = (sequelize) => __awaiter(void 0, void 0, void 0, function*
|
|
|
82
59
|
console.log(`Running migration: ${file}`);
|
|
83
60
|
yield migration.up(sequelize.getQueryInterface());
|
|
84
61
|
yield sequelize.query(`INSERT INTO "SequelizeMeta" (name) VALUES ('${file}')`);
|
|
85
|
-
console.log(`Completed migration: ${file}`);
|
|
86
62
|
}
|
|
87
63
|
}
|
|
88
64
|
else {
|
|
89
|
-
console.log(`Skipping migration: ${file}
|
|
65
|
+
console.log(`Skipping migration: ${file}`);
|
|
90
66
|
}
|
|
91
67
|
}
|
|
92
68
|
console.log('Migrations completed.');
|
package/dist/models/Booking.d.ts
CHANGED
|
@@ -19,12 +19,6 @@ export declare class Booking extends Model<Partial<Booking>> {
|
|
|
19
19
|
guestId?: string;
|
|
20
20
|
guest?: Guest;
|
|
21
21
|
otp?: string;
|
|
22
|
-
otpExpiresAt?: Date;
|
|
23
22
|
cancellationType?: string;
|
|
24
23
|
lastCancellationDate?: Date;
|
|
25
|
-
paymentMethod?: string;
|
|
26
|
-
refundStatus?: string;
|
|
27
|
-
source?: string;
|
|
28
|
-
variant?: string;
|
|
29
|
-
paymentProvider?: string;
|
|
30
24
|
}
|
package/dist/models/Booking.js
CHANGED
|
@@ -140,13 +140,6 @@ __decorate([
|
|
|
140
140
|
}),
|
|
141
141
|
__metadata("design:type", String)
|
|
142
142
|
], Booking.prototype, "otp", void 0);
|
|
143
|
-
__decorate([
|
|
144
|
-
(0, sequelize_typescript_1.Column)({
|
|
145
|
-
type: sequelize_typescript_1.DataType.DATE,
|
|
146
|
-
allowNull: true,
|
|
147
|
-
}),
|
|
148
|
-
__metadata("design:type", Date)
|
|
149
|
-
], Booking.prototype, "otpExpiresAt", void 0);
|
|
150
143
|
__decorate([
|
|
151
144
|
sequelize_typescript_1.Index,
|
|
152
145
|
(0, sequelize_typescript_1.Column)({
|
|
@@ -162,41 +155,6 @@ __decorate([
|
|
|
162
155
|
}),
|
|
163
156
|
__metadata("design:type", Date)
|
|
164
157
|
], Booking.prototype, "lastCancellationDate", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
(0, sequelize_typescript_1.Column)({
|
|
167
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
168
|
-
allowNull: true,
|
|
169
|
-
}),
|
|
170
|
-
__metadata("design:type", String)
|
|
171
|
-
], Booking.prototype, "paymentMethod", void 0);
|
|
172
|
-
__decorate([
|
|
173
|
-
(0, sequelize_typescript_1.Column)({
|
|
174
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
175
|
-
allowNull: true,
|
|
176
|
-
}),
|
|
177
|
-
__metadata("design:type", String)
|
|
178
|
-
], Booking.prototype, "refundStatus", void 0);
|
|
179
|
-
__decorate([
|
|
180
|
-
(0, sequelize_typescript_1.Column)({
|
|
181
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
182
|
-
allowNull: true,
|
|
183
|
-
}),
|
|
184
|
-
__metadata("design:type", String)
|
|
185
|
-
], Booking.prototype, "source", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
(0, sequelize_typescript_1.Column)({
|
|
188
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
189
|
-
allowNull: true,
|
|
190
|
-
}),
|
|
191
|
-
__metadata("design:type", String)
|
|
192
|
-
], Booking.prototype, "variant", void 0);
|
|
193
|
-
__decorate([
|
|
194
|
-
(0, sequelize_typescript_1.Column)({
|
|
195
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
196
|
-
allowNull: true,
|
|
197
|
-
}),
|
|
198
|
-
__metadata("design:type", String)
|
|
199
|
-
], Booking.prototype, "paymentProvider", void 0);
|
|
200
158
|
exports.Booking = Booking = __decorate([
|
|
201
159
|
(0, sequelize_typescript_1.Table)({
|
|
202
160
|
tableName: 'bookings',
|
package/dist/models/Guest.d.ts
CHANGED
|
@@ -14,9 +14,6 @@ export declare class Guest extends Model<Partial<Guest>> {
|
|
|
14
14
|
isVerified: boolean;
|
|
15
15
|
isAgent: boolean;
|
|
16
16
|
bypassPayment: boolean;
|
|
17
|
-
isAnonymous: boolean;
|
|
18
|
-
sessionToken: string;
|
|
19
|
-
lastSeen: Date;
|
|
20
17
|
vouchers: number[];
|
|
21
18
|
favoriteHotelIds: string[];
|
|
22
19
|
feedbackCount: number;
|
|
@@ -25,13 +22,4 @@ export declare class Guest extends Model<Partial<Guest>> {
|
|
|
25
22
|
bookings?: Booking[];
|
|
26
23
|
static checkEmail(email: string, projectId: string): Promise<void>;
|
|
27
24
|
generateSession(secret: string): string;
|
|
28
|
-
static createAnonymous(projectId: string, sessionToken: string): Promise<Guest>;
|
|
29
|
-
static findBySessionToken(sessionToken: string, projectId: string): Promise<Guest | null>;
|
|
30
|
-
convertToRegistered(userData: {
|
|
31
|
-
firstName: string;
|
|
32
|
-
lastName: string;
|
|
33
|
-
email: string;
|
|
34
|
-
password?: string;
|
|
35
|
-
}): Promise<this>;
|
|
36
|
-
updateLastSeen(): Promise<this>;
|
|
37
25
|
}
|
package/dist/models/Guest.js
CHANGED
|
@@ -24,15 +24,12 @@ var Guest_1;
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.Guest = void 0;
|
|
26
26
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
27
|
-
const sequelize_1 = require("sequelize");
|
|
28
27
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
29
28
|
const Project_1 = require("./Project");
|
|
30
29
|
const Booking_1 = require("./Booking");
|
|
31
30
|
let Guest = Guest_1 = class Guest extends sequelize_typescript_1.Model {
|
|
32
31
|
static checkEmail(email, projectId) {
|
|
33
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
if (!email)
|
|
35
|
-
return; // Handle null emails for anonymous users
|
|
36
33
|
if (yield Guest_1.findOne({ where: { email: email.toLowerCase(), projectId } })) {
|
|
37
34
|
throw new Error('This email is already registered to another account.');
|
|
38
35
|
}
|
|
@@ -44,47 +41,6 @@ let Guest = Guest_1 = class Guest extends sequelize_typescript_1.Model {
|
|
|
44
41
|
expiresIn: 1209600, // 14 days
|
|
45
42
|
});
|
|
46
43
|
}
|
|
47
|
-
// New method to create anonymous guest
|
|
48
|
-
static createAnonymous(projectId, sessionToken) {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
return yield Guest_1.create({
|
|
51
|
-
projectId,
|
|
52
|
-
isAnonymous: true,
|
|
53
|
-
sessionToken,
|
|
54
|
-
lastSeen: new Date(),
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
// New method to find guest by session token
|
|
59
|
-
static findBySessionToken(sessionToken, projectId) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return yield Guest_1.findOne({
|
|
62
|
-
where: { sessionToken, projectId },
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
// New method to convert anonymous to registered
|
|
67
|
-
convertToRegistered(userData) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
this.firstName = userData.firstName;
|
|
70
|
-
this.lastName = userData.lastName;
|
|
71
|
-
this.email = userData.email.toLowerCase();
|
|
72
|
-
if (userData.password) {
|
|
73
|
-
this.password = userData.password;
|
|
74
|
-
}
|
|
75
|
-
this.isAnonymous = false;
|
|
76
|
-
this.isVerified = false; // Will be verified through email verification process
|
|
77
|
-
this.lastSeen = new Date();
|
|
78
|
-
return yield this.save();
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
// New method to update last seen
|
|
82
|
-
updateLastSeen() {
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
this.lastSeen = new Date();
|
|
85
|
-
return yield this.save();
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
44
|
};
|
|
89
45
|
exports.Guest = Guest;
|
|
90
46
|
__decorate([
|
|
@@ -99,14 +55,14 @@ __decorate([
|
|
|
99
55
|
__decorate([
|
|
100
56
|
(0, sequelize_typescript_1.Column)({
|
|
101
57
|
type: sequelize_typescript_1.DataType.STRING,
|
|
102
|
-
allowNull:
|
|
58
|
+
allowNull: false,
|
|
103
59
|
}),
|
|
104
60
|
__metadata("design:type", String)
|
|
105
61
|
], Guest.prototype, "firstName", void 0);
|
|
106
62
|
__decorate([
|
|
107
63
|
(0, sequelize_typescript_1.Column)({
|
|
108
64
|
type: sequelize_typescript_1.DataType.STRING,
|
|
109
|
-
allowNull:
|
|
65
|
+
allowNull: false,
|
|
110
66
|
}),
|
|
111
67
|
__metadata("design:type", String)
|
|
112
68
|
], Guest.prototype, "lastName", void 0);
|
|
@@ -114,7 +70,7 @@ __decorate([
|
|
|
114
70
|
sequelize_typescript_1.Index,
|
|
115
71
|
(0, sequelize_typescript_1.Column)({
|
|
116
72
|
type: sequelize_typescript_1.DataType.STRING,
|
|
117
|
-
allowNull:
|
|
73
|
+
allowNull: false,
|
|
118
74
|
}),
|
|
119
75
|
__metadata("design:type", String)
|
|
120
76
|
], Guest.prototype, "email", void 0);
|
|
@@ -175,28 +131,6 @@ __decorate([
|
|
|
175
131
|
}),
|
|
176
132
|
__metadata("design:type", Boolean)
|
|
177
133
|
], Guest.prototype, "bypassPayment", void 0);
|
|
178
|
-
__decorate([
|
|
179
|
-
(0, sequelize_typescript_1.Column)({
|
|
180
|
-
type: sequelize_typescript_1.DataType.BOOLEAN,
|
|
181
|
-
defaultValue: false, // Default to anonymous
|
|
182
|
-
}),
|
|
183
|
-
__metadata("design:type", Boolean)
|
|
184
|
-
], Guest.prototype, "isAnonymous", void 0);
|
|
185
|
-
__decorate([
|
|
186
|
-
sequelize_typescript_1.Index,
|
|
187
|
-
(0, sequelize_typescript_1.Column)({
|
|
188
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
189
|
-
allowNull: true,
|
|
190
|
-
}),
|
|
191
|
-
__metadata("design:type", String)
|
|
192
|
-
], Guest.prototype, "sessionToken", void 0);
|
|
193
|
-
__decorate([
|
|
194
|
-
(0, sequelize_typescript_1.Column)({
|
|
195
|
-
type: sequelize_typescript_1.DataType.DATE,
|
|
196
|
-
defaultValue: sequelize_typescript_1.DataType.NOW,
|
|
197
|
-
}),
|
|
198
|
-
__metadata("design:type", Date)
|
|
199
|
-
], Guest.prototype, "lastSeen", void 0);
|
|
200
134
|
__decorate([
|
|
201
135
|
(0, sequelize_typescript_1.Column)({
|
|
202
136
|
type: sequelize_typescript_1.DataType.ARRAY(sequelize_typescript_1.DataType.JSONB),
|
|
@@ -246,11 +180,6 @@ exports.Guest = Guest = Guest_1 = __decorate([
|
|
|
246
180
|
{
|
|
247
181
|
unique: true,
|
|
248
182
|
fields: ['email', 'projectId'],
|
|
249
|
-
where: {
|
|
250
|
-
email: {
|
|
251
|
-
[sequelize_1.Op.ne]: null,
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
183
|
},
|
|
255
184
|
],
|
|
256
185
|
})
|
package/dist/models/Hotel.d.ts
CHANGED
|
@@ -2,9 +2,6 @@ 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';
|
|
8
5
|
export type HotelImage = {
|
|
9
6
|
url: string;
|
|
10
7
|
thumbnailUrl: string;
|
|
@@ -90,7 +87,6 @@ export declare class Hotel extends Model<Partial<Hotel>> {
|
|
|
90
87
|
stars: number;
|
|
91
88
|
mapped: boolean;
|
|
92
89
|
thirdPartyId: number;
|
|
93
|
-
placeId?: string;
|
|
94
90
|
checkinCheckoutTimes: CheckinCheckoutTimes;
|
|
95
91
|
hotelImages: HotelImage[];
|
|
96
92
|
hotelFacilities: string[];
|
|
@@ -110,9 +106,6 @@ export declare class Hotel extends Model<Partial<Hotel>> {
|
|
|
110
106
|
video?: string;
|
|
111
107
|
accessibility: HotelAccessibility;
|
|
112
108
|
translations: HotelTranslation[];
|
|
113
|
-
hotelFacilityRelations: HotelFacility[];
|
|
114
|
-
normalizedFacilities: FacilityModel[];
|
|
115
|
-
roomAmenities: RoomAmenityModel[];
|
|
116
109
|
static includeTranslations(options: any, language?: string): any;
|
|
117
110
|
static applyTranslations(hotel: Hotel): Hotel;
|
|
118
111
|
static findOneWithTranslation(options: any, language?: string): Promise<Hotel>;
|
package/dist/models/Hotel.js
CHANGED
|
@@ -22,9 +22,6 @@ 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");
|
|
28
25
|
let Hotel = class Hotel extends sequelize_typescript_1.Model {
|
|
29
26
|
// Include translations in the options
|
|
30
27
|
static includeTranslations(options, language) {
|
|
@@ -320,14 +317,6 @@ __decorate([
|
|
|
320
317
|
}),
|
|
321
318
|
__metadata("design:type", Number)
|
|
322
319
|
], Hotel.prototype, "thirdPartyId", void 0);
|
|
323
|
-
__decorate([
|
|
324
|
-
(0, sequelize_typescript_1.Column)({
|
|
325
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
326
|
-
allowNull: true,
|
|
327
|
-
comment: 'Google Place ID for the hotel',
|
|
328
|
-
}),
|
|
329
|
-
__metadata("design:type", String)
|
|
330
|
-
], Hotel.prototype, "placeId", void 0);
|
|
331
320
|
__decorate([
|
|
332
321
|
(0, sequelize_typescript_1.Column)({
|
|
333
322
|
type: sequelize_typescript_1.DataType.JSONB,
|
|
@@ -452,18 +441,6 @@ __decorate([
|
|
|
452
441
|
(0, sequelize_typescript_1.HasMany)(() => HotelTranslation_1.HotelTranslation),
|
|
453
442
|
__metadata("design:type", Array)
|
|
454
443
|
], 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);
|
|
467
444
|
exports.Hotel = Hotel = __decorate([
|
|
468
445
|
(0, sequelize_typescript_1.Table)({
|
|
469
446
|
tableName: 'static_hotels',
|
package/dist/models/Project.d.ts
CHANGED
|
@@ -3,24 +3,17 @@ import { Agency } from './Agency';
|
|
|
3
3
|
import { LiteApiClient } from '../libs/liteapi';
|
|
4
4
|
import { LiteApiClientV3 } from '../libs/liteapiv3';
|
|
5
5
|
import { Booking } from './Booking';
|
|
6
|
-
import { Creator } from './Creator';
|
|
7
|
-
import { Collection } from './Collection';
|
|
8
6
|
export declare class Project extends Model<Partial<Project>> {
|
|
9
7
|
id: string;
|
|
10
8
|
name: string;
|
|
11
9
|
templateName: string;
|
|
12
10
|
domain?: string;
|
|
13
11
|
settings?: object;
|
|
14
|
-
marketSegments?: object[];
|
|
15
|
-
seo?: object;
|
|
16
12
|
agencyId?: string;
|
|
17
13
|
agency?: Agency;
|
|
18
14
|
bookings?: Booking[];
|
|
19
|
-
creators?: Creator[];
|
|
20
|
-
collections?: Collection[];
|
|
21
15
|
preferences?: object;
|
|
22
16
|
appearance?: object;
|
|
23
|
-
isActive?: boolean;
|
|
24
17
|
generateSession(secret: string): string;
|
|
25
18
|
getLiteApiClient(): LiteApiClient;
|
|
26
19
|
getLiteApiClientV3(): LiteApiClientV3;
|