whitelabel-db 1.0.15 → 1.0.16

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
@@ -5,5 +5,5 @@ export { Country } from './models/Country';
5
5
  export { Hotel } from './models/Hotel';
6
6
  export { User } from './models/User';
7
7
  export { Project } from './models/Project';
8
- export { Booking } from './models/Booking';
9
- export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, } from './libs/liteapi';
8
+ export { Search } from './models/Search';
9
+ export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, } from './libs/liteapi';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LiteApiClient = exports.Booking = exports.Project = exports.User = exports.Hotel = exports.Country = exports.City = exports.Agency = exports.connect = void 0;
3
+ exports.LiteApiClient = exports.Search = exports.Project = exports.User = exports.Hotel = exports.Country = exports.City = exports.Agency = 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 Agency_1 = require("./models/Agency");
@@ -15,7 +15,7 @@ var User_1 = require("./models/User");
15
15
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return User_1.User; } });
16
16
  var Project_1 = require("./models/Project");
17
17
  Object.defineProperty(exports, "Project", { enumerable: true, get: function () { return Project_1.Project; } });
18
- var Booking_1 = require("./models/Booking");
19
- Object.defineProperty(exports, "Booking", { enumerable: true, get: function () { return Booking_1.Booking; } });
18
+ var Search_1 = require("./models/Search");
19
+ Object.defineProperty(exports, "Search", { enumerable: true, get: function () { return Search_1.Search; } });
20
20
  var liteapi_1 = require("./libs/liteapi");
21
21
  Object.defineProperty(exports, "LiteApiClient", { enumerable: true, get: function () { return liteapi_1.LiteApiClient; } });
@@ -17,7 +17,7 @@ const Project_1 = require("../models/Project");
17
17
  const Hotel_1 = require("../models/Hotel");
18
18
  const City_1 = require("../models/City");
19
19
  const Country_1 = require("../models/Country");
20
- const Booking_1 = require("../models/Booking");
20
+ const Search_1 = require("../models/Search");
21
21
  const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, function* () {
22
22
  const connection = new sequelize_typescript_1.Sequelize({
23
23
  dialect: 'postgres',
@@ -26,7 +26,7 @@ const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, functio
26
26
  password: connectionDetails.password,
27
27
  database: connectionDetails.dbname,
28
28
  logging: false,
29
- models: [User_1.User, Agency_1.Agency, Project_1.Project, Hotel_1.Hotel, City_1.City, Country_1.Country, Booking_1.Booking],
29
+ models: [User_1.User, Agency_1.Agency, Project_1.Project, Hotel_1.Hotel, City_1.City, Country_1.Country, Search_1.Search],
30
30
  });
31
31
  return connection
32
32
  .authenticate()
@@ -56,91 +56,10 @@ export interface FullRateAvailabilityResult {
56
56
  termsAndConditions: string;
57
57
  roomTypes: RoomType[];
58
58
  }
59
- export interface PrebookRateRequest {
60
- rateId: string;
61
- payWithStripe?: boolean;
62
- }
63
- export interface PrebookRate {
64
- prebookId: string;
65
- hotelId: string;
66
- currency: string;
67
- termsAndConditions: string;
68
- roomTypes: RoomType[];
69
- msp: number;
70
- commission: number;
71
- price: number;
72
- priceType: string;
73
- priceDifferencePercent: number;
74
- cancellationChanged: boolean;
75
- boardChanged: boolean;
76
- supplier: string;
77
- supplierId: number;
78
- transactionId: string;
79
- clientSecret: string;
80
- }
81
- export interface GuestInfo {
82
- guestFirstName: string;
83
- guestLastName: string;
84
- guestEmail: string;
85
- }
86
- export interface PaymentInfo {
87
- method: string;
88
- holderName?: string;
89
- number?: string;
90
- expireDate?: string;
91
- cvc?: string;
92
- transactionId?: string;
93
- }
94
- export interface CheckoutRequest {
95
- guestInfo: GuestInfo;
96
- payment: PaymentInfo;
97
- prebookId: string;
98
- }
99
- export interface BookedRoom {
100
- roomType: {
101
- name: string;
102
- };
103
- adults: number;
104
- children: number;
105
- rate: {
106
- maxOccupancy: number;
107
- retailRate: RetailRate;
108
- };
109
- }
110
- export interface BookingInfo {
111
- bookingId: string;
112
- clientReference: string;
113
- supplierBookingId: string;
114
- supplierBookingName: string;
115
- supplier: string;
116
- supplierId: number;
117
- status: string;
118
- hotelConfirmationCode: string;
119
- checkin: string;
120
- checkout: string;
121
- hotel: {
122
- hotelId: string;
123
- name: string;
124
- };
125
- bookedRooms: BookedRoom[];
126
- guestInfo: GuestInfo;
127
- createdAt: string;
128
- cancellationPolicies: CancellationPolicies;
129
- price: number;
130
- msp: number;
131
- commission: number;
132
- currency: string;
133
- }
134
- export interface BookingConfirmation {
135
- prebookId: string;
136
- transactionId: string;
137
- }
138
59
  export declare class LiteApiClient {
139
60
  private apiKey;
140
61
  constructor(apiKey: string);
141
62
  getHotels(options: HotelsRequest): Promise<AvailabilityResult[]>;
142
63
  getHotelById(hotelId: string): Promise<AvailabilityResult>;
143
64
  getHotelsFullRate(options: HotelsRequest): Promise<FullRateAvailabilityResult[]>;
144
- preBookedHotelRate(options: PrebookRateRequest): Promise<PrebookRate>;
145
- bookHotelRate(options: CheckoutRequest): Promise<BookingInfo>;
146
65
  }
@@ -51,31 +51,5 @@ class LiteApiClient {
51
51
  })).data.data;
