whitelabel-db 1.4.3 → 1.4.4
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/036-add-bookings-cancelled-at.d.ts +3 -0
- package/dist/migrations/036-add-bookings-cancelled-at.js +44 -0
- package/dist/migrations/036-add-flight-booking-email-sent-flags.d.ts +3 -0
- package/dist/migrations/036-add-flight-booking-email-sent-flags.js +46 -0
- package/dist/models/Booking.d.ts +1 -0
- package/dist/models/Booking.js +7 -0
- package/dist/models/FlightBooking.d.ts +2 -0
- package/dist/models/FlightBooking.js +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
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 cancelledAt column to bookings table.
|
|
14
|
+
const sequelize_1 = require("sequelize");
|
|
15
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
const tableDescription = yield queryInterface.describeTable('bookings');
|
|
18
|
+
const existingColumns = Object.keys(tableDescription);
|
|
19
|
+
if (existingColumns.includes('cancelledAt')) {
|
|
20
|
+
console.log('cancelledAt column already exists, skipping migration.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
yield queryInterface.addColumn('bookings', 'cancelledAt', {
|
|
24
|
+
type: sequelize_1.DataTypes.DATE,
|
|
25
|
+
allowNull: true,
|
|
26
|
+
});
|
|
27
|
+
console.log('cancelledAt column added successfully.');
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error('Error while adding cancelledAt column:', error.message);
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
exports.up = up;
|
|
35
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
yield queryInterface.removeColumn('bookings', 'cancelledAt');
|
|
38
|
+
console.log('cancelledAt column removed successfully.');
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error('Error while removing cancelledAt column:', error.message);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
exports.down = down;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 TABLE_NAME = 'flight_bookings';
|
|
15
|
+
const TICKETED_EMAIL_SENT_COLUMN = 'ticketedEmailSent';
|
|
16
|
+
const CANCELLED_EMAIL_SENT_COLUMN = 'cancelledEmailSent';
|
|
17
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const tableDescription = yield queryInterface.describeTable(TABLE_NAME);
|
|
19
|
+
const existingColumns = Object.keys(tableDescription);
|
|
20
|
+
if (!existingColumns.includes(TICKETED_EMAIL_SENT_COLUMN)) {
|
|
21
|
+
yield queryInterface.addColumn(TABLE_NAME, TICKETED_EMAIL_SENT_COLUMN, {
|
|
22
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
23
|
+
allowNull: false,
|
|
24
|
+
defaultValue: false,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (!existingColumns.includes(CANCELLED_EMAIL_SENT_COLUMN)) {
|
|
28
|
+
yield queryInterface.addColumn(TABLE_NAME, CANCELLED_EMAIL_SENT_COLUMN, {
|
|
29
|
+
type: sequelize_1.DataTypes.BOOLEAN,
|
|
30
|
+
allowNull: false,
|
|
31
|
+
defaultValue: false,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
exports.up = up;
|
|
36
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
const tableDescription = yield queryInterface.describeTable(TABLE_NAME);
|
|
38
|
+
const existingColumns = Object.keys(tableDescription);
|
|
39
|
+
if (existingColumns.includes(TICKETED_EMAIL_SENT_COLUMN)) {
|
|
40
|
+
yield queryInterface.removeColumn(TABLE_NAME, TICKETED_EMAIL_SENT_COLUMN);
|
|
41
|
+
}
|
|
42
|
+
if (existingColumns.includes(CANCELLED_EMAIL_SENT_COLUMN)) {
|
|
43
|
+
yield queryInterface.removeColumn(TABLE_NAME, CANCELLED_EMAIL_SENT_COLUMN);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
exports.down = down;
|
package/dist/models/Booking.d.ts
CHANGED
package/dist/models/Booking.js
CHANGED
|
@@ -170,6 +170,13 @@ __decorate([
|
|
|
170
170
|
}),
|
|
171
171
|
__metadata("design:type", Date)
|
|
172
172
|
], Booking.prototype, "lastCancellationDate", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
(0, sequelize_typescript_1.Column)({
|
|
175
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
176
|
+
allowNull: true,
|
|
177
|
+
}),
|
|
178
|
+
__metadata("design:type", Date)
|
|
179
|
+
], Booking.prototype, "cancelledAt", void 0);
|
|
173
180
|
__decorate([
|
|
174
181
|
(0, sequelize_typescript_1.Column)({
|
|
175
182
|
type: sequelize_typescript_1.DataType.STRING,
|
|
@@ -44,6 +44,22 @@ __decorate([
|
|
|
44
44
|
(0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project),
|
|
45
45
|
__metadata("design:type", Project_1.Project)
|
|
46
46
|
], FlightBooking.prototype, "project", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, sequelize_typescript_1.Column)({
|
|
49
|
+
type: sequelize_typescript_1.DataType.BOOLEAN,
|
|
50
|
+
allowNull: false,
|
|
51
|
+
defaultValue: false,
|
|
52
|
+
}),
|
|
53
|
+
__metadata("design:type", Boolean)
|
|
54
|
+
], FlightBooking.prototype, "ticketedEmailSent", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, sequelize_typescript_1.Column)({
|
|
57
|
+
type: sequelize_typescript_1.DataType.BOOLEAN,
|
|
58
|
+
allowNull: false,
|
|
59
|
+
defaultValue: false,
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:type", Boolean)
|
|
62
|
+
], FlightBooking.prototype, "cancelledEmailSent", void 0);
|
|
47
63
|
__decorate([
|
|
48
64
|
(0, sequelize_typescript_1.Column)({
|
|
49
65
|
type: sequelize_typescript_1.DataType.DATE,
|