whitelabel-db 1.1.94 → 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.
Files changed (65) hide show
  1. package/dist/index.d.ts +1 -12
  2. package/dist/index.js +1 -27
  3. package/dist/libs/database.d.ts +1 -1
  4. package/dist/libs/database.js +7 -32
  5. package/dist/libs/liteapiv3.d.ts +5 -17
  6. package/dist/libs/liteapiv3.js +3 -52
  7. package/dist/libs/migration.js +3 -27
  8. package/dist/models/Booking.d.ts +0 -6
  9. package/dist/models/Booking.js +0 -42
  10. package/dist/models/Hotel.d.ts +0 -7
  11. package/dist/models/Hotel.js +0 -23
  12. package/dist/models/Project.d.ts +0 -7
  13. package/dist/models/Project.js +0 -33
  14. package/dist/models/Search.d.ts +8 -0
  15. package/dist/models/{Facility.js → Search.js} +33 -24
  16. package/dist/models/User.d.ts +0 -3
  17. package/dist/models/User.js +0 -21
  18. package/package.json +1 -1
  19. package/dist/migrations/010-add-user-resetToken.d.ts +0 -3
  20. package/dist/migrations/010-add-user-resetToken.js +0 -44
  21. package/dist/migrations/011-add-project-resceotToke.d.ts +0 -3
  22. package/dist/migrations/011-add-project-resceotToke.js +0 -40
  23. package/dist/migrations/012-add-otp-expire.d.ts +0 -3
  24. package/dist/migrations/012-add-otp-expire.js +0 -44
  25. package/dist/migrations/013-add-bookings-payment.d.ts +0 -3
  26. package/dist/migrations/013-add-bookings-payment.js +0 -48
  27. package/dist/migrations/014-add-hotel-placeid.d.ts +0 -3
  28. package/dist/migrations/014-add-hotel-placeid.js +0 -29
  29. package/dist/migrations/015-create-facilities-tables.d.ts +0 -3
  30. package/dist/migrations/015-create-facilities-tables.js +0 -119
  31. package/dist/migrations/016-create-amenities-tables.d.ts +0 -3
  32. package/dist/migrations/016-create-amenities-tables.js +0 -119
  33. package/dist/migrations/017-add-upsert-indexes-amenities-facilities.d.ts +0 -3
  34. package/dist/migrations/017-add-upsert-indexes-amenities-facilities.js +0 -56
  35. package/dist/migrations/018-link-room-amenities-to-hotels.d.ts +0 -3
  36. package/dist/migrations/018-link-room-amenities-to-hotels.js +0 -47
  37. package/dist/migrations/019-add-marketsegment-project.d.ts +0 -3
  38. package/dist/migrations/019-add-marketsegment-project.js +0 -31
  39. package/dist/migrations/020-booking-source.d.ts +0 -3
  40. package/dist/migrations/020-booking-source.js +0 -47
  41. package/dist/migrations/021-add-analytics-indexes.d.ts +0 -3
  42. package/dist/migrations/021-add-analytics-indexes.js +0 -91
  43. package/dist/migrations/022-add-project-isactive.d.ts +0 -3
  44. package/dist/migrations/022-add-project-isactive.js +0 -40
  45. package/dist/models/Amenity.d.ts +0 -9
  46. package/dist/models/Amenity.js +0 -47
  47. package/dist/models/AmenityTranslation.d.ts +0 -8
  48. package/dist/models/AmenityTranslation.js +0 -52
  49. package/dist/models/AnalyticsSummary.d.ts +0 -13
  50. package/dist/models/AnalyticsSummary.js +0 -122
  51. package/dist/models/Collection.d.ts +0 -19
  52. package/dist/models/Collection.js +0 -90
  53. package/dist/models/CollectionItem.d.ts +0 -18
  54. package/dist/models/CollectionItem.js +0 -84
  55. package/dist/models/CollectionItemCustomField.d.ts +0 -10
  56. package/dist/models/CollectionItemCustomField.js +0 -67
  57. package/dist/models/Creator.d.ts +0 -12
  58. package/dist/models/Creator.js +0 -82
  59. package/dist/models/Facility.d.ts +0 -11
  60. package/dist/models/FacilityTranslation.d.ts +0 -8
  61. package/dist/models/FacilityTranslation.js +0 -52
  62. package/dist/models/HotelFacility.d.ts +0 -9
  63. package/dist/models/HotelFacility.js +0 -49
  64. package/dist/models/RoomAmenity.d.ts +0 -11
  65. 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, PromoCodeRequest, PromoCodeResponse, EsimplyPackage, Addon, AddonResponse, } from './libs/liteapiv3';
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.CollectionItemCustomField = exports.CollectionType = exports.CollectionItem = exports.CollectionStatus = exports.Collection = exports.Creator = exports.AmenityTranslation = exports.RoomAmenity = exports.Amenity = exports.FacilityTranslation = exports.HotelFacility = exports.Facility = exports.AnalyticsSummary = 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.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");
@@ -5,4 +5,4 @@ export interface ConnectionDetails {
5
5
  password: string;
6
6
  dbname: string;
7
7
  }