52
52
  });
53
53
  }
54
- preBookedHotelRate(options) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- return (yield (0, axios_1.default)({
57
- method: 'post',
58
- url: `${baseUrl}/v2.0/rates/prebook`,
59
- data: options,
60
- headers: {
61
- 'X-API-Key': this.apiKey,
62
- 'content-type': 'application/json',
63
- },
64
- })).data.data;
65
- });
66
- }
67
- bookHotelRate(options) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- return (yield (0, axios_1.default)({
70
- method: 'post',
71
- url: `${baseUrl}/v2.0/rates/book`,
72
- data: options,
73
- headers: {
74
- 'X-API-Key': this.apiKey,
75
- 'content-type': 'application/json',
76
- },
77
- })).data.data;
78
- });
79
- }
80
54
  }
81
55
  exports.LiteApiClient = LiteApiClient;
@@ -28,43 +28,4 @@ export declare class Hotel extends Model<Partial<Hotel>> {
28
28
  hotelImages: HotelImage[];
29
29
  hotelFacilities: string[];
30
30
  rate: AvailabilityResult;
31
- phone: string;
32
- rating: number;
33
- facilities: {
34
- id: number;
35
- name: string;
36
- }[];
37
- policies: {
38
- type: number;
39
- name: string;
40
- description: string;
41
- }[];
42
- rooms: {
43
- id: number;
44
- name: string;
45
- description: string;
46
- size: number;
47
- adults: number;
48
- children: number;
49
- occupancy: number;
50
- photos: {
51
- url: string;
52
- caption: string;
53
- }[];
54
- room_amenities: {
55
- id: number;
56
- name: string;
57
- }[];
58
- }[];
59
- reviewsCount: number;
60
- reviews: {
61
- average_score: number;
62
- name: string;
63
- date: string;
64
- headline: string;
65
- language: string;
66
- country: string;
67
- pros: string;
68
- cons: string;
69
- }[];
70
31
  }
@@ -127,57 +127,6 @@ __decorate([
127
127
  }),
128
128
  __metadata("design:type", Array)
129
129
  ], Hotel.prototype, "hotelFacilities", void 0);
