whitelabel-db 1.1.55 → 1.1.57
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/libs/translation.d.ts +4 -0
- package/dist/libs/translation.js +21 -0
- package/dist/migrations/{008-update-hotel-accessibility-columns.js → 008-add-hotel-column.js} +10 -11
- package/dist/models/Hotel.d.ts +8 -0
- package/dist/models/Hotel.js +113 -0
- package/package.json +1 -1
- package/dist/migrations/001-add-guest-voucherCount.js +0 -47
- package/dist/migrations/002-add-table-user1.d.ts +0 -3
- package/dist/migrations/002-add-table-user1.js +0 -58
- package/dist/migrations/007-add-user-columns copy.d.ts +0 -3
- package/dist/migrations/007-add-user-columns copy.js +0 -55
- package/dist/migrations/008-update-hotel-accessibility-columns.d.ts +0 -3
- package/dist/models/UserRole.d.ts +0 -6
- package/dist/models/UserRole.js +0 -46
- package/dist/models/Voucher.d.ts +0 -23
- package/dist/models/Voucher.js +0 -162
- /package/dist/migrations/{001-add-guest-voucherCount.d.ts → 008-add-hotel-column.d.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTranslationFallback = void 0;
|
|
4
|
+
const sequelize_1 = require("sequelize");
|
|
5
|
+
const HotelTranslation_1 = require("../models/HotelTranslation");
|
|
6
|
+
function getTranslationFallback(language = 'en', attributes) {
|
|
7
|
+
return {
|
|
8
|
+
include: [
|
|
9
|
+
{
|
|
10
|
+
model: HotelTranslation_1.HotelTranslation,
|
|
11
|
+
as: 'translations',
|
|
12
|
+
attributes,
|
|
13
|
+
where: {
|
|
14
|
+
[sequelize_1.Op.or]: [{ language }],
|
|
15
|
+
},
|
|
16
|
+
required: false,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.getTranslationFallback = getTranslationFallback;
|
package/dist/migrations/{008-update-hotel-accessibility-columns.js → 008-add-hotel-column.js}
RENAMED
|
@@ -10,32 +10,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.down = exports.up = void 0;
|
|
13
|
-
// Purpose:
|
|
13
|
+
// Purpose: Add parking column to static_hotels table.
|
|
14
14
|
const sequelize_1 = require("sequelize");
|
|
15
15
|
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// Add all columns in parallel
|
|
18
|
+
yield queryInterface.addColumn('static_hotels', 'parking', {
|
|
19
|
+
type: sequelize_1.DataTypes.STRING,
|
|
19
20
|
allowNull: true,
|
|
20
21
|
});
|
|
21
|
-
console.log('
|
|
22
|
+
console.log('All columns added successfully.');
|
|
22
23
|
}
|
|
23
24
|
catch (error) {
|
|
24
|
-
console.error('Error while adding columns
|
|
25
|
+
console.error('Error while adding columns:', error.message);
|
|
25
26
|
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
29
|
exports.up = up;
|
|
29
30
|
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
console.log('certificateHtml column has been changed successfully.');
|
|
32
|
+
// Remove columns
|
|
33
|
+
yield queryInterface.removeColumn('static_hotels', 'parking');
|
|
34
|
+
console.log('All columns removed successfully.');
|
|
36
35
|
}
|
|
37
36
|
catch (error) {
|
|
38
|
-
console.error('Error while removing columns
|
|
37
|
+
console.error('Error while removing columns:', error.message);
|
|
39
38
|
throw error; // Re-throw to ensure migration failure is logged and handled.
|
|
40
39
|
}
|
|
41
40
|
});
|
package/dist/models/Hotel.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Model } from 'sequelize-typescript';
|
|
2
2
|
import { AvailabilityResult } from '../libs/liteapi';
|
|
3
3
|
import { HotelAccessibility } from './HotelAccessibility';
|
|
4
|
+
import { HotelTranslation } from './HotelTranslation';
|
|
4
5
|
export type HotelImage = {
|
|
5
6
|
url: string;
|
|
6
7
|
thumbnailUrl: string;
|
|
@@ -101,5 +102,12 @@ export declare class Hotel extends Model<Partial<Hotel>> {
|
|
|
101
102
|
bestSeller: boolean;
|
|
102
103
|
reviewSentiment: ReviewSentiment;
|
|
103
104
|
isAccessible: boolean;
|
|
105
|
+
parking?: string;
|
|
104
106
|
accessibility: HotelAccessibility;
|
|
107
|
+
translations: HotelTranslation[];
|
|
108
|
+
static includeTranslations(options: any, language?: string): any;
|
|
109
|
+
static applyTranslations(hotel: Hotel): Hotel;
|
|
110
|
+
static findOneWithTranslation(options: any, language?: string): Promise<Hotel>;
|
|
111
|
+
static findByPkWithTranslation(id: number | string, options?: any, language?: string): Promise<Hotel>;
|
|
112
|
+
static findAllWithTranslation(options: any, language?: string): Promise<Hotel[]>;
|
|
105
113
|
}
|
package/dist/models/Hotel.js
CHANGED
|
@@ -8,11 +8,113 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
11
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
21
|
exports.Hotel = void 0;
|
|
13
22
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
23
|
const HotelAccessibility_1 = require("./HotelAccessibility");
|
|
24
|
+
const HotelTranslation_1 = require("./HotelTranslation");
|
|
15
25
|
let Hotel = class Hotel extends sequelize_typescript_1.Model {
|
|
26
|
+
// Include translations in the options
|
|
27
|
+
static includeTranslations(options, language) {
|
|
28
|
+
if (language && language !== 'en') {
|
|
29
|
+
options.include = options.include || [];
|
|
30
|
+
options.include.push({
|
|
31
|
+
model: HotelTranslation_1.HotelTranslation,
|
|
32
|
+
as: 'translations',
|
|
33
|
+
where: { language },
|
|
34
|
+
required: false,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return options;
|
|
38
|
+
}
|
|
39
|
+
static applyTranslations(hotel) {
|
|
40
|
+
if (!hotel)
|
|
41
|
+
return hotel;
|
|
42
|
+
// Check if translations exist in normal object/array form
|
|
43
|
+
const hasObjectTranslations = hotel.translations &&
|
|
44
|
+
((Array.isArray(hotel.translations) && hotel.translations.length > 0) ||
|
|
45
|
+
(typeof hotel.translations === 'object' &&
|
|
46
|
+
Object.keys(hotel.translations).length > 0));
|
|
47
|
+
// Check if translations exist in dot-notation format (e.g., 'translations.address')
|
|
48
|
+
const hasDotNotationTranslations = Object.keys(hotel).some((key) => key.startsWith('translations.'));
|
|
49
|
+
// If no valid translations in any format, return the hotel as is
|
|
50
|
+
if (!hasObjectTranslations && !hasDotNotationTranslations) {
|
|
51
|
+
return hotel;
|
|
52
|
+
}
|
|
53
|
+
let translation = {};
|
|
54
|
+
if (hasObjectTranslations) {
|
|
55
|
+
// Extract normal translations (array or object)
|
|
56
|
+
translation = Array.isArray(hotel.translations)
|
|
57
|
+
? hotel.translations[0]
|
|
58
|
+
: hotel.translations;
|
|
59
|
+
}
|
|
60
|
+
else if (hasDotNotationTranslations) {
|
|
61
|
+
// Convert dot-notation translations into an object
|
|
62
|
+
translation = Object.keys(hotel)
|
|
63
|
+
.filter((key) => key.startsWith('translations.'))
|
|
64
|
+
.reduce((acc, key) => {
|
|
65
|
+
const cleanKey = key.replace('translations.', ''); // Remove 'translations.' prefix
|
|
66
|
+
acc[cleanKey] = hotel[key]; // Assign extracted value
|
|
67
|
+
return acc;
|
|
68
|
+
}, {});
|
|
69
|
+
}
|
|
70
|
+
// Helper function to get translated value or fallback
|
|
71
|
+
const getNestedValue = (key) => { var _a; return (_a = translation[key]) !== null && _a !== void 0 ? _a : hotel[key]; };
|
|
72
|
+
return Object.assign(hotel, {
|
|
73
|
+
name: getNestedValue('name'),
|
|
74
|
+
hotelDescription: getNestedValue('hotelDescription'),
|
|
75
|
+
markdownDescription: getNestedValue('markdownDescription'),
|
|
76
|
+
importantInfo: getNestedValue('importantInfo'),
|
|
77
|
+
address: getNestedValue('address'),
|
|
78
|
+
country: getNestedValue('country'),
|
|
79
|
+
city: getNestedValue('city'),
|
|
80
|
+
facilities: getNestedValue('facilities'),
|
|
81
|
+
policies: getNestedValue('policies'),
|
|
82
|
+
rooms: getNestedValue('rooms'),
|
|
83
|
+
reviews: getNestedValue('reviews'),
|
|
84
|
+
hotelType: getNestedValue('hotelType'),
|
|
85
|
+
parking: getNestedValue('parking'),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
static findOneWithTranslation(options, language) {
|
|
89
|
+
const _super = Object.create(null, {
|
|
90
|
+
findOne: { get: () => super.findOne }
|
|
91
|
+
});
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
options = this.includeTranslations(options, language);
|
|
94
|
+
const hotel = (yield _super.findOne.call(this, options));
|
|
95
|
+
return this.applyTranslations(hotel);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
static findByPkWithTranslation(id, options = {}, language) {
|
|
99
|
+
const _super = Object.create(null, {
|
|
100
|
+
findByPk: { get: () => super.findByPk }
|
|
101
|
+
});
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
options = this.includeTranslations(options, language);
|
|
104
|
+
const hotel = (yield _super.findByPk.call(this, id, options));
|
|
105
|
+
return this.applyTranslations(hotel);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
static findAllWithTranslation(options, language) {
|
|
109
|
+
const _super = Object.create(null, {
|
|
110
|
+
findAll: { get: () => super.findAll }
|
|
111
|
+
});
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
options = this.includeTranslations(options, language);
|
|
114
|
+
const hotels = (yield _super.findAll.call(this, options));
|
|
115
|
+
return hotels.map((hotel) => this.applyTranslations(hotel));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
16
118
|
};
|
|
17
119
|
exports.Hotel = Hotel;
|
|
18
120
|
__decorate([
|
|
@@ -297,10 +399,21 @@ __decorate([
|
|
|
297
399
|
}),
|
|
298
400
|
__metadata("design:type", Boolean)
|
|
299
401
|
], Hotel.prototype, "isAccessible", void 0);
|
|
402
|
+
__decorate([
|
|
403
|
+
(0, sequelize_typescript_1.Column)({
|
|
404
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
405
|
+
allowNull: true,
|
|
406
|
+
}),
|
|
407
|
+
__metadata("design:type", String)
|
|
408
|
+
], Hotel.prototype, "parking", void 0);
|
|
300
409
|
__decorate([
|
|
301
410
|
(0, sequelize_typescript_1.HasOne)(() => HotelAccessibility_1.HotelAccessibility),
|
|
302
411
|
__metadata("design:type", HotelAccessibility_1.HotelAccessibility)
|
|
303
412
|
], Hotel.prototype, "accessibility", void 0);
|
|
413
|
+
__decorate([
|
|
414
|
+
(0, sequelize_typescript_1.HasMany)(() => HotelTranslation_1.HotelTranslation),
|
|
415
|
+
__metadata("design:type", Array)
|
|
416
|
+
], Hotel.prototype, "translations", void 0);
|
|
304
417
|
exports.Hotel = Hotel = __decorate([
|
|
305
418
|
(0, sequelize_typescript_1.Table)({
|
|
306
419
|
tableName: 'static_hotels',
|
package/package.json
CHANGED
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
const sequelize_1 = require("sequelize");
|
|
14
|
-
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
try {
|
|
16
|
-
yield queryInterface.addColumn('guests', 'voucherCount', {
|
|
17
|
-
type: sequelize_1.DataTypes.INTEGER,
|
|
18
|
-
allowNull: true,
|
|
19
|
-
defaultValue: 0,
|
|
20
|
-
});
|
|
21
|
-
console.log('Column voucherCount added successfully.');
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
if (error.message.includes('already exists')) {
|
|
25
|
-
console.log('Column voucherCount already exists, skipping.');
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
throw error; // Re-throw other errors
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
exports.up = up;
|
|
33
|
-
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
|
-
try {
|
|
35
|
-
yield queryInterface.removeColumn('guests', 'voucherCount');
|
|
36
|
-
console.log('Column voucherCount removed successfully.');
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
if (error.message.includes('does not exist')) {
|
|
40
|
-
console.log('Column voucherCount does not exist, skipping.');
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
throw error; // Re-throw other errors
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
exports.down = down;
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
const sequelize_1 = require("sequelize");
|
|
14
|
-
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
try {
|
|
16
|
-
// create table user 1 with name and email column
|
|
17
|
-
yield queryInterface.createTable('user1', {
|
|
18
|
-
id: {
|
|
19
|
-
type: sequelize_1.DataTypes.UUID,
|
|
20
|
-
primaryKey: true,
|
|
21
|
-
defaultValue: sequelize_1.DataTypes.UUIDV4,
|
|
22
|
-
},
|
|
23
|
-
name: {
|
|
24
|
-
type: sequelize_1.DataTypes.STRING,
|
|
25
|
-
allowNull: false,
|
|
26
|
-
},
|
|
27
|
-
email: {
|
|
28
|
-
type: sequelize_1.DataTypes.STRING,
|
|
29
|
-
allowNull: false,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
console.log('Table user1 created successfully.');
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
if (error.message.includes('already exists')) {
|
|
36
|
-
console.log('Table user1 already exists, skipping.');
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
throw error; // Re-throw other errors
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
exports.up = up;
|
|
44
|
-
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
try {
|
|
46
|
-
yield queryInterface.dropTable('user1');
|
|
47
|
-
console.log('Table user1 dropped successfully.');
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
if (error.message.includes('does not exist')) {
|
|
51
|
-
console.log('Table user1 does not exist, skipping.');
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
throw error; // Re-throw other errors
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
exports.down = down;
|
|
@@ -1,55 +0,0 @@
|
|
|
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;
|
package/dist/models/UserRole.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UserRole = void 0;
|
|
13
|
-
const sequelize_1 = require("sequelize");
|
|
14
|
-
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
15
|
-
let UserRole = class UserRole extends sequelize_typescript_1.Model {
|
|
16
|
-
};
|
|
17
|
-
exports.UserRole = UserRole;
|
|
18
|
-
__decorate([
|
|
19
|
-
sequelize_typescript_1.PrimaryKey,
|
|
20
|
-
(0, sequelize_typescript_1.Column)({
|
|
21
|
-
type: sequelize_1.NUMBER,
|
|
22
|
-
allowNull: false,
|
|
23
|
-
autoIncrement: true,
|
|
24
|
-
}),
|
|
25
|
-
__metadata("design:type", String)
|
|
26
|
-
], UserRole.prototype, "id", void 0);
|
|
27
|
-
__decorate([
|
|
28
|
-
sequelize_typescript_1.Unique,
|
|
29
|
-
(0, sequelize_typescript_1.Column)({
|
|
30
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
31
|
-
allowNull: false,
|
|
32
|
-
}),
|
|
33
|
-
__metadata("design:type", String)
|
|
34
|
-
], UserRole.prototype, "name", void 0);
|
|
35
|
-
__decorate([
|
|
36
|
-
(0, sequelize_typescript_1.Column)({
|
|
37
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
38
|
-
allowNull: true,
|
|
39
|
-
}),
|
|
40
|
-
__metadata("design:type", String)
|
|
41
|
-
], UserRole.prototype, "description", void 0);
|
|
42
|
-
exports.UserRole = UserRole = __decorate([
|
|
43
|
-
(0, sequelize_typescript_1.Table)({
|
|
44
|
-
tableName: 'user_roles',
|
|
45
|
-
})
|
|
46
|
-
], UserRole);
|
package/dist/models/Voucher.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Model } from 'sequelize-typescript';
|
|
2
|
-
import { Guest } from './Guest';
|
|
3
|
-
export declare class Voucher extends Model<Partial<Voucher>> {
|
|
4
|
-
id: string;
|
|
5
|
-
guestId: string;
|
|
6
|
-
status: string;
|
|
7
|
-
guest?: Guest;
|
|
8
|
-
createdAt: Date;
|
|
9
|
-
updatedAt: Date;
|
|
10
|
-
liteApiUserId: number;
|
|
11
|
-
currency: string;
|
|
12
|
-
usagesLimit: number;
|
|
13
|
-
remainingUses: number;
|
|
14
|
-
validityStart: Date;
|
|
15
|
-
validityEnd: Date;
|
|
16
|
-
voucherCode: string;
|
|
17
|
-
discountType: string;
|
|
18
|
-
discountValue: number;
|
|
19
|
-
maximumDiscountAmount: number;
|
|
20
|
-
termsAndConditions: string;
|
|
21
|
-
voucherType: string;
|
|
22
|
-
minimumSpend: number;
|
|
23
|
-
}
|
package/dist/models/Voucher.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Voucher = void 0;
|
|
13
|
-
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
-
const Guest_1 = require("./Guest");
|
|
15
|
-
let Voucher = class Voucher extends sequelize_typescript_1.Model {
|
|
16
|
-
};
|
|
17
|
-
exports.Voucher = Voucher;
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, sequelize_typescript_1.IsUUID)(4),
|
|
20
|
-
sequelize_typescript_1.PrimaryKey,
|
|
21
|
-
(0, sequelize_typescript_1.Column)({
|
|
22
|
-
type: sequelize_typescript_1.DataType.UUID,
|
|
23
|
-
defaultValue: sequelize_typescript_1.DataType.UUIDV4,
|
|
24
|
-
}),
|
|
25
|
-
__metadata("design:type", String)
|
|
26
|
-
], Voucher.prototype, "id", void 0);
|
|
27
|
-
__decorate([
|
|
28
|
-
(0, sequelize_typescript_1.ForeignKey)(() => Guest_1.Guest),
|
|
29
|
-
sequelize_typescript_1.Index,
|
|
30
|
-
(0, sequelize_typescript_1.Column)({
|
|
31
|
-
type: sequelize_typescript_1.DataType.UUID,
|
|
32
|
-
allowNull: false,
|
|
33
|
-
}),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], Voucher.prototype, "guestId", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, sequelize_typescript_1.Column)({
|
|
38
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
39
|
-
allowNull: false,
|
|
40
|
-
}),
|
|
41
|
-
__metadata("design:type", String)
|
|
42
|
-
], Voucher.prototype, "status", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
(0, sequelize_typescript_1.BelongsTo)(() => Guest_1.Guest, 'guestId'),
|
|
45
|
-
__metadata("design:type", Guest_1.Guest)
|
|
46
|
-
], Voucher.prototype, "guest", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, sequelize_typescript_1.Column)({
|
|
49
|
-
type: sequelize_typescript_1.DataType.DATE,
|
|
50
|
-
allowNull: false,
|
|
51
|
-
defaultValue: new Date(),
|
|
52
|
-
}),
|
|
53
|
-
__metadata("design:type", Date)
|
|
54
|
-
], Voucher.prototype, "createdAt", void 0);
|
|
55
|
-
__decorate([
|
|
56
|
-
(0, sequelize_typescript_1.Column)({
|
|
57
|
-
type: sequelize_typescript_1.DataType.DATE,
|
|
58
|
-
allowNull: false,
|
|
59
|
-
defaultValue: new Date(),
|
|
60
|
-
}),
|
|
61
|
-
__metadata("design:type", Date)
|
|
62
|
-
], Voucher.prototype, "updatedAt", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
sequelize_typescript_1.Index,
|
|
65
|
-
(0, sequelize_typescript_1.Column)({
|
|
66
|
-
type: sequelize_typescript_1.DataType.INTEGER,
|
|
67
|
-
allowNull: false,
|
|
68
|
-
}),
|
|
69
|
-
__metadata("design:type", Number)
|
|
70
|
-
], Voucher.prototype, "liteApiUserId", void 0);
|
|
71
|
-
__decorate([
|
|
72
|
-
(0, sequelize_typescript_1.Column)({
|
|
73
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
74
|
-
allowNull: false,
|
|
75
|
-
}),
|
|
76
|
-
__metadata("design:type", String)
|
|
77
|
-
], Voucher.prototype, "currency", void 0);
|
|
78
|
-
__decorate([
|
|
79
|
-
(0, sequelize_typescript_1.Column)({
|
|
80
|
-
type: sequelize_typescript_1.DataType.INTEGER,
|
|
81
|
-
allowNull: false,
|
|
82
|
-
}),
|
|
83
|
-
__metadata("design:type", Number)
|
|
84
|
-
], Voucher.prototype, "usagesLimit", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
(0, sequelize_typescript_1.Column)({
|
|
87
|
-
type: sequelize_typescript_1.DataType.INTEGER,
|
|
88
|
-
allowNull: true,
|
|
89
|
-
}),
|
|
90
|
-
__metadata("design:type", Number)
|
|
91
|
-
], Voucher.prototype, "remainingUses", void 0);
|
|
92
|
-
__decorate([
|
|
93
|
-
(0, sequelize_typescript_1.Column)({
|
|
94
|
-
type: sequelize_typescript_1.DataType.DATE,
|
|
95
|
-
allowNull: false,
|
|
96
|
-
}),
|
|
97
|
-
__metadata("design:type", Date)
|
|
98
|
-
], Voucher.prototype, "validityStart", void 0);
|
|
99
|
-
__decorate([
|
|
100
|
-
(0, sequelize_typescript_1.Column)({
|
|
101
|
-
type: sequelize_typescript_1.DataType.DATE,
|
|
102
|
-
allowNull: false,
|
|
103
|
-
}),
|
|
104
|
-
__metadata("design:type", Date)
|
|
105
|
-
], Voucher.prototype, "validityEnd", void 0);
|
|
106
|
-
__decorate([
|
|
107
|
-
sequelize_typescript_1.Index,
|
|
108
|
-
(0, sequelize_typescript_1.Column)({
|
|
109
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
110
|
-
allowNull: false,
|
|
111
|
-
}),
|
|
112
|
-
__metadata("design:type", String)
|
|
113
|
-
], Voucher.prototype, "voucherCode", void 0);
|
|
114
|
-
__decorate([
|
|
115
|
-
(0, sequelize_typescript_1.Column)({
|
|
116
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
117
|
-
allowNull: false,
|
|
118
|
-
}),
|
|
119
|
-
__metadata("design:type", String)
|
|
120
|
-
], Voucher.prototype, "discountType", void 0);
|
|
121
|
-
__decorate([
|
|
122
|
-
(0, sequelize_typescript_1.Column)({
|
|
123
|
-
type: sequelize_typescript_1.DataType.DECIMAL(10, 2),
|
|
124
|
-
allowNull: false,
|
|
125
|
-
}),
|
|
126
|
-
__metadata("design:type", Number)
|
|
127
|
-
], Voucher.prototype, "discountValue", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
(0, sequelize_typescript_1.Column)({
|
|
130
|
-
type: sequelize_typescript_1.DataType.DECIMAL(10, 2),
|
|
131
|
-
allowNull: true,
|
|
132
|
-
}),
|
|
133
|
-
__metadata("design:type", Number)
|
|
134
|
-
], Voucher.prototype, "maximumDiscountAmount", void 0);
|
|
135
|
-
__decorate([
|
|
136
|
-
(0, sequelize_typescript_1.Column)({
|
|
137
|
-
type: sequelize_typescript_1.DataType.TEXT,
|
|
138
|
-
allowNull: true,
|
|
139
|
-
}),
|
|
140
|
-
__metadata("design:type", String)
|
|
141
|
-
], Voucher.prototype, "termsAndConditions", void 0);
|
|
142
|
-
__decorate([
|
|
143
|
-
sequelize_typescript_1.Index,
|
|
144
|
-
(0, sequelize_typescript_1.Column)({
|
|
145
|
-
type: sequelize_typescript_1.DataType.STRING,
|
|
146
|
-
allowNull: false,
|
|
147
|
-
}),
|
|
148
|
-
__metadata("design:type", String)
|
|
149
|
-
], Voucher.prototype, "voucherType", void 0);
|
|
150
|
-
__decorate([
|
|
151
|
-
(0, sequelize_typescript_1.Column)({
|
|
152
|
-
type: sequelize_typescript_1.DataType.DECIMAL(10, 2),
|
|
153
|
-
allowNull: false,
|
|
154
|
-
defaultValue: 0,
|
|
155
|
-
}),
|
|
156
|
-
__metadata("design:type", Number)
|
|
157
|
-
], Voucher.prototype, "minimumSpend", void 0);
|
|
158
|
-
exports.Voucher = Voucher = __decorate([
|
|
159
|
-
(0, sequelize_typescript_1.Table)({
|
|
160
|
-
tableName: 'vouchers',
|
|
161
|
-
})
|
|
162
|
-
], Voucher);
|
|
File without changes
|