whitelabel-db 1.1.9 → 1.1.10

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,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,5 @@ export declare class HotelAccessibility extends Model<HotelAccessibility> {
47
48
  publicToiletsEmergencyCord: boolean;
48
49
  publicToiletsVisualIndicators: boolean;
49
50
  publicToiletsGrabbingHandles: boolean;
51
+ hotel?: Hotel;
50
52
  }
@@ -349,9 +349,12 @@ __decorate([
349
349
  }),
350
350
  __metadata("design:type", Boolean)
351
351
  ], HotelAccessibility.prototype, "publicToiletsGrabbingHandles", void 0);
352
+ __decorate([
353
+ (0, sequelize_typescript_1.BelongsTo)(() => Hotel_1.Hotel),
354
+ __metadata("design:type", Hotel_1.Hotel)
355
+ ], HotelAccessibility.prototype, "hotel", void 0);
352
356
  exports.HotelAccessibility = HotelAccessibility = __decorate([
353
357
  (0, sequelize_typescript_1.Table)({
354
358
  tableName: 'static_hotels_accessibility',
355
- timestamps: true, // This will automatically add createdAt and updatedAt fields
356
359
  })
357
360
  ], 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.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",