8
- export declare const connect: (connectionDetails: ConnectionDetails) => Promise<Sequelize>;
8
+ export declare const connect: (connectionDetails: ConnectionDetails) => Promise<void | Sequelize>;
@@ -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
- try {
76
- yield connection.authenticate();
53
+ return connection
54
+ .authenticate()
55
+ .then(() => {
77
56
  console.log('Database connection has been established successfully.');
78
- // Ensure sync completes and creates necessary tables including SequelizeMeta
79
- yield connection.sync({ alter: false });
80
- console.log('Database sync completed successfully.');
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
- throw err;
86
- }
61
+ });
87
62
  });
88
63
  exports.connect = connect;
@@ -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 PromoCodeResponse {
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 PromoCodeRequest {
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
- createPromoCode(data: PromoCodeRequest): Promise<PromoCodeResponse>;
388
- getPromoCodes(): Promise<PromoCodeResponse[]>;
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<PromoCodeResponse>;
392
+ }): Promise<VoucherResponse>;
405
393
  }
@@ -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?includeCreditBalance=true`,
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
- // VOUCHERS STARTS HERE
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
- getPromoCodes() {
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)({
@@ -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
- // Get executed migrations - now this should always work since we ensured the table exists
68
- let executedMigrations = [];
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} (already executed)`);
65
+ console.log(`Skipping migration: ${file}`);
90
66
  }
91
67
  }
92
68
  console.log('Migrations completed.');
@@ -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
  }
@@ -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',
@@ -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>;
@@ -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',
@@ -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;
@@ -19,8 +19,6 @@ const Agency_1 = require("./Agency");
19
19
  const liteapi_1 = require("../libs/liteapi");
20
20
  const liteapiv3_1 = require("../libs/liteapiv3");
21
21
  const Booking_1 = require("./Booking");
22
- const Creator_1 = require("./Creator");
23
- const Collection_1 = require("./Collection");
24
22
  const clients = {};
25
23
  const clientV3 = {};
26
24
  const defaultLiteApiEnvironment = process.env.COPILOT_ENVIRONMENT_NAME === 'production' ? 'production' : 'dev';
@@ -107,22 +105,6 @@ __decorate([
107
105
  }),
108
106
  __metadata("design:type", Object)
109
107
  ], Project.prototype, "settings", void 0);
