whitelabel-db 1.1.9 → 1.1.11

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.
@@ -12,6 +12,6 @@ export declare class Guest extends Model<Partial<Guest>> {
12
12
  socialProvider: string;
13
13
  isVerified: boolean;
14
14
  project?: Project;
15
- static checkEmail(email: string): Promise<void>;
15
+ static checkEmail(email: string, projectId: string): Promise<void>;
16
16
  generateSession(secret: string): string;
17
17
  }
@@ -27,9 +27,9 @@ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
27
27
  const sequelize_typescript_1 = require("sequelize-typescript");
28
28
  const Project_1 = require("./Project");
29
29
  let Guest = Guest_1 = class Guest extends sequelize_typescript_1.Model {
30
- static checkEmail(email) {
30
+ static checkEmail(email, projectId) {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
- if (yield Guest_1.findOne({ where: { email: email.toLowerCase() } })) {
32
+ if (yield Guest_1.findOne({ where: { email: email.toLowerCase(), projectId } })) {
33
33
  throw new Error('This email is already registered to another account.');
34
34
  }
35
35
  });
@@ -67,7 +67,6 @@ __decorate([
67
67
  ], Guest.prototype, "lastName", void 0);
68
68
  __decorate([
69
69
  sequelize_typescript_1.Index,
70
- sequelize_typescript_1.Unique,
71
70
  (0, sequelize_typescript_1.Column)({
72
71
  type: sequelize_typescript_1.DataType.STRING,
73
72
  allowNull: false,
@@ -124,5 +123,11 @@ __decorate([
124
123
  exports.Guest = Guest = Guest_1 = __decorate([
125
124
  (0, sequelize_typescript_1.Table)({
126
125
  tableName: 'guests',
126
+ indexes: [
127
+ {
128
+ unique: true,
129
+ fields: ['email', 'projectId'],
130
+ },
131
+ ],
127
132
  })
128
133
  ], Guest);
@@ -1,5 +1,6 @@
1
1
  import { Model } from 'sequelize-typescript';
2
2
  import { AvailabilityResult } from '../libs/liteapi';
3
+ import { HotelAccessibility } from './HotelAccessibility';
3
4
  export type HotelImage = {
4
5
  url: string;
5
6
  thumbnailUrl: string;
@@ -94,4 +95,5 @@ export declare class Hotel extends Model<Partial<Hotel>> {
94
95
  bestSeller: boolean;
95
96
  reviewSentiment: ReviewSentiment;
96
97
  isAccessible: boolean;
98
+ accessibility: HotelAccessibility;
97
99
  }
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Hotel = void 0;
13
13
  const sequelize_typescript_1 = require("sequelize-typescript");
14
+ const HotelAccessibility_1 = require("./HotelAccessibility");
14
15
  let Hotel = class Hotel extends sequelize_typescript_1.Model {
15
16
  };
16
17
  exports.Hotel = Hotel;
@@ -254,6 +255,10 @@ __decorate([
254
255
  }),
255
256
  __metadata("design:type", Boolean)
256
257
  ], Hotel.prototype, "isAccessible", void 0);
258
+ __decorate([
259
+ (0, sequelize_typescript_1.HasOne)(() => HotelAccessibility_1.HotelAccessibility),
260
+ __metadata("design:type", HotelAccessibility_1.HotelAccessibility)
261
+ ], Hotel.prototype, "accessibility", void 0);
257
262
  exports.Hotel = Hotel = __decorate([
258
263
  (0, sequelize_typescript_1.Table)({
259
264
  tableName: 'static_hotels',
@@ -1,4 +1,5 @@
1
1
  import { Model } from 'sequelize-typescript';
2
+ import { Hotel } from './Hotel';
2
3
  export declare class HotelAccessibility extends Model<HotelAccessibility> {
3
4
  id: string;
4
5
  hotelId: string;
@@ -47,4 +48,13 @@ export declare class HotelAccessibility extends Model<HotelAccessibility> {
47
48
  publicToiletsEmergencyCord: boolean;
48
49
  publicToiletsVisualIndicators: boolean;
49
50
  publicToiletsGrabbingHandles: boolean;
51
+ totalDisabilityScore: number;
52
+ crouchesCaneImpaired: boolean;
53
+ elderlyImpaired: boolean;
54
+ electricWheelchair: boolean;
55
+ hearingImpaired: boolean;
56
+ manualWheelchair: boolean;
57
+ visuallyImpaired: boolean;
58
+ wheelchairOrScooterImpaired: boolean;
59
+ hotel?: Hotel;
50
60
  }
@@ -26,11 +26,13 @@ __decorate([
26
26
  __metadata("design:type", String)
27
27
  ], HotelAccessibility.prototype, "id", void 0);
28
28
  __decorate([
29
+ sequelize_typescript_1.Index,
29
30
  (0, sequelize_typescript_1.ForeignKey)(() => Hotel_1.Hotel) // Define the association with the Hotel model
30
31
  ,
31
32
  (0, sequelize_typescript_1.Column)({
32
33
  type: sequelize_typescript_1.DataType.STRING,
33
34
  allowNull: false,
35
+ unique: true,
34
36
  }),
35
37
  __metadata("design:type", String)
36
38
  ], HotelAccessibility.prototype, "hotelId", void 0);
@@ -349,9 +351,68 @@ __decorate([
349
351
  }),
350
352
  __metadata("design:type", Boolean)
351
353
  ], HotelAccessibility.prototype, "publicToiletsGrabbingHandles", void 0);
354
+ __decorate([
355
+ (0, sequelize_typescript_1.Column)({
356
+ type: sequelize_typescript_1.DataType.NUMBER,
357
+ allowNull: true,
358
+ }),
359
+ __metadata("design:type", Number)
360
+ ], HotelAccessibility.prototype, "totalDisabilityScore", void 0);
361
+ __decorate([
362
+ (0, sequelize_typescript_1.Column)({
363
+ type: sequelize_typescript_1.DataType.BOOLEAN,
364
+ defaultValue: false,
365
+ }),
366
+ __metadata("design:type", Boolean)
367
+ ], HotelAccessibility.prototype, "crouchesCaneImpaired", void 0);
368
+ __decorate([
369
+ (0, sequelize_typescript_1.Column)({
370
+ type: sequelize_typescript_1.DataType.BOOLEAN,
371
+ defaultValue: false,
372
+ }),
373
+ __metadata("design:type", Boolean)
374
+ ], HotelAccessibility.prototype, "elderlyImpaired", void 0);
375
+ __decorate([
376
+ (0, sequelize_typescript_1.Column)({
377
+ type: sequelize_typescript_1.DataType.BOOLEAN,
378
+ defaultValue: false,
379
+ }),
380
+ __metadata("design:type", Boolean)
381
+ ], HotelAccessibility.prototype, "electricWheelchair", void 0);
382
+ __decorate([
383
+ (0, sequelize_typescript_1.Column)({
384
+ type: sequelize_typescript_1.DataType.BOOLEAN,
385
+ defaultValue: false,
386
+ }),
387
+ __metadata("design:type", Boolean)
388
+ ], HotelAccessibility.prototype, "hearingImpaired", void 0);
389
+ __decorate([
390
+ (0, sequelize_typescript_1.Column)({
391
+ type: sequelize_typescript_1.DataType.BOOLEAN,
392
+ defaultValue: false,
393
+ }),
394
+ __metadata("design:type", Boolean)
395
+ ], HotelAccessibility.prototype, "manualWheelchair", void 0);
396
+ __decorate([
397
+ (0, sequelize_typescript_1.Column)({
398
+ type: sequelize_typescript_1.DataType.BOOLEAN,
399
+ defaultValue: false,
400
+ }),
401
+ __metadata("design:type", Boolean)
402
+ ], HotelAccessibility.prototype, "visuallyImpaired", void 0);
403
+ __decorate([
404
+ (0, sequelize_typescript_1.Column)({
405
+ type: sequelize_typescript_1.DataType.BOOLEAN,
406
+ defaultValue: false,
407
+ }),
408
+ __metadata("design:type", Boolean)
409
+ ], HotelAccessibility.prototype, "wheelchairOrScooterImpaired", void 0);
410
+ __decorate([
411
+ (0, sequelize_typescript_1.BelongsTo)(() => Hotel_1.Hotel),
412
+ __metadata("design:type", Hotel_1.Hotel)
413
+ ], HotelAccessibility.prototype, "hotel", void 0);
352
414
  exports.HotelAccessibility = HotelAccessibility = __decorate([
353
415
  (0, sequelize_typescript_1.Table)({
354
416
  tableName: 'static_hotels_accessibility',
355
- timestamps: true, // This will automatically add createdAt and updatedAt fields
356
417
  })
357
418
  ], HotelAccessibility);
@@ -30,7 +30,7 @@ const Role_1 = require("./Role");
30
30
  let User = User_1 = class User extends sequelize_typescript_1.Model {
31
31
  static checkEmail(email) {
32
32
  return __awaiter(this, void 0, void 0, function* () {
33
- if (yield User_1.findOne({ where: { email } })) {
33
+ if (yield User_1.findOne({ where: { email: email.toLowerCase() } })) {
34
34
  throw new Error('This email is already registered to another account.');
35
35
  }
36
36
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",