whitelabel-db 1.1.92 → 1.1.94

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/index.d.ts CHANGED
@@ -21,6 +21,10 @@ export { FacilityTranslation } from './models/FacilityTranslation';
21
21
  export { Amenity } from './models/Amenity';
22
22
  export { RoomAmenity } from './models/RoomAmenity';
23
23
  export { AmenityTranslation } from './models/AmenityTranslation';
24
+ export { Creator } from './models/Creator';
25
+ export { Collection, CollectionStatus } from './models/Collection';
26
+ export { CollectionItem, CollectionType } from './models/CollectionItem';
27
+ export { CollectionItemCustomField } from './models/CollectionItemCustomField';
24
28
  export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
25
29
  export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, PromoCodeRequest, PromoCodeResponse, EsimplyPackage, Addon, AddonResponse, } from './libs/liteapiv3';
26
30
  export { LiteApiUser, LiteApiUserRequest } from './libs/liteapiuser';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LiteApiUser = exports.LiteApiClientV3 = exports.LiteApiClient = exports.AmenityTranslation = exports.RoomAmenity = exports.Amenity = exports.FacilityTranslation = exports.HotelFacility = exports.Facility = exports.AnalyticsSummary = exports.HotelRate = exports.Feedback = exports.Referral = exports.HotelAccessibility = exports.Guest = exports.HotelTranslation = exports.Role = exports.Booking = exports.Project = exports.User = exports.Hotel = exports.Country = exports.City = exports.Agency = exports.runMigrations = exports.connect = void 0;
3
+ exports.LiteApiUser = exports.LiteApiClientV3 = exports.LiteApiClient = exports.CollectionItemCustomField = exports.CollectionType = exports.CollectionItem = exports.CollectionStatus = exports.Collection = exports.Creator = exports.AmenityTranslation = exports.RoomAmenity = exports.Amenity = exports.FacilityTranslation = exports.HotelFacility = exports.Facility = exports.AnalyticsSummary = exports.HotelRate = exports.Feedback = exports.Referral = exports.HotelAccessibility = exports.Guest = exports.HotelTranslation = exports.Role = exports.Booking = exports.Project = exports.User = exports.Hotel = exports.Country = exports.City = exports.Agency = exports.runMigrations = exports.connect = void 0;
4
4
  var database_1 = require("./libs/database");
5
5
  Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return database_1.connect; } });
6
6
  var migration_1 = require("./libs/migration");
@@ -48,6 +48,17 @@ var RoomAmenity_1 = require("./models/RoomAmenity");
48
48
  Object.defineProperty(exports, "RoomAmenity", { enumerable: true, get: function () { return RoomAmenity_1.RoomAmenity; } });
49
49
  var AmenityTranslation_1 = require("./models/AmenityTranslation");
50
50
  Object.defineProperty(exports, "AmenityTranslation", { enumerable: true, get: function () { return AmenityTranslation_1.AmenityTranslation; } });
51
+ // Collection and Creator models
52
+ var Creator_1 = require("./models/Creator");
53
+ Object.defineProperty(exports, "Creator", { enumerable: true, get: function () { return Creator_1.Creator; } });
54
+ var Collection_1 = require("./models/Collection");
55
+ Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return Collection_1.Collection; } });
56
+ Object.defineProperty(exports, "CollectionStatus", { enumerable: true, get: function () { return Collection_1.CollectionStatus; } });
57
+ var CollectionItem_1 = require("./models/CollectionItem");
58
+ Object.defineProperty(exports, "CollectionItem", { enumerable: true, get: function () { return CollectionItem_1.CollectionItem; } });
59
+ Object.defineProperty(exports, "CollectionType", { enumerable: true, get: function () { return CollectionItem_1.CollectionType; } });
60
+ var CollectionItemCustomField_1 = require("./models/CollectionItemCustomField");
61
+ Object.defineProperty(exports, "CollectionItemCustomField", { enumerable: true, get: function () { return CollectionItemCustomField_1.CollectionItemCustomField; } });
51
62
  var liteapi_1 = require("./libs/liteapi");
52
63
  Object.defineProperty(exports, "LiteApiClient", { enumerable: true, get: function () { return liteapi_1.LiteApiClient; } });
53
64
  var liteapiv3_1 = require("./libs/liteapiv3");
@@ -5,4 +5,4 @@ export interface ConnectionDetails {
5
5
  password: string;
6
6
  dbname: string;
7
7
  }
