whitelabel-db 1.1.79 → 1.1.81

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 CHANGED
@@ -15,5 +15,5 @@ export { Referral } from './models/Referral';
15
15
  export { Feedback } from './models/Feedback';
16
16
  export { HotelRate } from './models/HotelRate';
17
17
  export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
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';
18
+ 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
19
  export { LiteApiUser, LiteApiUserRequest } from './libs/liteapiuser';
@@ -318,7 +318,7 @@ export interface GuestBookingV3 {
318
318
  updatedAt: string;
319
319
  deletedAt: string;
320
320
  }
321
- export interface VoucherResponse {
321
+ export interface PromoCodeResponse {
322
322
  id: number;
323
323
  voucher_code: string;
324
324
  discount_type: string;
@@ -337,7 +337,7 @@ export interface VoucherResponse {
337
337
  terms_and_conditions: string | null;
338
338
  category?: string;
339
339
  }
340
- export interface VoucherRequest {
340
+ export interface PromoCodeRequest {
341
341
  voucher_code: string;
342
342
  discount_type: string;
343
343
  discount_value: number;
@@ -380,8 +380,12 @@ export declare class LiteApiClientV3 {
380
380
  getGuests(): Promise<GuestV3[]>;
381
381
  getGuest(guestId: number): Promise<GuestV3>;
382
382
  getGuestBookings(guestId: number): Promise<GuestBookingV3[]>;
383
- createVoucher(data: VoucherRequest): Promise<VoucherResponse>;
384
- getVouchers(): Promise<VoucherResponse[]>;
383
+ createPromoCode(data: PromoCodeRequest): Promise<PromoCodeResponse>;
384
+ getPromoCodes(): Promise<PromoCodeResponse[]>;
385
+ updatePromoCode(data: PromoCodeRequest, promoCodeId: number): Promise<string>;
386
+ getPromoCode(promoCodeId: number): Promise<PromoCodeResponse>;
387
+ updatePromoCodeStatus(promoCodeId: number, status: 'active' | 'inactive'): Promise<string>;
388
+ deletePromoCode(promoCodeId: number): Promise<string>;
385
389
  getEsimplyPackages(options: {
386
390
  countryCode: string;
387
391
  }): Promise<EsimplyPackage[]>;
@@ -393,5 +397,5 @@ export declare class LiteApiClientV3 {
393
397
  points: number;
394
398
  currency: string;
395
399
  guestId: number;
396
- }): Promise<VoucherResponse>;
400
+ }): Promise<PromoCodeResponse>;
397
401
  }
@@ -160,7 +160,8 @@ class LiteApiClientV3 {
160
160
  })).data.data;
161
161
  });
162
162
  }
163
- createVoucher(data) {
163
+ // VOUCHERS STARTS HERE
164
+ createPromoCode(data) {
164
165
  return __awaiter(this, void 0, void 0, function* () {
165
166
  return (yield (0, axios_1.default)({
166
167
  method: 'post',
@@ -173,7 +174,7 @@ class LiteApiClientV3 {
173
174
  })).data.voucher;
174
175
  });
175
176
  }
176
- getVouchers() {
177
+ getPromoCodes() {
177
178
  return __awaiter(this, void 0, void 0, function* () {
178
179
  return (yield (0, axios_1.default)({
179
180
  url: `${this.voucherBaseUrl}/vouchers`,
@@ -183,6 +184,54 @@ class LiteApiClientV3 {
183
184
  })).data.vouchers;
184
185
  });
185
186
  }
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
186
235
  getEsimplyPackages(options) {
187
236
  return __awaiter(this, void 0, void 0, function* () {
188
237
  return (yield (0, axios_1.default)({
@@ -0,0 +1,3 @@
1
+ import { QueryInterface } from 'sequelize';
2
+ export declare const up: (queryInterface: QueryInterface) => Promise<void>;
3
+ export declare const down: (queryInterface: QueryInterface) => Promise<void>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.down = exports.up = void 0;
13
+ // Purpose: Add video column to static_hotels table.
14
+ const sequelize_1 = require("sequelize");
15
+ const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
16
+ try {
17
+ // Add all columns in parallel
18
+ yield queryInterface.addColumn('users', 'otpExpiresAt', {
19
+ type: sequelize_1.DataTypes.DATE,
20
+ allowNull: true,
21
+ });
22
+ yield queryInterface.addColumn('bookings', 'otpExpiresAt', {
23
+ type: sequelize_1.DataTypes.DATE,
24
+ allowNull: true,
25
+ });
26
+ console.log('column added successfully.');
27
+ }
28
+ catch (error) {
29
+ console.error('Error while adding columns:', error.message);
30
+ }
31
+ });
32
+ exports.up = up;
33
+ const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
34
+ try {
35
+ // Remove columns
36
+ yield queryInterface.removeColumn('users', 'otpExpiresAt');
37
+ yield queryInterface.removeColumn('bookings', 'otpExpiresAt');
38
+ console.log('column removed successfully.');
39
+ }
40
+ catch (error) {
41
+ console.error('Error while removing columns:', error.message);
42
+ }
43
+ });
44
+ exports.down = down;
@@ -19,6 +19,7 @@ export declare class Booking extends Model<Partial<Booking>> {
19
19
  guestId?: string;
20
20
  guest?: Guest;
21
21
  otp?: string;
22
+ otpExpiresAt?: Date;
22
23
  cancellationType?: string;
23
24
  lastCancellationDate?: Date;
24
25
  }
@@ -140,6 +140,13 @@ __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);
143
150
  __decorate([
144
151
  sequelize_typescript_1.Index,
145
152
  (0, sequelize_typescript_1.Column)({
@@ -12,6 +12,7 @@ export declare class User extends Model<Partial<User>> {
12
12
  agency?: Agency;
13
13
  roleId?: number;
14
14
  otp?: string;
15
+ otpExpiresAt?: Date;
15
16
  role?: Role;
16
17
  isVerified: boolean;
17
18
  passwordResetToken?: string;
@@ -117,6 +117,13 @@ __decorate([
117
117
  }),
118
118
  __metadata("design:type", String)
119
119
  ], User.prototype, "otp", void 0);
120
+ __decorate([
121
+ (0, sequelize_typescript_1.Column)({
122
+ type: sequelize_typescript_1.DataType.DATE,
123
+ allowNull: true,
124
+ }),
125
+ __metadata("design:type", Date)
126
+ ], User.prototype, "otpExpiresAt", void 0);
120
127
  __decorate([
121
128
  (0, sequelize_typescript_1.BelongsTo)(() => Role_1.Role),
122
129
  __metadata("design:type", Role_1.Role)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.1.79",
3
+ "version": "1.1.81",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",