whitelabel-db 1.1.81 → 1.1.82

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,48 @@
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 paymentMethod and refundStatus columns to bookings table.
14
+ const sequelize_1 = require("sequelize");
15
+ const columns = [
16
+ { name: 'paymentMethod', type: sequelize_1.DataTypes.STRING, allowNull: true },
17
+ { name: 'paymentProvider', type: sequelize_1.DataTypes.STRING, allowNull: true },
18
+ { name: 'refundStatus', type: sequelize_1.DataTypes.STRING, allowNull: true },
19
+ ];
20
+ const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
21
+ try {
22
+ // Add all columns in parallel
23
+ yield Promise.all(columns.map((column) => queryInterface.addColumn('bookings', column.name, {
24
+ type: column.type,
25
+ allowNull: column.allowNull,
26
+ })));
27
+ console.log('All columns added successfully.');
28
+ console.log('All columns added successfully.');
29
+ }
30
+ catch (error) {
31
+ console.error('Error while adding columns:', error.message);
32
+ }
33
+ });
34
+ exports.up = up;
35
+ const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
36
+ try {
37
+ // Remove columns
38
+ for (const column of columns.reverse()) {
39
+ console.log(`Removing column: ${column.name}`);
40
+ yield queryInterface.removeColumn('bookings', column.name);
41
+ }
42
+ console.log('All columns removed successfully.');
43
+ }
44
+ catch (error) {
45
+ console.error('Error while removing columns:', error.message);
46
+ }
47
+ });
48
+ exports.down = down;
@@ -22,4 +22,7 @@ export declare class Booking extends Model<Partial<Booking>> {
22
22
  otpExpiresAt?: Date;
23
23
  cancellationType?: string;
24
24
  lastCancellationDate?: Date;
25
+ paymentMethod?: string;
26
+ refundStatus?: string;
27
+ paymentProvider?: string;
25
28
  }
@@ -162,6 +162,27 @@ __decorate([
162
162
  }),
163
163
  __metadata("design:type", Date)
164
164
  ], Booking.prototype, "lastCancellationDate", void 0);
165
+ __decorate([
166
+ (0, sequelize_typescript_1.Column)({
167
+ type: sequelize_typescript_1.DataType.STRING,
168
+ allowNull: true,
169
+ }),
170
+ __metadata("design:type", String)
171
+ ], Booking.prototype, "paymentMethod", void 0);
172
+ __decorate([
173
+ (0, sequelize_typescript_1.Column)({
174
+ type: sequelize_typescript_1.DataType.STRING,
175
+ allowNull: true,
176
+ }),
177
+ __metadata("design:type", String)
178
+ ], Booking.prototype, "refundStatus", void 0);
179
+ __decorate([
180
+ (0, sequelize_typescript_1.Column)({
181
+ type: sequelize_typescript_1.DataType.STRING,
182
+ allowNull: true,
183
+ }),
184
+ __metadata("design:type", String)
185
+ ], Booking.prototype, "paymentProvider", void 0);
165
186
  exports.Booking = Booking = __decorate([
166
187
  (0, sequelize_typescript_1.Table)({
167
188
  tableName: 'bookings',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.1.81",
3
+ "version": "1.1.82",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",