8
- export declare const connect: (connectionDetails: ConnectionDetails) => Promise<void | Sequelize>;
8
+ export declare const connect: (connectionDetails: ConnectionDetails) => Promise<Sequelize>;
@@ -32,6 +32,10 @@ const Amenity_1 = require("../models/Amenity");
32
32
  const RoomAmenity_1 = require("../models/RoomAmenity");
33
33
  const AmenityTranslation_1 = require("../models/AmenityTranslation");
34
34
  const AnalyticsSummary_1 = require("../models/AnalyticsSummary");
35
+ const Creator_1 = require("../models/Creator");
36
+ const Collection_1 = require("../models/Collection");
37
+ const CollectionItem_1 = require("../models/CollectionItem");
38
+ const CollectionItemCustomField_1 = require("../models/CollectionItemCustomField");
35
39
  const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, function* () {
36
40
  const connection = new sequelize_typescript_1.Sequelize({
37
41
  dialect: 'postgres',
@@ -62,16 +66,23 @@ const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, functio
62
66
  RoomAmenity_1.RoomAmenity,
63
67
  AmenityTranslation_1.AmenityTranslation,
64
68
  AnalyticsSummary_1.AnalyticsSummary,
69
+ Creator_1.Creator,
70
+ Collection_1.Collection,
71
+ CollectionItem_1.CollectionItem,
72
+ CollectionItemCustomField_1.CollectionItemCustomField,
65
73
  ],
66
74
  });
67
- return connection
68
- .authenticate()
69
- .then(() => {
75
+ try {
76
+ yield connection.authenticate();
70
77
  console.log('Database connection has been established successfully.');
71
- return connection.sync();
72
- })
73
- .catch((err) => {
78
+ // Ensure sync completes and creates necessary tables including SequelizeMeta
79
+ yield connection.sync({ alter: false });
80
+ console.log('Database sync completed successfully.');
81
+ return connection;
82
+ }
83
+ catch (err) {
74
84
  console.error('Unable to connect to the database:', err);
75
- });
85
+ throw err;
86
+ }
76
87
  });
77
88
  exports.connect = connect;
@@ -44,14 +44,37 @@ const runMigrations = (sequelize) => __awaiter(void 0, void 0, void 0, function*
44
44
  console.error(`Migrations directory not found at: ${migrationsPath}`);
45
45
  return;
46
46
  }
47
+ // Ensure SequelizeMeta table exists - this handles cases where sync() didn't create it
48
+ try {
49
+ yield sequelize.query(`
50
+ CREATE TABLE IF NOT EXISTS "SequelizeMeta" (
51
+ "name" VARCHAR(255) NOT NULL,
52
+ PRIMARY KEY ("name")
53
+ );
54
+ `);
55
+ console.log('SequelizeMeta table ensured to exist');
56
+ }
57
+ catch (error) {
58
+ console.error('Error creating SequelizeMeta table:', error);
59
+ throw error;
60
+ }
47
61
  // Read and sort migration files
48
62
  const migrationFiles = fs_1.default
49
63
  .readdirSync(migrationsPath)
50
64
  .filter((file) => file.match(/^\d{3}-.+\.ts$/) || file.match(/^\d{3}-.+\.js$/)) // Matches .ts and .js files
51
65
  .filter((file) => !file.endsWith('.d.ts')) // Exclude .d.ts files
52
66
  .sort(); // Sort files by name
53
- const [results] = yield sequelize.query('SELECT name FROM "SequelizeMeta"');
54
- const executedMigrations = results.map((row) => row.name);
67
+ // Get executed migrations - now this should always work since we ensured the table exists
68
+ let executedMigrations = [];
69
+ try {
70
+ const [results] = yield sequelize.query('SELECT name FROM "SequelizeMeta"');
71
+ executedMigrations = results.map((row) => row.name);
72
+ console.log(`Found ${executedMigrations.length} previously executed migrations`);
73
+ }
74
+ catch (error) {
75
+ console.error('Unexpected error fetching executed migrations:', error);
76
+ throw error;
77
+ }
55
78
  for (const file of migrationFiles) {
56
79
  if (!executedMigrations.includes(file)) {
57
80
  const migration = yield Promise.resolve(`${path_1.default.join(migrationsPath, file)}`).then(s => __importStar(require(s)));
@@ -59,10 +82,11 @@ const runMigrations = (sequelize) => __awaiter(void 0, void 0, void 0, function*
59
82
  console.log(`Running migration: ${file}`);
60
83
  yield migration.up(sequelize.getQueryInterface());
61
84
  yield sequelize.query(`INSERT INTO "SequelizeMeta" (name) VALUES ('${file}')`);
85
+ console.log(`Completed migration: ${file}`);
62
86
  }
63
87
  }
64
88
  else {
65
- console.log(`Skipping migration: ${file}`);
89
+ console.log(`Skipping migration: ${file} (already executed)`);
66
90
  }
67
91
  }