110
- __decorate([
111
- (0, sequelize_typescript_1.Column)({
112
- type: sequelize_typescript_1.DataType.ARRAY(sequelize_typescript_1.DataType.JSONB),
113
- allowNull: false,
114
- defaultValue: [],
115
- }),
116
- __metadata("design:type", Array)
117
- ], Project.prototype, "marketSegments", void 0);
118
- __decorate([
119
- (0, sequelize_typescript_1.Column)({
120
- type: sequelize_typescript_1.DataType.JSONB,
121
- allowNull: false,
122
- defaultValue: {},
123
- }),
124
- __metadata("design:type", Object)
125
- ], Project.prototype, "seo", void 0);
126
108
  __decorate([
127
109
  (0, sequelize_typescript_1.ForeignKey)(() => Agency_1.Agency),
128
110
  sequelize_typescript_1.Index,
@@ -139,14 +121,6 @@ __decorate([
139
121
  (0, sequelize_typescript_1.HasMany)(() => Booking_1.Booking),
140
122
  __metadata("design:type", Array)
141
123
  ], Project.prototype, "bookings", void 0);
142
- __decorate([
143
- (0, sequelize_typescript_1.HasMany)(() => Creator_1.Creator),
144
- __metadata("design:type", Array)
145
- ], Project.prototype, "creators", void 0);
146
- __decorate([
147
- (0, sequelize_typescript_1.HasMany)(() => Collection_1.Collection),
148
- __metadata("design:type", Array)
149
- ], Project.prototype, "collections", void 0);
150
124
  __decorate([
151
125
  (0, sequelize_typescript_1.Column)({
152
126
  type: sequelize_typescript_1.DataType.JSONB,
@@ -163,13 +137,6 @@ __decorate([
163
137
  }),
164
138
  __metadata("design:type", Object)
165
139
  ], Project.prototype, "appearance", void 0);
166
- __decorate([
167
- (0, sequelize_typescript_1.Column)({
168
- type: sequelize_typescript_1.DataType.BOOLEAN,
169
- defaultValue: true,
170
- }),
171
- __metadata("design:type", Boolean)
172
- ], Project.prototype, "isActive", void 0);
173
140
  exports.Project = Project = __decorate([
174
141
  (0, sequelize_typescript_1.Table)({
175
142
  tableName: 'projects',
@@ -0,0 +1,8 @@
1
+ import { Model } from 'sequelize-typescript';
2
+ export declare class Search extends Model<Partial<Search>> {
3
+ id: string;
4
+ hits: number;
5
+ cacheUpdatedAt?: Date;
6
+ cacheQueuedAt?: Date;
7
+ data?: object;
8
+ }
@@ -9,44 +9,53 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Facility = void 0;
12
+ exports.Search = void 0;
13
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 {
14
+ let Search = class Search extends sequelize_typescript_1.Model {
18
15
  };
19
- exports.Facility = Facility;
16
+ exports.Search = Search;
20
17
  __decorate([
21
18
  sequelize_typescript_1.PrimaryKey,
19
+ sequelize_typescript_1.Index,
20
+ (0, sequelize_typescript_1.Column)({
21
+ type: sequelize_typescript_1.DataType.STRING(32),
22
+ }),
23
+ __metadata("design:type", String)
24
+ ], Search.prototype, "id", void 0);
25
+ __decorate([
22
26
  (0, sequelize_typescript_1.Column)({
23
27
  type: sequelize_typescript_1.DataType.INTEGER,
24
28
  allowNull: false,
29
+ defaultValue: 0,
25
30
  }),
26
31
  __metadata("design:type", Number)
27
- ], Facility.prototype, "id", void 0);
32
+ ], Search.prototype, "hits", void 0);
28
33
  __decorate([
29
34
  sequelize_typescript_1.Unique,
35
+ sequelize_typescript_1.Index,
30
36
  (0, sequelize_typescript_1.Column)({
31
- type: sequelize_typescript_1.DataType.TEXT,
32
- allowNull: false,
37
+ type: sequelize_typescript_1.DataType.DATE,
33
38
  }),
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);
39
+ __metadata("design:type", Date)
40
+ ], Search.prototype, "cacheUpdatedAt", void 0);
40
41
  __decorate([
41
- (0, sequelize_typescript_1.HasMany)(() => FacilityTranslation_1.FacilityTranslation),
42
- __metadata("design:type", Array)
43
- ], Facility.prototype, "translations", void 0);
42
+ sequelize_typescript_1.Unique,
43
+ sequelize_typescript_1.Index,
44
+ (0, sequelize_typescript_1.Column)({
45
+ type: sequelize_typescript_1.DataType.DATE,
46
+ }),
47
+ __metadata("design:type", Date)
48
+ ], Search.prototype, "cacheQueuedAt", void 0);
44
49
  __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([
50
+ (0, sequelize_typescript_1.Column)({
51
+ type: sequelize_typescript_1.DataType.JSONB,
52
+ allowNull: false,
53
+ defaultValue: {},
54
+ }),
55
+ __metadata("design:type", Object)
56
+ ], Search.prototype, "data", void 0);
57
+ exports.Search = Search = __decorate([
49
58
  (0, sequelize_typescript_1.Table)({
50
- tableName: 'facilities',
59
+ tableName: 'searches',
51
60
  })
52
- ], Facility);
61
+ ], Search);
@@ -12,11 +12,8 @@ export declare class User extends Model<Partial<User>> {
12
12
  agency?: Agency;
13
13
  roleId?: number;
14
14
  otp?: string;
15
- otpExpiresAt?: Date;
16
15
  role?: Role;
17
16
  isVerified: boolean;
18
- passwordResetToken?: string;
19
- passwordResetTokenExpiresAt?: Date;
20
17
  static checkEmail(email: string): Promise<void>;
21
18
  generateSession(secret: string): string;
22
19
  }