whitelabel-db 1.2.8 → 1.3.0
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 +3 -0
- package/dist/index.js +8 -1
- package/dist/libs/database.js +6 -0
- package/dist/models/BookingLoyaltyRecord.d.ts +21 -0
- package/dist/models/BookingLoyaltyRecord.js +150 -0
- package/dist/models/LoyaltyProgram.d.ts +23 -0
- package/dist/models/LoyaltyProgram.js +142 -0
- package/dist/models/LoyaltyProgramTier.d.ts +26 -0
- package/dist/models/LoyaltyProgramTier.js +134 -0
- package/dist/models/Project.d.ts +2 -0
- package/dist/models/Project.js +5 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ export { Collection, CollectionStatus } from './models/Collection';
|
|
|
26
26
|
export { CollectionItem, CollectionType } from './models/CollectionItem';
|
|
27
27
|
export { CollectionItemCustomField } from './models/CollectionItemCustomField';
|
|
28
28
|
export { DeletedHotel } from './models/DeletedHotel';
|
|
29
|
+
export { LoyaltyProgram } from './models/LoyaltyProgram';
|
|
30
|
+
export { LoyaltyProgramTier } from './models/LoyaltyProgramTier';
|
|
31
|
+
export { BookingLoyaltyRecord } from './models/BookingLoyaltyRecord';
|
|
29
32
|
export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
|
|
30
33
|
export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, PromoCodeRequest, PromoCodeResponse, EsimplyPackage, Addon, AddonResponse, GetHotelRequestV3, HotelDataV3, HotelImageV3, CheckinCheckoutTimesV3, LocationV3, FacilityV3, RoomV3, BedTypeV3, RoomAmenityV3, RoomPhotoV3, PolicyV3, AccessibilityV3, AccessibilityAttributesV3, AccessibilityDisabilitiesV3, AccessibilityDisabilityScoresV3, SentimentAnalysisV3, SentimentCategoryV3, SemanticSearchRequestV3, SemanticSearchHotelV3, ConversationalHotelRequestV3, ConversationalHotelResponseV3, } from './libs/liteapiv3';
|
|
31
34
|
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.DeletedHotel = 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;
|
|
3
|
+
exports.LiteApiUser = exports.LiteApiClientV3 = exports.LiteApiClient = exports.BookingLoyaltyRecord = exports.LoyaltyProgramTier = exports.LoyaltyProgram = exports.DeletedHotel = 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");
|
|
@@ -61,6 +61,13 @@ var CollectionItemCustomField_1 = require("./models/CollectionItemCustomField");
|
|
|
61
61
|
Object.defineProperty(exports, "CollectionItemCustomField", { enumerable: true, get: function () { return CollectionItemCustomField_1.CollectionItemCustomField; } });
|
|
62
62
|
var DeletedHotel_1 = require("./models/DeletedHotel");
|
|
63
63
|
Object.defineProperty(exports, "DeletedHotel", { enumerable: true, get: function () { return DeletedHotel_1.DeletedHotel; } });
|
|
64
|
+
// Loyalty Program models
|
|
65
|
+
var LoyaltyProgram_1 = require("./models/LoyaltyProgram");
|
|
66
|
+
Object.defineProperty(exports, "LoyaltyProgram", { enumerable: true, get: function () { return LoyaltyProgram_1.LoyaltyProgram; } });
|
|
67
|
+
var LoyaltyProgramTier_1 = require("./models/LoyaltyProgramTier");
|
|
68
|
+
Object.defineProperty(exports, "LoyaltyProgramTier", { enumerable: true, get: function () { return LoyaltyProgramTier_1.LoyaltyProgramTier; } });
|
|
69
|
+
var BookingLoyaltyRecord_1 = require("./models/BookingLoyaltyRecord");
|
|
70
|
+
Object.defineProperty(exports, "BookingLoyaltyRecord", { enumerable: true, get: function () { return BookingLoyaltyRecord_1.BookingLoyaltyRecord; } });
|
|
64
71
|
var liteapi_1 = require("./libs/liteapi");
|
|
65
72
|
Object.defineProperty(exports, "LiteApiClient", { enumerable: true, get: function () { return liteapi_1.LiteApiClient; } });
|
|
66
73
|
var liteapiv3_1 = require("./libs/liteapiv3");
|
package/dist/libs/database.js
CHANGED
|
@@ -37,6 +37,9 @@ const Collection_1 = require("../models/Collection");
|
|
|
37
37
|
const CollectionItem_1 = require("../models/CollectionItem");
|
|
38
38
|
const CollectionItemCustomField_1 = require("../models/CollectionItemCustomField");
|
|
39
39
|
const DeletedHotel_1 = require("../models/DeletedHotel");
|
|
40
|
+
const LoyaltyProgram_1 = require("../models/LoyaltyProgram");
|
|
41
|
+
const LoyaltyProgramTier_1 = require("../models/LoyaltyProgramTier");
|
|
42
|
+
const BookingLoyaltyRecord_1 = require("../models/BookingLoyaltyRecord");
|
|
40
43
|
const migration_1 = require("./migration");
|
|
41
44
|
const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
45
|
const connection = new sequelize_typescript_1.Sequelize({
|
|
@@ -73,6 +76,9 @@ const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, functio
|
|
|
73
76
|
CollectionItem_1.CollectionItem,
|
|
74
77
|
CollectionItemCustomField_1.CollectionItemCustomField,
|
|
75
78
|
DeletedHotel_1.DeletedHotel,
|
|
79
|
+
LoyaltyProgram_1.LoyaltyProgram,
|
|
80
|
+
LoyaltyProgramTier_1.LoyaltyProgramTier,
|
|
81
|
+
BookingLoyaltyRecord_1.BookingLoyaltyRecord,
|
|
76
82
|
],
|
|
77
83
|
});
|
|
78
84
|
try {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { Booking } from './Booking';
|
|
3
|
+
import { LoyaltyProgram } from './LoyaltyProgram';
|
|
4
|
+
import { EarnRule } from './LoyaltyProgramTier';
|
|
5
|
+
export declare class BookingLoyaltyRecord extends Model<Partial<BookingLoyaltyRecord>> {
|
|
6
|
+
id: string;
|
|
7
|
+
bookingId: string;
|
|
8
|
+
booking?: Booking;
|
|
9
|
+
loyaltyProgramId: string;
|
|
10
|
+
loyaltyProgram?: LoyaltyProgram;
|
|
11
|
+
membershipIdentifier?: string;
|
|
12
|
+
tierAtBooking?: string;
|
|
13
|
+
pointsEarned?: number;
|
|
14
|
+
pointsBurned: number;
|
|
15
|
+
earnRuleApplied?: EarnRule;
|
|
16
|
+
calculationMethod?: 'partner' | 'wl';
|
|
17
|
+
earnMultiplier?: number;
|
|
18
|
+
partnerResponse?: object;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
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.BookingLoyaltyRecord = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Booking_1 = require("./Booking");
|
|
15
|
+
const LoyaltyProgram_1 = require("./LoyaltyProgram");
|
|
16
|
+
let BookingLoyaltyRecord = class BookingLoyaltyRecord extends sequelize_typescript_1.Model {
|
|
17
|
+
};
|
|
18
|
+
exports.BookingLoyaltyRecord = BookingLoyaltyRecord;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, sequelize_typescript_1.IsUUID)(4),
|
|
21
|
+
sequelize_typescript_1.PrimaryKey,
|
|
22
|
+
(0, sequelize_typescript_1.Column)({
|
|
23
|
+
type: sequelize_typescript_1.DataType.UUID,
|
|
24
|
+
defaultValue: sequelize_typescript_1.DataType.UUIDV4,
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], BookingLoyaltyRecord.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Booking_1.Booking),
|
|
30
|
+
sequelize_typescript_1.Index,
|
|
31
|
+
(0, sequelize_typescript_1.Column)({
|
|
32
|
+
type: sequelize_typescript_1.DataType.UUID,
|
|
33
|
+
allowNull: false,
|
|
34
|
+
comment: 'Foreign key to booking table',
|
|
35
|
+
}),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], BookingLoyaltyRecord.prototype, "bookingId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Booking_1.Booking),
|
|
40
|
+
__metadata("design:type", Booking_1.Booking)
|
|
41
|
+
], BookingLoyaltyRecord.prototype, "booking", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, sequelize_typescript_1.ForeignKey)(() => LoyaltyProgram_1.LoyaltyProgram),
|
|
44
|
+
sequelize_typescript_1.Index,
|
|
45
|
+
(0, sequelize_typescript_1.Column)({
|
|
46
|
+
type: sequelize_typescript_1.DataType.UUID,
|
|
47
|
+
allowNull: false,
|
|
48
|
+
}),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], BookingLoyaltyRecord.prototype, "loyaltyProgramId", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, sequelize_typescript_1.BelongsTo)(() => LoyaltyProgram_1.LoyaltyProgram),
|
|
53
|
+
__metadata("design:type", LoyaltyProgram_1.LoyaltyProgram)
|
|
54
|
+
], BookingLoyaltyRecord.prototype, "loyaltyProgram", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, sequelize_typescript_1.Column)({
|
|
57
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
58
|
+
allowNull: true,
|
|
59
|
+
comment: 'Membership number supplied at booking',
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], BookingLoyaltyRecord.prototype, "membershipIdentifier", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, sequelize_typescript_1.Column)({
|
|
65
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
66
|
+
allowNull: true,
|
|
67
|
+
comment: 'Tier returned by partner at booking (optional)',
|
|
68
|
+
}),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], BookingLoyaltyRecord.prototype, "tierAtBooking", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, sequelize_typescript_1.Column)({
|
|
73
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
74
|
+
allowNull: true,
|
|
75
|
+
comment: 'Final points awarded (from partner or WL calc)',
|
|
76
|
+
}),
|
|
77
|
+
__metadata("design:type", Number)
|
|
78
|
+
], BookingLoyaltyRecord.prototype, "pointsEarned", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, sequelize_typescript_1.Column)({
|
|
81
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
82
|
+
allowNull: false,
|
|
83
|
+
defaultValue: 0,
|
|
84
|
+
comment: 'Future: points burned for this booking',
|
|
85
|
+
}),
|
|
86
|
+
__metadata("design:type", Number)
|
|
87
|
+
], BookingLoyaltyRecord.prototype, "pointsBurned", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, sequelize_typescript_1.Column)({
|
|
90
|
+
type: sequelize_typescript_1.DataType.JSONB,
|
|
91
|
+
allowNull: true,
|
|
92
|
+
comment: 'Snapshot of the earnRule used (includes tier overrides)',
|
|
93
|
+
}),
|
|
94
|
+
__metadata("design:type", Object)
|
|
95
|
+
], BookingLoyaltyRecord.prototype, "earnRuleApplied", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, sequelize_typescript_1.Column)({
|
|
98
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
99
|
+
allowNull: true,
|
|
100
|
+
comment: 'Indicates whether pointsEarned came from "partner" or "wl"',
|
|
101
|
+
}),
|
|
102
|
+
__metadata("design:type", String)
|
|
103
|
+
], BookingLoyaltyRecord.prototype, "calculationMethod", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
(0, sequelize_typescript_1.Column)({
|
|
106
|
+
type: sequelize_typescript_1.DataType.DECIMAL(10, 4),
|
|
107
|
+
allowNull: true,
|
|
108
|
+
comment: 'Legacy multiplier (kept for backward compat)',
|
|
109
|
+
}),
|
|
110
|
+
__metadata("design:type", Number)
|
|
111
|
+
], BookingLoyaltyRecord.prototype, "earnMultiplier", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, sequelize_typescript_1.Column)({
|
|
114
|
+
type: sequelize_typescript_1.DataType.JSONB,
|
|
115
|
+
allowNull: true,
|
|
116
|
+
comment: 'Raw partner API response',
|
|
117
|
+
}),
|
|
118
|
+
__metadata("design:type", Object)
|
|
119
|
+
], BookingLoyaltyRecord.prototype, "partnerResponse", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, sequelize_typescript_1.Column)({
|
|
122
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
123
|
+
allowNull: false,
|
|
124
|
+
defaultValue: sequelize_typescript_1.DataType.NOW,
|
|
125
|
+
}),
|
|
126
|
+
__metadata("design:type", Date)
|
|
127
|
+
], BookingLoyaltyRecord.prototype, "createdAt", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
(0, sequelize_typescript_1.Column)({
|
|
130
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
131
|
+
allowNull: false,
|
|
132
|
+
defaultValue: sequelize_typescript_1.DataType.NOW,
|
|
133
|
+
}),
|
|
134
|
+
__metadata("design:type", Date)
|
|
135
|
+
], BookingLoyaltyRecord.prototype, "updatedAt", void 0);
|
|
136
|
+
exports.BookingLoyaltyRecord = BookingLoyaltyRecord = __decorate([
|
|
137
|
+
(0, sequelize_typescript_1.Table)({
|
|
138
|
+
tableName: 'booking_loyalty_record',
|
|
139
|
+
indexes: [
|
|
140
|
+
{
|
|
141
|
+
fields: ['bookingId'],
|
|
142
|
+
name: 'idx_booking_loyalty_record_booking_id',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
fields: ['loyaltyProgramId'],
|
|
146
|
+
name: 'idx_booking_loyalty_record_program_id',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
})
|
|
150
|
+
], BookingLoyaltyRecord);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { Project } from './Project';
|
|
3
|
+
import { LoyaltyProgramTier } from './LoyaltyProgramTier';
|
|
4
|
+
import { BookingLoyaltyRecord } from './BookingLoyaltyRecord';
|
|
5
|
+
export declare class LoyaltyProgram extends Model<Partial<LoyaltyProgram>> {
|
|
6
|
+
id: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
project?: Project;
|
|
9
|
+
name: string;
|
|
10
|
+
rewardType?: string;
|
|
11
|
+
validationMethod?: string;
|
|
12
|
+
minTransactionValue?: number;
|
|
13
|
+
rewardValueCurrency?: number;
|
|
14
|
+
rewardCurrency?: string;
|
|
15
|
+
rewardValuePoints?: number;
|
|
16
|
+
pointsAccrualTiming?: string;
|
|
17
|
+
settings?: object;
|
|
18
|
+
appearance?: object;
|
|
19
|
+
tiers?: LoyaltyProgramTier[];
|
|
20
|
+
bookingLoyaltyRecords?: BookingLoyaltyRecord[];
|
|
21
|
+
createdAt: Date;
|
|
22
|
+
updatedAt: Date;
|
|
23
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
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.LoyaltyProgram = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Project_1 = require("./Project");
|
|
15
|
+
const LoyaltyProgramTier_1 = require("./LoyaltyProgramTier");
|
|
16
|
+
const BookingLoyaltyRecord_1 = require("./BookingLoyaltyRecord");
|
|
17
|
+
let LoyaltyProgram = class LoyaltyProgram extends sequelize_typescript_1.Model {
|
|
18
|
+
};
|
|
19
|
+
exports.LoyaltyProgram = LoyaltyProgram;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, sequelize_typescript_1.IsUUID)(4),
|
|
22
|
+
sequelize_typescript_1.PrimaryKey,
|
|
23
|
+
(0, sequelize_typescript_1.Column)({
|
|
24
|
+
type: sequelize_typescript_1.DataType.UUID,
|
|
25
|
+
defaultValue: sequelize_typescript_1.DataType.UUIDV4,
|
|
26
|
+
}),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], LoyaltyProgram.prototype, "id", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Project_1.Project),
|
|
31
|
+
sequelize_typescript_1.Index,
|
|
32
|
+
(0, sequelize_typescript_1.Column)({
|
|
33
|
+
type: sequelize_typescript_1.DataType.UUID,
|
|
34
|
+
allowNull: false,
|
|
35
|
+
}),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], LoyaltyProgram.prototype, "projectId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project),
|
|
40
|
+
__metadata("design:type", Project_1.Project)
|
|
41
|
+
], LoyaltyProgram.prototype, "project", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, sequelize_typescript_1.Column)({
|
|
44
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
45
|
+
allowNull: false,
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], LoyaltyProgram.prototype, "name", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, sequelize_typescript_1.Column)({
|
|
51
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
52
|
+
allowNull: true,
|
|
53
|
+
}),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], LoyaltyProgram.prototype, "rewardType", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, sequelize_typescript_1.Column)({
|
|
58
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
59
|
+
allowNull: true,
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], LoyaltyProgram.prototype, "validationMethod", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, sequelize_typescript_1.Column)({
|
|
65
|
+
type: sequelize_typescript_1.DataType.DECIMAL(20, 2),
|
|
66
|
+
allowNull: true,
|
|
67
|
+
}),
|
|
68
|
+
__metadata("design:type", Number)
|
|
69
|
+
], LoyaltyProgram.prototype, "minTransactionValue", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, sequelize_typescript_1.Column)({
|
|
72
|
+
type: sequelize_typescript_1.DataType.DECIMAL(20, 2),
|
|
73
|
+
allowNull: true,
|
|
74
|
+
comment: 'Program-level currency unit per point',
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Number)
|
|
77
|
+
], LoyaltyProgram.prototype, "rewardValueCurrency", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, sequelize_typescript_1.Column)({
|
|
80
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
81
|
+
allowNull: true,
|
|
82
|
+
}),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], LoyaltyProgram.prototype, "rewardCurrency", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, sequelize_typescript_1.Column)({
|
|
87
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
88
|
+
allowNull: true,
|
|
89
|
+
comment: 'Program-level points per unit',
|
|
90
|
+
}),
|
|
91
|
+
__metadata("design:type", Number)
|
|
92
|
+
], LoyaltyProgram.prototype, "rewardValuePoints", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, sequelize_typescript_1.Column)({
|
|
95
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
96
|
+
allowNull: true,
|
|
97
|
+
}),
|
|
98
|
+
__metadata("design:type", String)
|
|
99
|
+
], LoyaltyProgram.prototype, "pointsAccrualTiming", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, sequelize_typescript_1.Column)({
|
|
102
|
+
type: sequelize_typescript_1.DataType.JSONB,
|
|
103
|
+
allowNull: true,
|
|
104
|
+
}),
|
|
105
|
+
__metadata("design:type", Object)
|
|
106
|
+
], LoyaltyProgram.prototype, "settings", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, sequelize_typescript_1.Column)({
|
|
109
|
+
type: sequelize_typescript_1.DataType.JSONB,
|
|
110
|
+
allowNull: true,
|
|
111
|
+
}),
|
|
112
|
+
__metadata("design:type", Object)
|
|
113
|
+
], LoyaltyProgram.prototype, "appearance", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, sequelize_typescript_1.HasMany)(() => LoyaltyProgramTier_1.LoyaltyProgramTier),
|
|
116
|
+
__metadata("design:type", Array)
|
|
117
|
+
], LoyaltyProgram.prototype, "tiers", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, sequelize_typescript_1.HasMany)(() => BookingLoyaltyRecord_1.BookingLoyaltyRecord),
|
|
120
|
+
__metadata("design:type", Array)
|
|
121
|
+
], LoyaltyProgram.prototype, "bookingLoyaltyRecords", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, sequelize_typescript_1.Column)({
|
|
124
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
125
|
+
allowNull: false,
|
|
126
|
+
defaultValue: sequelize_typescript_1.DataType.NOW,
|
|
127
|
+
}),
|
|
128
|
+
__metadata("design:type", Date)
|
|
129
|
+
], LoyaltyProgram.prototype, "createdAt", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, sequelize_typescript_1.Column)({
|
|
132
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
133
|
+
allowNull: false,
|
|
134
|
+
defaultValue: sequelize_typescript_1.DataType.NOW,
|
|
135
|
+
}),
|
|
136
|
+
__metadata("design:type", Date)
|
|
137
|
+
], LoyaltyProgram.prototype, "updatedAt", void 0);
|
|
138
|
+
exports.LoyaltyProgram = LoyaltyProgram = __decorate([
|
|
139
|
+
(0, sequelize_typescript_1.Table)({
|
|
140
|
+
tableName: 'loyalty_program',
|
|
141
|
+
})
|
|
142
|
+
], LoyaltyProgram);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { LoyaltyProgram } from './LoyaltyProgram';
|
|
3
|
+
export interface EarnRule {
|
|
4
|
+
type: 'multiplier' | 'static' | 'additive' | 'combined' | 'tierValueOverride';
|
|
5
|
+
multiplier?: number;
|
|
6
|
+
staticPoints?: number;
|
|
7
|
+
additivePoints?: number;
|
|
8
|
+
tierRewardValueCurrency?: number;
|
|
9
|
+
tierRewardValuePoints?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class LoyaltyProgramTier extends Model<Partial<LoyaltyProgramTier>> {
|
|
12
|
+
id: string;
|
|
13
|
+
programId: string;
|
|
14
|
+
program?: LoyaltyProgram;
|
|
15
|
+
name: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
pointsRequired?: number;
|
|
18
|
+
nightsStayedRequired?: number;
|
|
19
|
+
bookingsCompletedRequired?: number;
|
|
20
|
+
earnRule?: EarnRule;
|
|
21
|
+
icon?: string;
|
|
22
|
+
color?: string;
|
|
23
|
+
displayOrder: number;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
26
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
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.LoyaltyProgramTier = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const LoyaltyProgram_1 = require("./LoyaltyProgram");
|
|
15
|
+
let LoyaltyProgramTier = class LoyaltyProgramTier extends sequelize_typescript_1.Model {
|
|
16
|
+
};
|
|
17
|
+
exports.LoyaltyProgramTier = LoyaltyProgramTier;
|
|
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
|
+
], LoyaltyProgramTier.prototype, "id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, sequelize_typescript_1.ForeignKey)(() => LoyaltyProgram_1.LoyaltyProgram),
|
|
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
|
+
], LoyaltyProgramTier.prototype, "programId", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, sequelize_typescript_1.BelongsTo)(() => LoyaltyProgram_1.LoyaltyProgram),
|
|
38
|
+
__metadata("design:type", LoyaltyProgram_1.LoyaltyProgram)
|
|
39
|
+
], LoyaltyProgramTier.prototype, "program", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, sequelize_typescript_1.Column)({
|
|
42
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
43
|
+
allowNull: false,
|
|
44
|
+
}),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], LoyaltyProgramTier.prototype, "name", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, sequelize_typescript_1.Column)({
|
|
49
|
+
type: sequelize_typescript_1.DataType.TEXT,
|
|
50
|
+
allowNull: true,
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], LoyaltyProgramTier.prototype, "description", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, sequelize_typescript_1.Column)({
|
|
56
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
57
|
+
allowNull: true,
|
|
58
|
+
comment: 'Display-only qualification rule',
|
|
59
|
+
}),
|
|
60
|
+
__metadata("design:type", Number)
|
|
61
|
+
], LoyaltyProgramTier.prototype, "pointsRequired", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, sequelize_typescript_1.Column)({
|
|
64
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
65
|
+
allowNull: true,
|
|
66
|
+
comment: 'Display-only qualification rule',
|
|
67
|
+
}),
|
|
68
|
+
__metadata("design:type", Number)
|
|
69
|
+
], LoyaltyProgramTier.prototype, "nightsStayedRequired", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, sequelize_typescript_1.Column)({
|
|
72
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
73
|
+
allowNull: true,
|
|
74
|
+
comment: 'Display-only qualification rule',
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Number)
|
|
77
|
+
], LoyaltyProgramTier.prototype, "bookingsCompletedRequired", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, sequelize_typescript_1.Column)({
|
|
80
|
+
type: sequelize_typescript_1.DataType.JSONB,
|
|
81
|
+
allowNull: true,
|
|
82
|
+
comment: 'Tier-level earn rules with optional overrides (type: multiplier|static|additive|combined|tierValueOverride)',
|
|
83
|
+
}),
|
|
84
|
+
__metadata("design:type", Object)
|
|
85
|
+
], LoyaltyProgramTier.prototype, "earnRule", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, sequelize_typescript_1.Column)({
|
|
88
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
89
|
+
allowNull: true,
|
|
90
|
+
}),
|
|
91
|
+
__metadata("design:type", String)
|
|
92
|
+
], LoyaltyProgramTier.prototype, "icon", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, sequelize_typescript_1.Column)({
|
|
95
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
96
|
+
allowNull: true,
|
|
97
|
+
}),
|
|
98
|
+
__metadata("design:type", String)
|
|
99
|
+
], LoyaltyProgramTier.prototype, "color", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, sequelize_typescript_1.Column)({
|
|
102
|
+
type: sequelize_typescript_1.DataType.INTEGER,
|
|
103
|
+
allowNull: false,
|
|
104
|
+
defaultValue: 0,
|
|
105
|
+
}),
|
|
106
|
+
__metadata("design:type", Number)
|
|
107
|
+
], LoyaltyProgramTier.prototype, "displayOrder", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, sequelize_typescript_1.Column)({
|
|
110
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
111
|
+
allowNull: false,
|
|
112
|
+
defaultValue: sequelize_typescript_1.DataType.NOW,
|
|
113
|
+
}),
|
|
114
|
+
__metadata("design:type", Date)
|
|
115
|
+
], LoyaltyProgramTier.prototype, "createdAt", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, sequelize_typescript_1.Column)({
|
|
118
|
+
type: sequelize_typescript_1.DataType.DATE,
|
|
119
|
+
allowNull: false,
|
|
120
|
+
defaultValue: sequelize_typescript_1.DataType.NOW,
|
|
121
|
+
}),
|
|
122
|
+
__metadata("design:type", Date)
|
|
123
|
+
], LoyaltyProgramTier.prototype, "updatedAt", void 0);
|
|
124
|
+
exports.LoyaltyProgramTier = LoyaltyProgramTier = __decorate([
|
|
125
|
+
(0, sequelize_typescript_1.Table)({
|
|
126
|
+
tableName: 'loyalty_program_tier',
|
|
127
|
+
indexes: [
|
|
128
|
+
{
|
|
129
|
+
fields: ['programId', 'displayOrder'],
|
|
130
|
+
name: 'idx_loyalty_program_tier_program_display_order',
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
})
|
|
134
|
+
], LoyaltyProgramTier);
|
package/dist/models/Project.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { LiteApiClientV3 } from '../libs/liteapiv3';
|
|
|
5
5
|
import { Booking } from './Booking';
|
|
6
6
|
import { Creator } from './Creator';
|
|
7
7
|
import { Collection } from './Collection';
|
|
8
|
+
import { LoyaltyProgram } from './LoyaltyProgram';
|
|
8
9
|
export declare class Project extends Model<Partial<Project>> {
|
|
9
10
|
id: string;
|
|
10
11
|
name: string;
|
|
@@ -19,6 +20,7 @@ export declare class Project extends Model<Partial<Project>> {
|
|
|
19
20
|
bookings?: Booking[];
|
|
20
21
|
creators?: Creator[];
|
|
21
22
|
collections?: Collection[];
|
|
23
|
+
loyaltyPrograms?: LoyaltyProgram[];
|
|
22
24
|
preferences?: object;
|
|
23
25
|
appearance?: object;
|
|
24
26
|
isActive?: boolean;
|
package/dist/models/Project.js
CHANGED
|
@@ -21,6 +21,7 @@ const liteapiv3_1 = require("../libs/liteapiv3");
|
|
|
21
21
|
const Booking_1 = require("./Booking");
|
|
22
22
|
const Creator_1 = require("./Creator");
|
|
23
23
|
const Collection_1 = require("./Collection");
|
|
24
|
+
const LoyaltyProgram_1 = require("./LoyaltyProgram");
|
|
24
25
|
const clients = {};
|
|
25
26
|
const clientV3 = {};
|
|
26
27
|
const defaultLiteApiEnvironment = process.env.COPILOT_ENVIRONMENT_NAME === 'production' ? 'production' : 'dev';
|
|
@@ -155,6 +156,10 @@ __decorate([
|
|
|
155
156
|
(0, sequelize_typescript_1.HasMany)(() => Collection_1.Collection),
|
|
156
157
|
__metadata("design:type", Array)
|
|
157
158
|
], Project.prototype, "collections", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
(0, sequelize_typescript_1.HasMany)(() => LoyaltyProgram_1.LoyaltyProgram),
|
|
161
|
+
__metadata("design:type", Array)
|
|
162
|
+
], Project.prototype, "loyaltyPrograms", void 0);
|
|
158
163
|
__decorate([
|
|
159
164
|
(0, sequelize_typescript_1.Column)({
|
|
160
165
|
type: sequelize_typescript_1.DataType.JSONB,
|