68
92
  console.log('Migrations completed.');
@@ -0,0 +1,19 @@
1
+ import { Model } from 'sequelize-typescript';
2
+ import { Project } from './Project';
3
+ import { CollectionItem } from './CollectionItem';
4
+ export declare enum CollectionStatus {
5
+ PUBLISHED = "published",
6
+ UNPUBLISHED = "unpublished",
7
+ ARCHIVED = "archived",
8
+ DELETED = "deleted"
9
+ }
10
+ export declare class Collection extends Model<Partial<Collection>> {
11
+ id: string;
12
+ projectId: string;
13
+ project?: Project;
14
+ title: string;
15
+ status: CollectionStatus;
16
+ items?: CollectionItem[];
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ }
@@ -0,0 +1,90 @@
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.Collection = exports.CollectionStatus = void 0;
13
+ const sequelize_typescript_1 = require("sequelize-typescript");
14
+ const Project_1 = require("./Project");
15
+ const CollectionItem_1 = require("./CollectionItem");
16
+ var CollectionStatus;
17
+ (function (CollectionStatus) {
18
+ CollectionStatus["PUBLISHED"] = "published";
19
+ CollectionStatus["UNPUBLISHED"] = "unpublished";
20
+ CollectionStatus["ARCHIVED"] = "archived";
21
+ CollectionStatus["DELETED"] = "deleted";
22
+ })(CollectionStatus || (exports.CollectionStatus = CollectionStatus = {}));
23
+ let Collection = class Collection extends sequelize_typescript_1.Model {
24
+ };
25
+ exports.Collection = Collection;
26
+ __decorate([
27
+ (0, sequelize_typescript_1.IsUUID)(4),
28
+ sequelize_typescript_1.PrimaryKey,
29
+ (0, sequelize_typescript_1.Column)({
30
+ type: sequelize_typescript_1.DataType.UUID,
31
+ defaultValue: sequelize_typescript_1.DataType.UUIDV4,
32
+ }),
33
+ __metadata("design:type", String)
34
+ ], Collection.prototype, "id", void 0);
35
+ __decorate([
36
+ (0, sequelize_typescript_1.ForeignKey)(() => Project_1.Project),
37
+ sequelize_typescript_1.Index,
38
+ (0, sequelize_typescript_1.Column)({
39
+ type: sequelize_typescript_1.DataType.UUID,
40
+ allowNull: false,
41
+ }),
42
+ __metadata("design:type", String)
43
+ ], Collection.prototype, "projectId", void 0);
44
+ __decorate([
45
+ (0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project),
46
+ __metadata("design:type", Project_1.Project)
47
+ ], Collection.prototype, "project", void 0);
48
+ __decorate([
49
+ (0, sequelize_typescript_1.Column)({
50
+ type: sequelize_typescript_1.DataType.TEXT,
51
+ allowNull: false,
52
+ }),
53
+ __metadata("design:type", String)
54
+ ], Collection.prototype, "title", void 0);
55
+ __decorate([
56
+ sequelize_typescript_1.Index,
57
+ (0, sequelize_typescript_1.Column)({
58
+ type: sequelize_typescript_1.DataType.TEXT,
59
+ allowNull: false,
60
+ validate: {
61
+ isIn: [Object.values(CollectionStatus)],
62
+ },
63
+ }),
64
+ __metadata("design:type", String)
65
+ ], Collection.prototype, "status", void 0);
66
+ __decorate([
67
+ (0, sequelize_typescript_1.HasMany)(() => CollectionItem_1.CollectionItem),
68
+ __metadata("design:type", Array)
69
+ ], Collection.prototype, "items", void 0);
70
+ __decorate([
71
+ (0, sequelize_typescript_1.Column)({
72
+ type: sequelize_typescript_1.DataType.DATE,
73
+ allowNull: false,
74
+ defaultValue: sequelize_typescript_1.DataType.NOW,
75
+ }),
76
+ __metadata("design:type", Date)
77
+ ], Collection.prototype, "createdAt", void 0);
78
+ __decorate([
79
+ (0, sequelize_typescript_1.Column)({
80
+ type: sequelize_typescript_1.DataType.DATE,
81
+ allowNull: false,
82
+ defaultValue: sequelize_typescript_1.DataType.NOW,
83
+ }),
84
+ __metadata("design:type", Date)
85
+ ], Collection.prototype, "updatedAt", void 0);
86
+ exports.Collection = Collection = __decorate([
87
+ (0, sequelize_typescript_1.Table)({
88
+ tableName: 'collections',
89
+ })
90
+ ], Collection);
@@ -0,0 +1,18 @@
1
+ import { Model } from 'sequelize-typescript';
2
+ import { Collection } from './Collection';
3
+ import { CollectionItemCustomField } from './CollectionItemCustomField';
4
+ export declare enum CollectionType {
5
+ PROPERTY = "property",
6
+ CITY = "city",
7
+ COUNTRY = "country"
8
+ }
9
+ export declare class CollectionItem extends Model<Partial<CollectionItem>> {
10
+ id: string;
11
+ collectionId: string;
12
+ collection?: Collection;
13
+ item: string;
14
+ type: CollectionType;
15
+ order: number;
16
+ customFields?: CollectionItemCustomField[];
17
+ createdAt: Date;
18
+ }
@@ -0,0 +1,84 @@
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.CollectionItem = exports.CollectionType = void 0;
13
+ const sequelize_typescript_1 = require("sequelize-typescript");
14
+ const Collection_1 = require("./Collection");
15
+ const CollectionItemCustomField_1 = require("./CollectionItemCustomField");
16
+ var CollectionType;
17
+ (function (CollectionType) {
18
+ CollectionType["PROPERTY"] = "property";
19
+ CollectionType["CITY"] = "city";
20
+ CollectionType["COUNTRY"] = "country";
21
+ })(CollectionType || (exports.CollectionType = CollectionType = {}));
22
+ let CollectionItem = class CollectionItem extends sequelize_typescript_1.Model {
23
+ };
24
+ exports.CollectionItem = CollectionItem;
25
+ __decorate([
26
+ (0, sequelize_typescript_1.IsUUID)(4),
27
+ sequelize_typescript_1.PrimaryKey,
28
+ (0, sequelize_typescript_1.Column)({
29
+ type: sequelize_typescript_1.DataType.UUID,
30
+ defaultValue: sequelize_typescript_1.DataType.UUIDV4,
31
+ }),
32
+ __metadata("design:type", String)
33
+ ], CollectionItem.prototype, "id", void 0);
34
+ __decorate([
35
+ (0, sequelize_typescript_1.ForeignKey)(() => Collection_1.Collection),
36
+ sequelize_typescript_1.Index,
37
+ (0, sequelize_typescript_1.Column)({
38
+ type: sequelize_typescript_1.DataType.UUID,
39
+ allowNull: false,
40
+ }),
41
+ __metadata("design:type", String)
42
+ ], CollectionItem.prototype, "collectionId", void 0);
43
+ __decorate([
44
+ (0, sequelize_typescript_1.BelongsTo)(() => Collection_1.Collection),
45
+ __metadata("design:type", Collection_1.Collection)
46
+ ], CollectionItem.prototype, "collection", void 0);
47
+ __decorate([
48
+ (0, sequelize_typescript_1.Column)({
49
+ type: sequelize_typescript_1.DataType.TEXT,
50
+ allowNull: false,
51
+ }),
52
+ __metadata("design:type", String)
53
+ ], CollectionItem.prototype, "item", void 0);
54
+ __decorate([
55
+ (0, sequelize_typescript_1.Column)({
56
+ type: sequelize_typescript_1.DataType.TEXT,
57
+ allowNull: false,
58
+ }),
59
+ __metadata("design:type", String)
60
+ ], CollectionItem.prototype, "type", void 0);
61
+ __decorate([
62
+ (0, sequelize_typescript_1.Column)({
63
+ type: sequelize_typescript_1.DataType.INTEGER,
64
+ allowNull: false,
65
+ }),
66
+ __metadata("design:type", Number)
67
+ ], CollectionItem.prototype, "order", void 0);
68
+ __decorate([
69
+ (0, sequelize_typescript_1.HasMany)(() => CollectionItemCustomField_1.CollectionItemCustomField),
70
+ __metadata("design:type", Array)
71
+ ], CollectionItem.prototype, "customFields", void 0);
72
+ __decorate([
73
+ (0, sequelize_typescript_1.Column)({
74
+ type: sequelize_typescript_1.DataType.DATE,
75
+ allowNull: false,
76
+ defaultValue: sequelize_typescript_1.DataType.NOW,
77
+ }),
78
+ __metadata("design:type", Date)
79
+ ], CollectionItem.prototype, "createdAt", void 0);
80
+ exports.CollectionItem = CollectionItem = __decorate([
81
+ (0, sequelize_typescript_1.Table)({
82
+ tableName: 'collection_items',
83
+ })
84
+ ], CollectionItem);
@@ -0,0 +1,10 @@
1
+ import { Model } from 'sequelize-typescript';
2
+ import { CollectionItem } from './CollectionItem';
3
+ export declare class CollectionItemCustomField extends Model<Partial<CollectionItemCustomField>> {
4
+ id: string;
5
+ collectionItemId: string;
6
+ collectionItem?: CollectionItem;
7
+ key: string;
8
+ value: string;
9
+ createdAt: Date;
10
+ }
@@ -0,0 +1,67 @@
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.CollectionItemCustomField = void 0;
13
+ const sequelize_typescript_1 = require("sequelize-typescript");
14
+ const CollectionItem_1 = require("./CollectionItem");
15
+ let CollectionItemCustomField = class CollectionItemCustomField extends sequelize_typescript_1.Model {
16
+ };
17
+ exports.CollectionItemCustomField = CollectionItemCustomField;
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
+ ], CollectionItemCustomField.prototype, "id", void 0);
27
+ __decorate([
28
+ (0, sequelize_typescript_1.ForeignKey)(() => CollectionItem_1.CollectionItem),
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
+ ], CollectionItemCustomField.prototype, "collectionItemId", void 0);
36
+ __decorate([
37
+ (0, sequelize_typescript_1.BelongsTo)(() => CollectionItem_1.CollectionItem),
38
+ __metadata("design:type", CollectionItem_1.CollectionItem)
39
+ ], CollectionItemCustomField.prototype, "collectionItem", void 0);
40
+ __decorate([
41
+ sequelize_typescript_1.Index,
42
+ (0, sequelize_typescript_1.Column)({
43
+ type: sequelize_typescript_1.DataType.TEXT,
44
+ allowNull: false,
45
+ }),
46
+ __metadata("design:type", String)
47
+ ], CollectionItemCustomField.prototype, "key", void 0);
48
+ __decorate([
49
+ (0, sequelize_typescript_1.Column)({
50
+ type: sequelize_typescript_1.DataType.TEXT,
51
+ allowNull: false,
52
+ }),
53
+ __metadata("design:type", String)
54
+ ], CollectionItemCustomField.prototype, "value", void 0);
55
+ __decorate([
56
+ (0, sequelize_typescript_1.Column)({
57
+ type: sequelize_typescript_1.DataType.DATE,
58
+ allowNull: false,
59
+ defaultValue: sequelize_typescript_1.DataType.NOW,
60
+ }),
61
+ __metadata("design:type", Date)
62
+ ], CollectionItemCustomField.prototype, "createdAt", void 0);
63
+ exports.CollectionItemCustomField = CollectionItemCustomField = __decorate([
64
+ (0, sequelize_typescript_1.Table)({
65
+ tableName: 'collection_item_custom_fields',
66
+ })
67
+ ], CollectionItemCustomField);
@@ -0,0 +1,12 @@
1
+ import { Model } from 'sequelize-typescript';
2
+ import { Project } from './Project';
3
+ export declare class Creator extends Model<Partial<Creator>> {
4
+ id: string;
5
+ projectId: string;
6
+ project?: Project;
7
+ name: string;
8
+ profileImage?: string;
9
+ coverImage?: string;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ }
@@ -0,0 +1,82 @@
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.Creator = void 0;
13
+ const sequelize_typescript_1 = require("sequelize-typescript");
14
+ const Project_1 = require("./Project");
15
+ let Creator = class Creator extends sequelize_typescript_1.Model {
16
+ };
17
+ exports.Creator = Creator;
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
+ ], Creator.prototype, "id", void 0);
27
+ __decorate([
28
+ (0, sequelize_typescript_1.ForeignKey)(() => Project_1.Project),
29
+ sequelize_typescript_1.Unique,
30
+ sequelize_typescript_1.Index,
31
+ (0, sequelize_typescript_1.Column)({
32
+ type: sequelize_typescript_1.DataType.UUID,
33
+ allowNull: false,
34
+ }),
35
+ __metadata("design:type", String)
36
+ ], Creator.prototype, "projectId", void 0);
37
+ __decorate([
38
+ (0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project),
39
+ __metadata("design:type", Project_1.Project)
40
+ ], Creator.prototype, "project", void 0);
41
+ __decorate([
42
+ (0, sequelize_typescript_1.Column)({
43
+ type: sequelize_typescript_1.DataType.TEXT,
44
+ allowNull: false,
45
+ }),
46
+ __metadata("design:type", String)
47
+ ], Creator.prototype, "name", void 0);
48
+ __decorate([
49
+ (0, sequelize_typescript_1.Column)({
50
+ type: sequelize_typescript_1.DataType.TEXT,
51
+ allowNull: true,
52
+ }),
53
+ __metadata("design:type", String)
54
+ ], Creator.prototype, "profileImage", void 0);
55
+ __decorate([
56
+ (0, sequelize_typescript_1.Column)({
57
+ type: sequelize_typescript_1.DataType.TEXT,
58
+ allowNull: true,
59
+ }),
60
+ __metadata("design:type", String)
61
+ ], Creator.prototype, "coverImage", void 0);
62
+ __decorate([
63
+ (0, sequelize_typescript_1.Column)({
64
+ type: sequelize_typescript_1.DataType.DATE,
65
+ allowNull: false,
66
+ defaultValue: sequelize_typescript_1.DataType.NOW,
67
+ }),
68
+ __metadata("design:type", Date)
69
+ ], Creator.prototype, "createdAt", void 0);
70
+ __decorate([
71
+ (0, sequelize_typescript_1.Column)({
72
+ type: sequelize_typescript_1.DataType.DATE,
73
+ allowNull: false,
74
+ defaultValue: sequelize_typescript_1.DataType.NOW,
75
+ }),
76
+ __metadata("design:type", Date)
77
+ ], Creator.prototype, "updatedAt", void 0);
78
+ exports.Creator = Creator = __decorate([
79
+ (0, sequelize_typescript_1.Table)({
80
+ tableName: 'creators',
81
+ })
82
+ ], Creator);
@@ -3,6 +3,8 @@ import { Agency } from './Agency';
3
3
  import { LiteApiClient } from '../libs/liteapi';