130
- __decorate([
131
- (0, sequelize_typescript_1.Column)({
132
- type: sequelize_typescript_1.DataType.STRING(32),
133
- allowNull: false,
134
- }),
135
- __metadata("design:type", String)
136
- ], Hotel.prototype, "phone", void 0);
137
- __decorate([
138
- (0, sequelize_typescript_1.Column)({
139
- type: sequelize_typescript_1.DataType.INTEGER,
140
- allowNull: false,
141
- defaultValue: 0,
142
- }),
143
- __metadata("design:type", Number)
144
- ], Hotel.prototype, "rating", void 0);
145
- __decorate([
146
- (0, sequelize_typescript_1.Column)({
147
- type: sequelize_typescript_1.DataType.JSONB,
148
- allowNull: true,
149
- }),
150
- __metadata("design:type", Array)
151
- ], Hotel.prototype, "facilities", void 0);
152
- __decorate([
153
- (0, sequelize_typescript_1.Column)({
154
- type: sequelize_typescript_1.DataType.JSONB,
155
- allowNull: true,
156
- }),
157
- __metadata("design:type", Array)
158
- ], Hotel.prototype, "policies", void 0);
159
- __decorate([
160
- (0, sequelize_typescript_1.Column)({
161
- type: sequelize_typescript_1.DataType.JSONB,
162
- allowNull: true,
163
- }),
164
- __metadata("design:type", Array)
165
- ], Hotel.prototype, "rooms", void 0);
166
- __decorate([
167
- (0, sequelize_typescript_1.Column)({
168
- type: sequelize_typescript_1.DataType.INTEGER,
169
- allowNull: false,
170
- defaultValue: 0,
171
- }),
172
- __metadata("design:type", Number)
173
- ], Hotel.prototype, "reviewsCount", void 0);
174
- __decorate([
175
- (0, sequelize_typescript_1.Column)({
176
- type: sequelize_typescript_1.DataType.JSONB,
177
- allowNull: true,
178
- }),
179
- __metadata("design:type", Array)
180
- ], Hotel.prototype, "reviews", void 0);
181
130
  exports.Hotel = Hotel = __decorate([
182
131
  (0, sequelize_typescript_1.Table)({
183
132
  tableName: 'static_hotels',
@@ -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,46 +9,43 @@ 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.Booking = void 0;
12
+ exports.Search = void 0;
13
13
  const sequelize_typescript_1 = require("sequelize-typescript");
14
- let Booking = class Booking extends sequelize_typescript_1.Model {
14
+ let Search = class Search extends sequelize_typescript_1.Model {
15
15
  };
16
- exports.Booking = Booking;
16
+ exports.Search = Search;
17
17
  __decorate([
18
- (0, sequelize_typescript_1.IsUUID)(4),
19
18
  sequelize_typescript_1.PrimaryKey,
19
+ sequelize_typescript_1.Index,
20
20
  (0, sequelize_typescript_1.Column)({
21
- type: sequelize_typescript_1.DataType.UUID,
22
- defaultValue: sequelize_typescript_1.DataType.UUIDV4,
21
+ type: sequelize_typescript_1.DataType.STRING(32),
23
22
  }),
24
23
  __metadata("design:type", String)
25
- ], Booking.prototype, "id", void 0);
24
+ ], Search.prototype, "id", void 0);
26
25
  __decorate([
27
- sequelize_typescript_1.Unique,
28
- sequelize_typescript_1.Index,
29
26
  (0, sequelize_typescript_1.Column)({
30
- type: sequelize_typescript_1.DataType.STRING,
27
+ type: sequelize_typescript_1.DataType.INTEGER,
31
28
  allowNull: false,
32
29
  defaultValue: 0,
33
30
  }),
34
- __metadata("design:type", String)
35
- ], Booking.prototype, "prebookId", void 0);
31
+ __metadata("design:type", Number)
32
+ ], Search.prototype, "hits", void 0);
36
33
  __decorate([
34
+ sequelize_typescript_1.Unique,
35
+ sequelize_typescript_1.Index,
37
36
  (0, sequelize_typescript_1.Column)({
38
- type: sequelize_typescript_1.DataType.JSONB,
39
- allowNull: false,
40
- defaultValue: {},
37
+ type: sequelize_typescript_1.DataType.DATE,
41
38
  }),
42
- __metadata("design:type", Object)
43
- ], Booking.prototype, "liteApiPrebookData", void 0);
39
+ __metadata("design:type", Date)
40
+ ], Search.prototype, "cacheUpdatedAt", void 0);
44
41
  __decorate([
42
+ sequelize_typescript_1.Unique,
43
+ sequelize_typescript_1.Index,
45
44
  (0, sequelize_typescript_1.Column)({
46
- type: sequelize_typescript_1.DataType.JSONB,
47
- allowNull: false,
48
- defaultValue: {},
45
+ type: sequelize_typescript_1.DataType.DATE,
49
46
  }),
50
- __metadata("design:type", Object)
51
- ], Booking.prototype, "liteApiBookingData", void 0);
47
+ __metadata("design:type", Date)
48
+ ], Search.prototype, "cacheQueuedAt", void 0);
52
49
  __decorate([
53
50
  (0, sequelize_typescript_1.Column)({
54
51
  type: sequelize_typescript_1.DataType.JSONB,
@@ -56,16 +53,9 @@ __decorate([
56
53
  defaultValue: {},
57
54
  }),
58
55
  __metadata("design:type", Object)
59
- ], Booking.prototype, "bookingInputData", void 0);
60
- __decorate([
61
- (0, sequelize_typescript_1.Column)({
62
- type: sequelize_typescript_1.DataType.UUID,
63
- allowNull: false,
64
- }),
65
- __metadata("design:type", String)
66
- ], Booking.prototype, "projectId", void 0);
67
- exports.Booking = Booking = __decorate([
56
+ ], Search.prototype, "data", void 0);
57
+ exports.Search = Search = __decorate([
68
58
  (0, sequelize_typescript_1.Table)({
69
- tableName: 'booking',
59
+ tableName: 'searches',
70
60
  })
71
- ], Booking);
61
+ ], Search);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,9 +0,0 @@
1
- import { Model } from 'sequelize-typescript';
2
- export declare class Booking extends Model<Partial<Booking>> {
3
- id: string;
4
- prebookId: string;
5
- liteApiPrebookData?: object;
6
- liteApiBookingData?: object;
7
- bookingInputData?: object;
8
- projectId?: string;
9
- }