whitelabel-db 1.4.2 → 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.
@@ -0,0 +1,3 @@
1
+ import { QueryInterface } from 'sequelize';
2
+ export declare const up: (queryInterface: QueryInterface) => Promise<void>;
3
+ export declare const down: (queryInterface: QueryInterface) => Promise<void>;
@@ -0,0 +1,58 @@
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 customCss and customJs columns to projects 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('projects');
18
+ const existingColumns = Object.keys(tableDescription);
19
+ if (!existingColumns.includes('customCss')) {
20
+ yield queryInterface.addColumn('projects', 'customCss', {
21
+ type: sequelize_1.DataTypes.TEXT,
22
+ allowNull: true,
23
+ });
24
+ console.log('customCss column added successfully.');
25
+ }
26
+ else {
27
+ console.log('customCss column already exists, skipping.');
28
+ }
29
+ if (!existingColumns.includes('customJs')) {
30
+ yield queryInterface.addColumn('projects', 'customJs', {
31
+ type: sequelize_1.DataTypes.TEXT,
32
+ allowNull: true,
33
+ });
34
+ console.log('customJs column added successfully.');
35
+ }
36
+ else {
37
+ console.log('customJs column already exists, skipping.');
38
+ }
39
+ console.log('customCss and customJs columns added to projects table successfully.');
40
+ }
41
+ catch (error) {
42
+ console.error('Error while adding customCss and customJs columns:', error.message);
43
+ throw error;
44
+ }
45
+ });
46
+ exports.up = up;
47
+ const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
48
+ try {
49
+ yield queryInterface.removeColumn('projects', 'customCss');
50
+ yield queryInterface.removeColumn('projects', 'customJs');
51
+ console.log('customCss and customJs columns removed from projects table successfully.');
52
+ }
53
+ catch (error) {
54
+ console.error('Error while removing customCss and customJs columns:', error.message);
55
+ throw error;
56
+ }
57
+ });
58
+ exports.down = down;
@@ -0,0 +1,3 @@
1
+ import { QueryInterface } from 'sequelize';
2
+ export declare const up: (queryInterface: QueryInterface) => Promise<void>;
3
+ export declare const down: (queryInterface: QueryInterface) => Promise<void>;
@@ -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,3 @@
1
+ import { QueryInterface } from 'sequelize';
2
+ export declare const up: (queryInterface: QueryInterface) => Promise<void>;
3
+ export declare const down: (queryInterface: QueryInterface) => Promise<void>;
@@ -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;
@@ -23,6 +23,7 @@ export declare class Booking extends Model<Partial<Booking>> {
23
23
  otpExpiresAt?: Date;
24
24
  cancellationType?: string;
25
25
  lastCancellationDate?: Date;
26
+ cancelledAt?: Date;
26
27
  paymentMethod?: string;
27
28
  refundStatus?: string;
28
29
  source?: string;
@@ -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,
@@ -5,6 +5,8 @@ export declare class FlightBooking extends Model<Partial<FlightBooking>> {
5
5
  bookingId: string;
6
6
  projectId: string;
7
7
  project?: Project;
8
+ ticketedEmailSent: boolean;
9
+ cancelledEmailSent: boolean;
8
10
  createdAt: Date;
9
11
  updatedAt: Date;
10
12
  }
@@ -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,
@@ -26,6 +26,8 @@ export declare class Project extends Model<Partial<Project>> {
26
26
  preferences?: object;
27
27
  appearance?: object;
28
28
  isActive?: boolean;
29
+ customCss?: string;
30
+ customJs?: string;
29
31
  generateSession(secret: string): string;
30
32
  getLiteApiClient(): LiteApiClient;
31
33
  getLiteApiClientV3(): LiteApiClientV3;
@@ -188,6 +188,20 @@ __decorate([
188
188
  }),
189
189
  __metadata("design:type", Boolean)
190
190
  ], Project.prototype, "isActive", void 0);
191
+ __decorate([
192
+ (0, sequelize_typescript_1.Column)({
193
+ type: sequelize_typescript_1.DataType.TEXT,
194
+ allowNull: true,
195
+ }),
196
+ __metadata("design:type", String)
197
+ ], Project.prototype, "customCss", void 0);
198
+ __decorate([
199
+ (0, sequelize_typescript_1.Column)({
200
+ type: sequelize_typescript_1.DataType.TEXT,
201
+ allowNull: true,
202
+ }),
203
+ __metadata("design:type", String)
204
+ ], Project.prototype, "customJs", void 0);
191
205
  exports.Project = Project = __decorate([
192
206
  (0, sequelize_typescript_1.Table)({
193
207
  tableName: 'projects',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",