4
4
  import { LiteApiClientV3 } from '../libs/liteapiv3';
5
5
  import { Booking } from './Booking';
6
+ import { Creator } from './Creator';
7
+ import { Collection } from './Collection';
6
8
  export declare class Project extends Model<Partial<Project>> {
7
9
  id: string;
8
10
  name: string;
@@ -14,6 +16,8 @@ export declare class Project extends Model<Partial<Project>> {
14
16
  agencyId?: string;
15
17
  agency?: Agency;
16
18
  bookings?: Booking[];
19
+ creators?: Creator[];
20
+ collections?: Collection[];
17
21
  preferences?: object;
18
22
  appearance?: object;
19
23
  isActive?: boolean;
@@ -19,6 +19,8 @@ const Agency_1 = require("./Agency");
19
19
  const liteapi_1 = require("../libs/liteapi");
20
20
  const liteapiv3_1 = require("../libs/liteapiv3");
21
21
  const Booking_1 = require("./Booking");
22
+ const Creator_1 = require("./Creator");
23
+ const Collection_1 = require("./Collection");
22
24
  const clients = {};
23
25
  const clientV3 = {};
24
26
  const defaultLiteApiEnvironment = process.env.COPILOT_ENVIRONMENT_NAME === 'production' ? 'production' : 'dev';
@@ -137,6 +139,14 @@ __decorate([
137
139
  (0, sequelize_typescript_1.HasMany)(() => Booking_1.Booking),
138
140
  __metadata("design:type", Array)
139
141
  ], Project.prototype, "bookings", void 0);
142
+ __decorate([
143
+ (0, sequelize_typescript_1.HasMany)(() => Creator_1.Creator),
144
+ __metadata("design:type", Array)
145
+ ], Project.prototype, "creators", void 0);
146
+ __decorate([
147
+ (0, sequelize_typescript_1.HasMany)(() => Collection_1.Collection),
148
+ __metadata("design:type", Array)
149
+ ], Project.prototype, "collections", void 0);
140
150
  __decorate([
141
151
  (0, sequelize_typescript_1.Column)({
142
152
  type: sequelize_typescript_1.DataType.JSONB,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.1.92",
3
+ "version": "1.1.94",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",