whitelabel-db 1.1.21 → 1.1.23

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.
@@ -156,6 +156,19 @@ export interface BookingInfo {
156
156
  amount: number;
157
157
  type: string;
158
158
  };
159
+ formattedCancellationPolicies?: {
160
+ policies: {
161
+ message: string;
162
+ highlight: boolean;
163
+ cancelTimeFrame: {
164
+ start: string;
165
+ end: string;
166
+ amount: number;
167
+ type?: string;
168
+ };
169
+ }[];
170
+ hasFreeCancellation: boolean;
171
+ };
159
172
  }
160
173
  export interface BookingConfirmation {
161
174
  prebookId: string;
@@ -174,6 +174,8 @@ export interface BookedRoomV3 {
174
174
  maxOccupancy: number;
175
175
  retailRate: RetailRateV3;
176
176
  };
177
+ firstName: string;
178
+ lastName: string;
177
179
  }
178
180
  export interface BookingInfoV3 {
179
181
  bookingId: string;
@@ -207,6 +209,19 @@ export interface BookingInfoV3 {
207
209
  uberVoucherCode: string;
208
210
  uberVoucherCurrency: string;
209
211
  uberVoucherExpiryDate: string;
212
+ formattedCancellationPolicies?: {
213
+ policies: {
214
+ message: string;
215
+ highlight: boolean;
216
+ cancelTimeFrame: {
217
+ start: string;
218
+ end: string;
219
+ amount: number;
220
+ type?: string;
221
+ };
222
+ }[];
223
+ hasFreeCancellation: boolean;
224
+ };
210
225
  }
211
226
  export interface BookingConfirmationV3 {
212
227
  prebookId: string;
@@ -284,6 +299,7 @@ export declare class LiteApiClientV3 {
284
299
  preBookedHotelRate(options: PrebookRateRequestV3): Promise<PrebookRateV3>;
285
300
  bookHotelRate(options: CheckoutRequestV3): Promise<BookingInfoV3>;
286
301
  cancelBooking(bookingId: string): Promise<CancelBookingV3>;
302
+ getBooking(bookingId: string): Promise<BookingInfoV3>;
287
303
  getGuests(): Promise<GuestV3[]>;
288
304
  getGuest(guestId: number): Promise<GuestV3>;
289
305
  getGuestBookings(guestId: number): Promise<GuestBookingV3[]>;
@@ -99,6 +99,18 @@ class LiteApiClientV3 {
99
99
  })).data.data;
100
100
  });
101
101
  }
102
+ getBooking(bookingId) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ return (yield (0, axios_1.default)({
105
+ method: 'get',
106
+ url: `${this.bookingBaseUrl}/v3.0/bookings/${bookingId}`,
107
+ headers: {
108
+ 'X-API-Key': this.apiKey,
109
+ 'content-type': 'application/json',
110
+ },
111
+ })).data.data;
112
+ });
113
+ }
102
114
  getGuests() {
103
115
  return __awaiter(this, void 0, void 0, function* () {
104
116
  return (yield (0, axios_1.default)({
@@ -1,6 +1,7 @@
1
1
  import { Model } from 'sequelize-typescript';
2
2
  import { Project } from './Project';
3
3
  import { OccupancyV3 } from '../libs/liteapiv3';
4
+ import { Guest } from './Guest';
4
5
  export declare class Booking extends Model<Partial<Booking>> {
5
6
  id: string;
6
7
  prebookId: string;
@@ -15,4 +16,6 @@ export declare class Booking extends Model<Partial<Booking>> {
15
16
  bookingStatus?: string;
16
17
  liteApiVersion?: string;
17
18
  occupancies?: OccupancyV3[];
19
+ guestId?: string;
20
+ guest?: Guest;
18
21
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Booking = void 0;
13
13
  const sequelize_typescript_1 = require("sequelize-typescript");
14
14
  const Project_1 = require("./Project");
15
+ const Guest_1 = require("./Guest");
15
16
  let Booking = class Booking extends sequelize_typescript_1.Model {
16
17
  };
17
18
  exports.Booking = Booking;
@@ -119,6 +120,19 @@ __decorate([
119
120
  }),
120
121
  __metadata("design:type", Array)
121
122
  ], Booking.prototype, "occupancies", void 0);
123
+ __decorate([
124
+ (0, sequelize_typescript_1.ForeignKey)(() => Guest_1.Guest),
125
+ sequelize_typescript_1.Index,
126
+ (0, sequelize_typescript_1.Column)({
127
+ type: sequelize_typescript_1.DataType.UUID,
128
+ allowNull: true,
129
+ }),
130
+ __metadata("design:type", String)
131
+ ], Booking.prototype, "guestId", void 0);
132
+ __decorate([
133
+ (0, sequelize_typescript_1.BelongsTo)(() => Guest_1.Guest),
134
+ __metadata("design:type", Guest_1.Guest)
135
+ ], Booking.prototype, "guest", void 0);
122
136
  exports.Booking = Booking = __decorate([
123
137
  (0, sequelize_typescript_1.Table)({
124
138
  tableName: 'bookings',
@@ -1,6 +1,7 @@
1
1
  import { Model } from 'sequelize-typescript';
2
2
  import { Project } from './Project';
3
3
  import { VoucherResponse } from '../libs/liteapiv3';
4
+ import { Booking } from './Booking';
4
5
  export declare class Guest extends Model<Partial<Guest>> {
5
6
  id: string;
6
7
  firstName: string;
@@ -17,6 +18,7 @@ export declare class Guest extends Model<Partial<Guest>> {
17
18
  vouchers: VoucherResponse[];
18
19
  favoriteHotelIds: string[];
19
20
  project?: Project;
21
+ bookings?: Booking[];
20
22
  static checkEmail(email: string, projectId: string): Promise<void>;
21
23
  generateSession(secret: string): string;
22
24
  }
@@ -26,6 +26,7 @@ exports.Guest = void 0;
26
26
  const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
27
27
  const sequelize_typescript_1 = require("sequelize-typescript");
28
28
  const Project_1 = require("./Project");
29
+ const Booking_1 = require("./Booking");
29
30
  let Guest = Guest_1 = class Guest extends sequelize_typescript_1.Model {
30
31
  static checkEmail(email, projectId) {
31
32
  return __awaiter(this, void 0, void 0, function* () {
@@ -150,6 +151,10 @@ __decorate([
150
151
  (0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project),
151
152
  __metadata("design:type", Project_1.Project)
152
153
  ], Guest.prototype, "project", void 0);
154
+ __decorate([
155
+ (0, sequelize_typescript_1.HasMany)(() => Booking_1.Booking),
156
+ __metadata("design:type", Array)
157
+ ], Guest.prototype, "bookings", void 0);
153
158
  exports.Guest = Guest = Guest_1 = __decorate([
154
159
  (0, sequelize_typescript_1.Table)({
155
160
  tableName: 'guests',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",