whitelabel-db 1.1.53 → 1.1.55
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/migrations/007-add-user-columns copy.d.ts +3 -0
- package/dist/migrations/007-add-user-columns copy.js +55 -0
- package/dist/migrations/007-add-user-columns.d.ts +3 -0
- package/dist/migrations/007-add-user-columns.js +55 -0
- package/dist/migrations/008-update-hotel-accessibility-columns.d.ts +3 -0
- package/dist/migrations/008-update-hotel-accessibility-columns.js +42 -0
- package/dist/models/HotelAccessibility.js +1 -1
- package/dist/models/User.d.ts +4 -0
- package/dist/models/User.js +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
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 amountTotal, boardType columns to users table.
|
|
14
|
+
const sequelize_1 = require("sequelize");
|
|
15
|
+
const columns = [
|
|
16
|
+
{
|
|
17
|
+
name: 'isVerified',
|
|
18
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
19
|
+
allowNull: true,
|
|
20
|
+
},
|
|
21
|
+
{ name: 'firstName', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
22
|
+
{ name: 'lastName', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
23
|
+
{ name: 'phoneNo', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
24
|
+
];
|
|
25
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
try {
|
|
27
|
+
// Add all columns in parallel
|
|
28
|
+
yield Promise.all(columns.map((column) => queryInterface.addColumn('users', column.name, {
|
|
29
|
+
type: column.type,
|
|
30
|
+
allowNull: column.allowNull,
|
|
31
|
+
})));
|
|
32
|
+
console.log('All columns added successfully.');
|
|
33
|
+
console.log('All columns added successfully.');
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error('Error while adding columns:', error.message);
|
|
37
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
exports.up = up;
|
|
41
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
// Remove columns
|
|
44
|
+
for (const column of columns.reverse()) {
|
|
45
|
+
console.log(`Removing column: ${column.name}`);
|
|
46
|
+
yield queryInterface.removeColumn('users', column.name);
|
|
47
|
+
}
|
|
48
|
+
console.log('All columns removed successfully.');
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('Error while removing columns:', error.message);
|
|
52
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
exports.down = down;
|
|
@@ -0,0 +1,55 @@
|
|
|
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 amountTotal, boardType columns to users table.
|
|
14
|
+
const sequelize_1 = require("sequelize");
|
|
15
|
+
const columns = [
|
|
16
|
+
{
|
|
17
|
+
name: 'isVerified',
|
|
18
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
19
|
+
allowNull: true,
|
|
20
|
+
},
|
|
21
|
+
{ name: 'firstName', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
22
|
+
{ name: 'lastName', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
23
|
+
{ name: 'phoneNo', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
24
|
+
];
|
|
25
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
try {
|
|
27
|
+
// Add all columns in parallel
|
|
28
|
+
yield Promise.all(columns.map((column) => queryInterface.addColumn('users', column.name, {
|
|
29
|
+
type: column.type,
|
|
30
|
+
allowNull: column.allowNull,
|
|
31
|
+
})));
|
|
32
|
+
console.log('All columns added successfully.');
|
|
33
|
+
console.log('All columns added successfully.');
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error('Error while adding columns:', error.message);
|
|
37
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
exports.up = up;
|
|
41
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
try {
|
|
43
|
+
// Remove columns
|
|
44
|
+
for (const column of columns.reverse()) {
|
|
45
|
+
console.log(`Removing column: ${column.name}`);
|
|
46
|
+
yield queryInterface.removeColumn('users', column.name);
|
|
47
|
+
}
|
|
48
|
+
console.log('All columns removed successfully.');
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('Error while removing columns:', error.message);
|
|
52
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
exports.down = down;
|
|
@@ -0,0 +1,42 @@
|
|
|
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: Update certificateHtml column in static_hotels_accessibility table from string to text
|
|
14
|
+
const sequelize_1 = require("sequelize");
|
|
15
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
yield queryInterface.changeColumn('static_hotels_accessibility', 'certificateHtml', {
|
|
18
|
+
type: sequelize_1.DataTypes.TEXT,
|
|
19
|
+
allowNull: true,
|
|
20
|
+
});
|
|
21
|
+
console.log('certificateHtml column has been changed successfully.');
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error('Error while adding columns or indexes:', error.message);
|
|
25
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
exports.up = up;
|
|
29
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
try {
|
|
31
|
+
yield queryInterface.changeColumn('static_hotels_accessibility', 'certificateHtml', {
|
|
32
|
+
type: sequelize_1.DataTypes.STRING,
|
|
33
|
+
allowNull: true,
|
|
34
|
+
});
|
|
35
|
+
console.log('certificateHtml column has been changed successfully.');
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error('Error while removing columns or indexes:', error.message);
|
|
39
|
+
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
exports.down = down;
|
|
@@ -427,7 +427,7 @@ __decorate([
|
|
|
427
427
|
], HotelAccessibility.prototype, "certificateUrl", void 0);
|
|
428
428
|
__decorate([
|
|
429
429
|
(0, sequelize_typescript_1.Column)({
|
|
430
|
-
type: sequelize_typescript_1.DataType.
|
|
430
|
+
type: sequelize_typescript_1.DataType.TEXT,
|
|
431
431
|
allowNull: true,
|
|
432
432
|
}),
|
|
433
433
|
__metadata("design:type", String)
|
package/dist/models/User.d.ts
CHANGED
|
@@ -4,12 +4,16 @@ import { Role } from './Role';
|
|
|
4
4
|
export declare class User extends Model<Partial<User>> {
|
|
5
5
|
id: string;
|
|
6
6
|
email: string;
|
|
7
|
+
firstName: string;
|
|
8
|
+
lastName: string;
|
|
9
|
+
phoneNo: string;
|
|
7
10
|
password: string;
|
|
8
11
|
agencyId?: string;
|
|
9
12
|
agency?: Agency;
|
|
10
13
|
roleId?: number;
|
|
11
14
|
otp?: string;
|
|
12
15
|
role?: Role;
|
|
16
|
+
isVerified: boolean;
|
|
13
17
|
static checkEmail(email: string): Promise<void>;
|
|
14
18
|
generateSession(secret: string): string;
|
|
15
19
|
}
|
package/dist/models/User.js
CHANGED
|
@@ -61,6 +61,27 @@ __decorate([
|
|
|
61
61
|
}),
|
|
62
62
|
__metadata("design:type", String)
|
|
63
63
|
], User.prototype, "email", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, sequelize_typescript_1.Column)({
|
|
66
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
67
|
+
allowNull: true,
|
|
68
|
+
}),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], User.prototype, "firstName", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, sequelize_typescript_1.Column)({
|
|
73
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
74
|
+
allowNull: true,
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], User.prototype, "lastName", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, sequelize_typescript_1.Column)({
|
|
80
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
81
|
+
allowNull: true,
|
|
82
|
+
}),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], User.prototype, "phoneNo", void 0);
|
|
64
85
|
__decorate([
|
|
65
86
|
(0, sequelize_typescript_1.Column)({
|
|
66
87
|
type: sequelize_typescript_1.DataType.STRING,
|
|
@@ -100,6 +121,13 @@ __decorate([
|
|
|
100
121
|
(0, sequelize_typescript_1.BelongsTo)(() => Role_1.Role),
|
|
101
122
|
__metadata("design:type", Role_1.Role)
|
|
102
123
|
], User.prototype, "role", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, sequelize_typescript_1.Column)({
|
|
126
|
+
type: sequelize_typescript_1.DataType.BOOLEAN,
|
|
127
|
+
defaultValue: true,
|
|
128
|
+
}),
|
|
129
|
+
__metadata("design:type", Boolean)
|
|
130
|
+
], User.prototype, "isVerified", void 0);
|
|
103
131
|
exports.User = User = User_1 = __decorate([
|
|
104
132
|
(0, sequelize_typescript_1.Table)({
|
|
105
133
|
tableName: 'users',
|