@managesome/eposmatic-toolkit 0.2.256 → 0.2.258
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/lib/helpers/utils/offers-helpers.js +6 -2
- package/lib/schemas/models/offers.d.ts +25 -25
- package/lib/schemas/models/offers.js +68 -11
- package/lib/schemas/models/offers_fingerprints.d.ts +3 -3
- package/lib/schemas/models/offers_fingerprints.js +4 -5
- package/lib/schemas/models/order.d.ts +150 -150
- package/lib/schemas/models/purchase_orders.d.ts +135 -135
- package/lib/schemas/models/reservations.d.ts +3 -3
- package/lib/schemas/models/tenant.d.ts +60 -57
- package/lib/schemas/models/tenant.js +4 -0
- package/lib/schemas/models/warehouse.d.ts +12 -12
- package/lib/schemas/models/warehouse_invoices.d.ts +135 -135
- package/lib/schemas/types/offers_fingerprints.d.ts +1 -1
- package/lib/schemas/types/tenant.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1196,7 +1196,9 @@ function getOffersWithStats({ offers, customer, vouchers, customerVoucherUsage,
|
|
|
1196
1196
|
stats.message = `🎉 You have unlocked this offer 🎉`;
|
|
1197
1197
|
}
|
|
1198
1198
|
else {
|
|
1199
|
-
|
|
1199
|
+
const pointsProgress = Math.floor(((totalLoyaltyPointsOfCustomer ?? 0) / (num_of_points || 1)) * 100);
|
|
1200
|
+
// Keep below-threshold progress strictly below 100 to avoid false unlocks.
|
|
1201
|
+
stats.progress = Math.max(0, Math.min(99, pointsProgress));
|
|
1200
1202
|
stats.message = `You are ${(num_of_points - (totalLoyaltyPointsOfCustomer ?? 0)).toFixed(0)} points away from unlocking this offer`;
|
|
1201
1203
|
}
|
|
1202
1204
|
}
|
|
@@ -1206,7 +1208,9 @@ function getOffersWithStats({ offers, customer, vouchers, customerVoucherUsage,
|
|
|
1206
1208
|
}
|
|
1207
1209
|
}
|
|
1208
1210
|
else {
|
|
1209
|
-
|
|
1211
|
+
const pointsProgress = Math.floor(((totalLoyaltyPointsOfCustomer ?? 0) / (num_of_points || 1)) * 100);
|
|
1212
|
+
// Keep below-threshold progress strictly below 100 to avoid false unlocks.
|
|
1213
|
+
stats.progress = Math.max(0, Math.min(99, pointsProgress));
|
|
1210
1214
|
stats.message = `You are ${(num_of_points - (totalLoyaltyPointsOfCustomer ?? 0)).toFixed(0)} points away from unlocking this offer`;
|
|
1211
1215
|
}
|
|
1212
1216
|
if (stats.progress >= 100) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'mongoose';
|
|
2
|
-
import { PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM } from '../../constants';
|
|
2
|
+
import { OFFER_REWARD_TYPE_ENUM, PATHWAY_TO_UNLOCK_TYPE_ENUM, PATHWAY_TO_UNLOCK_TYPE_ORDERS_SCOPE_ENUM } from '../../constants';
|
|
3
3
|
export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
4
4
|
timestamps: true;
|
|
5
5
|
versionKey: false;
|
|
@@ -16,11 +16,12 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
16
16
|
image_url: string;
|
|
17
17
|
description: string;
|
|
18
18
|
brand_id: string;
|
|
19
|
+
active: boolean;
|
|
19
20
|
sort_id: number;
|
|
20
21
|
included_platforms: import("../../constants").PLATFORMS_ENUM[];
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
auto_apply: boolean;
|
|
23
|
+
pathway_to_unlock_type: PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
24
|
+
reward_type: OFFER_REWARD_TYPE_ENUM;
|
|
24
25
|
offer_special_hours?: import("mongoose").Types.DocumentArray<{
|
|
25
26
|
days_index: import("../../constants").DAY_INDEX_ENUM[];
|
|
26
27
|
disabled_outside_date_range: boolean;
|
|
@@ -307,7 +308,6 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
307
308
|
BASE_PRICE: number;
|
|
308
309
|
} | null | undefined;
|
|
309
310
|
}> | null | undefined;
|
|
310
|
-
auto_apply?: boolean | null | undefined;
|
|
311
311
|
pathway_to_unlock_type_items?: {
|
|
312
312
|
excluded_refs: string[];
|
|
313
313
|
exclusive_refs: string[];
|
|
@@ -353,17 +353,17 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
353
353
|
}> | null | undefined;
|
|
354
354
|
} | null | undefined;
|
|
355
355
|
reward_discount?: {
|
|
356
|
+
is_discount_percentage: boolean;
|
|
356
357
|
excluded_refs: string[];
|
|
357
358
|
discount_value: number;
|
|
358
|
-
is_discount_percentage?: boolean | null | undefined;
|
|
359
359
|
} | null | undefined;
|
|
360
360
|
reward_discount_items?: {
|
|
361
|
+
is_discount_percentage: boolean;
|
|
361
362
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
362
363
|
excluded_refs: string[];
|
|
363
364
|
exclusive_refs: string[];
|
|
364
365
|
num_of_items: number;
|
|
365
366
|
discount_value: number;
|
|
366
|
-
is_discount_percentage?: boolean | null | undefined;
|
|
367
367
|
allocation?: import("mongoose").Types.DocumentArray<{
|
|
368
368
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
369
369
|
quantity: number;
|
|
@@ -377,12 +377,12 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
377
377
|
} | null | undefined;
|
|
378
378
|
reward_points?: {
|
|
379
379
|
num_of_points: number;
|
|
380
|
-
once_per_order
|
|
380
|
+
once_per_order: boolean;
|
|
381
381
|
} | null | undefined;
|
|
382
382
|
reward_cashback?: {
|
|
383
383
|
excluded_refs: string[];
|
|
384
384
|
cashback_value: number;
|
|
385
|
-
is_cashback_percentage
|
|
385
|
+
is_cashback_percentage: boolean;
|
|
386
386
|
max_cashback_amount?: number | null | undefined;
|
|
387
387
|
} | null | undefined;
|
|
388
388
|
reward_gift_cards?: {
|
|
@@ -403,11 +403,12 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
403
403
|
image_url: string;
|
|
404
404
|
description: string;
|
|
405
405
|
brand_id: string;
|
|
406
|
+
active: boolean;
|
|
406
407
|
sort_id: number;
|
|
407
408
|
included_platforms: import("../../constants").PLATFORMS_ENUM[];
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
409
|
+
auto_apply: boolean;
|
|
410
|
+
pathway_to_unlock_type: PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
411
|
+
reward_type: OFFER_REWARD_TYPE_ENUM;
|
|
411
412
|
offer_special_hours?: import("mongoose").Types.DocumentArray<{
|
|
412
413
|
days_index: import("../../constants").DAY_INDEX_ENUM[];
|
|
413
414
|
disabled_outside_date_range: boolean;
|
|
@@ -694,7 +695,6 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
694
695
|
BASE_PRICE: number;
|
|
695
696
|
} | null | undefined;
|
|
696
697
|
}> | null | undefined;
|
|
697
|
-
auto_apply?: boolean | null | undefined;
|
|
698
698
|
pathway_to_unlock_type_items?: {
|
|
699
699
|
excluded_refs: string[];
|
|
700
700
|
exclusive_refs: string[];
|
|
@@ -740,17 +740,17 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
740
740
|
}> | null | undefined;
|
|
741
741
|
} | null | undefined;
|
|
742
742
|
reward_discount?: {
|
|
743
|
+
is_discount_percentage: boolean;
|
|
743
744
|
excluded_refs: string[];
|
|
744
745
|
discount_value: number;
|
|
745
|
-
is_discount_percentage?: boolean | null | undefined;
|
|
746
746
|
} | null | undefined;
|
|
747
747
|
reward_discount_items?: {
|
|
748
|
+
is_discount_percentage: boolean;
|
|
748
749
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
749
750
|
excluded_refs: string[];
|
|
750
751
|
exclusive_refs: string[];
|
|
751
752
|
num_of_items: number;
|
|
752
753
|
discount_value: number;
|
|
753
|
-
is_discount_percentage?: boolean | null | undefined;
|
|
754
754
|
allocation?: import("mongoose").Types.DocumentArray<{
|
|
755
755
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
756
756
|
quantity: number;
|
|
@@ -764,12 +764,12 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
764
764
|
} | null | undefined;
|
|
765
765
|
reward_points?: {
|
|
766
766
|
num_of_points: number;
|
|
767
|
-
once_per_order
|
|
767
|
+
once_per_order: boolean;
|
|
768
768
|
} | null | undefined;
|
|
769
769
|
reward_cashback?: {
|
|
770
770
|
excluded_refs: string[];
|
|
771
771
|
cashback_value: number;
|
|
772
|
-
is_cashback_percentage
|
|
772
|
+
is_cashback_percentage: boolean;
|
|
773
773
|
max_cashback_amount?: number | null | undefined;
|
|
774
774
|
} | null | undefined;
|
|
775
775
|
reward_gift_cards?: {
|
|
@@ -790,11 +790,12 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
790
790
|
image_url: string;
|
|
791
791
|
description: string;
|
|
792
792
|
brand_id: string;
|
|
793
|
+
active: boolean;
|
|
793
794
|
sort_id: number;
|
|
794
795
|
included_platforms: import("../../constants").PLATFORMS_ENUM[];
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
796
|
+
auto_apply: boolean;
|
|
797
|
+
pathway_to_unlock_type: PATHWAY_TO_UNLOCK_TYPE_ENUM;
|
|
798
|
+
reward_type: OFFER_REWARD_TYPE_ENUM;
|
|
798
799
|
offer_special_hours?: import("mongoose").Types.DocumentArray<{
|
|
799
800
|
days_index: import("../../constants").DAY_INDEX_ENUM[];
|
|
800
801
|
disabled_outside_date_range: boolean;
|
|
@@ -1081,7 +1082,6 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
1081
1082
|
BASE_PRICE: number;
|
|
1082
1083
|
} | null | undefined;
|
|
1083
1084
|
}> | null | undefined;
|
|
1084
|
-
auto_apply?: boolean | null | undefined;
|
|
1085
1085
|
pathway_to_unlock_type_items?: {
|
|
1086
1086
|
excluded_refs: string[];
|
|
1087
1087
|
exclusive_refs: string[];
|
|
@@ -1127,17 +1127,17 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
1127
1127
|
}> | null | undefined;
|
|
1128
1128
|
} | null | undefined;
|
|
1129
1129
|
reward_discount?: {
|
|
1130
|
+
is_discount_percentage: boolean;
|
|
1130
1131
|
excluded_refs: string[];
|
|
1131
1132
|
discount_value: number;
|
|
1132
|
-
is_discount_percentage?: boolean | null | undefined;
|
|
1133
1133
|
} | null | undefined;
|
|
1134
1134
|
reward_discount_items?: {
|
|
1135
|
+
is_discount_percentage: boolean;
|
|
1135
1136
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
1136
1137
|
excluded_refs: string[];
|
|
1137
1138
|
exclusive_refs: string[];
|
|
1138
1139
|
num_of_items: number;
|
|
1139
1140
|
discount_value: number;
|
|
1140
|
-
is_discount_percentage?: boolean | null | undefined;
|
|
1141
1141
|
allocation?: import("mongoose").Types.DocumentArray<{
|
|
1142
1142
|
item_ids: import("mongoose").Types.ObjectId[];
|
|
1143
1143
|
quantity: number;
|
|
@@ -1151,12 +1151,12 @@ export declare const OfferSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
1151
1151
|
} | null | undefined;
|
|
1152
1152
|
reward_points?: {
|
|
1153
1153
|
num_of_points: number;
|
|
1154
|
-
once_per_order
|
|
1154
|
+
once_per_order: boolean;
|
|
1155
1155
|
} | null | undefined;
|
|
1156
1156
|
reward_cashback?: {
|
|
1157
1157
|
excluded_refs: string[];
|
|
1158
1158
|
cashback_value: number;
|
|
1159
|
-
is_cashback_percentage
|
|
1159
|
+
is_cashback_percentage: boolean;
|
|
1160
1160
|
max_cashback_amount?: number | null | undefined;
|
|
1161
1161
|
} | null | undefined;
|
|
1162
1162
|
reward_gift_cards?: {
|
|
@@ -12,14 +12,17 @@ const PathwayToUnlockTypeItemsSchema = new mongoose_1.Schema({
|
|
|
12
12
|
max_claims: {
|
|
13
13
|
type: Number,
|
|
14
14
|
required: false,
|
|
15
|
+
default: null,
|
|
15
16
|
},
|
|
16
17
|
min_same_item_quantity: {
|
|
17
18
|
type: Number,
|
|
18
19
|
required: false,
|
|
20
|
+
default: null,
|
|
19
21
|
},
|
|
20
22
|
max_same_item_quantity: {
|
|
21
23
|
type: Number,
|
|
22
24
|
required: false,
|
|
25
|
+
default: null,
|
|
23
26
|
},
|
|
24
27
|
total_amount: {
|
|
25
28
|
type: Number,
|
|
@@ -27,17 +30,23 @@ const PathwayToUnlockTypeItemsSchema = new mongoose_1.Schema({
|
|
|
27
30
|
},
|
|
28
31
|
excluded_refs: {
|
|
29
32
|
type: [String],
|
|
33
|
+
required: true,
|
|
34
|
+
default: [],
|
|
30
35
|
},
|
|
31
36
|
exclusive_refs: {
|
|
32
37
|
type: [String],
|
|
38
|
+
required: true,
|
|
39
|
+
default: [],
|
|
33
40
|
},
|
|
34
41
|
item_ids: {
|
|
35
42
|
type: [mongoose_1.Schema.Types.ObjectId],
|
|
36
43
|
required: false,
|
|
44
|
+
default: [],
|
|
37
45
|
},
|
|
38
46
|
category_ids: {
|
|
39
47
|
type: [mongoose_1.Schema.Types.ObjectId],
|
|
40
48
|
required: false,
|
|
49
|
+
default: [],
|
|
41
50
|
},
|
|
42
51
|
}, {
|
|
43
52
|
_id: false,
|
|
@@ -57,6 +66,7 @@ const PathwayToUnlockTypeOrdersSchema = new mongoose_1.Schema({
|
|
|
57
66
|
max_num_of_orders: {
|
|
58
67
|
type: Number,
|
|
59
68
|
required: false,
|
|
69
|
+
default: null,
|
|
60
70
|
},
|
|
61
71
|
total_amount: {
|
|
62
72
|
type: Number,
|
|
@@ -65,6 +75,7 @@ const PathwayToUnlockTypeOrdersSchema = new mongoose_1.Schema({
|
|
|
65
75
|
max_amount: {
|
|
66
76
|
type: Number,
|
|
67
77
|
required: false,
|
|
78
|
+
default: null,
|
|
68
79
|
},
|
|
69
80
|
}, {
|
|
70
81
|
_id: false,
|
|
@@ -82,6 +93,7 @@ const PathwayToUnlockTypePointsSchema = new mongoose_1.Schema({
|
|
|
82
93
|
max_claims: {
|
|
83
94
|
type: Number,
|
|
84
95
|
required: false,
|
|
96
|
+
default: null,
|
|
85
97
|
},
|
|
86
98
|
}, {
|
|
87
99
|
_id: false,
|
|
@@ -95,6 +107,7 @@ const PathwayToUnlockTypeVouchersSchema = new mongoose_1.Schema({
|
|
|
95
107
|
max_amount: {
|
|
96
108
|
type: Number,
|
|
97
109
|
required: false,
|
|
110
|
+
default: null,
|
|
98
111
|
},
|
|
99
112
|
voucher_ids: {
|
|
100
113
|
type: [mongoose_1.Schema.Types.ObjectId],
|
|
@@ -113,9 +126,13 @@ const RewardItemsSchema = new mongoose_1.Schema({
|
|
|
113
126
|
},
|
|
114
127
|
excluded_refs: {
|
|
115
128
|
type: [String],
|
|
129
|
+
required: true,
|
|
130
|
+
default: [],
|
|
116
131
|
},
|
|
117
132
|
exclusive_refs: {
|
|
118
133
|
type: [String],
|
|
134
|
+
required: true,
|
|
135
|
+
default: [],
|
|
119
136
|
},
|
|
120
137
|
item_ids: {
|
|
121
138
|
type: [mongoose_1.Schema.Types.ObjectId],
|
|
@@ -149,9 +166,12 @@ const RewardDiscountSchema = new mongoose_1.Schema({
|
|
|
149
166
|
},
|
|
150
167
|
is_discount_percentage: {
|
|
151
168
|
type: Boolean,
|
|
169
|
+
required: true,
|
|
152
170
|
},
|
|
153
171
|
excluded_refs: {
|
|
154
172
|
type: [String],
|
|
173
|
+
required: true,
|
|
174
|
+
default: [],
|
|
155
175
|
},
|
|
156
176
|
}, {
|
|
157
177
|
_id: false,
|
|
@@ -164,9 +184,13 @@ const RewardDiscountItemsSchema = new mongoose_1.Schema({
|
|
|
164
184
|
},
|
|
165
185
|
excluded_refs: {
|
|
166
186
|
type: [String],
|
|
187
|
+
required: true,
|
|
188
|
+
default: [],
|
|
167
189
|
},
|
|
168
190
|
exclusive_refs: {
|
|
169
191
|
type: [String],
|
|
192
|
+
required: true,
|
|
193
|
+
default: [],
|
|
170
194
|
},
|
|
171
195
|
item_ids: {
|
|
172
196
|
type: [mongoose_1.Schema.Types.ObjectId],
|
|
@@ -195,6 +219,7 @@ const RewardDiscountItemsSchema = new mongoose_1.Schema({
|
|
|
195
219
|
},
|
|
196
220
|
is_discount_percentage: {
|
|
197
221
|
type: Boolean,
|
|
222
|
+
required: true,
|
|
198
223
|
},
|
|
199
224
|
}, {
|
|
200
225
|
_id: false,
|
|
@@ -207,6 +232,7 @@ const RewardPointsSchema = new mongoose_1.Schema({
|
|
|
207
232
|
},
|
|
208
233
|
once_per_order: {
|
|
209
234
|
type: Boolean,
|
|
235
|
+
required: true,
|
|
210
236
|
},
|
|
211
237
|
}, {
|
|
212
238
|
_id: false,
|
|
@@ -219,13 +245,17 @@ const RewardCashbackSchema = new mongoose_1.Schema({
|
|
|
219
245
|
},
|
|
220
246
|
is_cashback_percentage: {
|
|
221
247
|
type: Boolean,
|
|
248
|
+
required: true,
|
|
222
249
|
},
|
|
223
250
|
max_cashback_amount: {
|
|
224
251
|
type: Number,
|
|
225
252
|
required: false,
|
|
253
|
+
default: null,
|
|
226
254
|
},
|
|
227
255
|
excluded_refs: {
|
|
228
256
|
type: [String],
|
|
257
|
+
required: true,
|
|
258
|
+
default: [],
|
|
229
259
|
},
|
|
230
260
|
}, {
|
|
231
261
|
_id: false,
|
|
@@ -282,6 +312,8 @@ exports.OfferSchema = new mongoose_1.Schema({
|
|
|
282
312
|
},
|
|
283
313
|
active: {
|
|
284
314
|
type: Boolean,
|
|
315
|
+
required: true,
|
|
316
|
+
default: false,
|
|
285
317
|
},
|
|
286
318
|
included_platforms: {
|
|
287
319
|
type: [item_1.PlatformsSchema],
|
|
@@ -295,9 +327,12 @@ exports.OfferSchema = new mongoose_1.Schema({
|
|
|
295
327
|
offer_special_hours: {
|
|
296
328
|
type: [item_1.SpecialHoursSchema],
|
|
297
329
|
required: false,
|
|
330
|
+
default: null,
|
|
298
331
|
},
|
|
299
332
|
auto_apply: {
|
|
300
333
|
type: Boolean,
|
|
334
|
+
required: true,
|
|
335
|
+
default: false,
|
|
301
336
|
},
|
|
302
337
|
pathway_to_unlock_type: {
|
|
303
338
|
type: String,
|
|
@@ -306,19 +341,27 @@ exports.OfferSchema = new mongoose_1.Schema({
|
|
|
306
341
|
},
|
|
307
342
|
pathway_to_unlock_type_items: {
|
|
308
343
|
type: PathwayToUnlockTypeItemsSchema,
|
|
309
|
-
required
|
|
344
|
+
required() {
|
|
345
|
+
return this.pathway_to_unlock_type === constants_1.PATHWAY_TO_UNLOCK_TYPE_ENUM.ITEMS;
|
|
346
|
+
},
|
|
310
347
|
},
|
|
311
348
|
pathway_to_unlock_type_orders: {
|
|
312
349
|
type: PathwayToUnlockTypeOrdersSchema,
|
|
313
|
-
required
|
|
350
|
+
required() {
|
|
351
|
+
return this.pathway_to_unlock_type === constants_1.PATHWAY_TO_UNLOCK_TYPE_ENUM.ORDERS;
|
|
352
|
+
},
|
|
314
353
|
},
|
|
315
354
|
pathway_to_unlock_type_points: {
|
|
316
355
|
type: PathwayToUnlockTypePointsSchema,
|
|
317
|
-
required
|
|
356
|
+
required() {
|
|
357
|
+
return this.pathway_to_unlock_type === constants_1.PATHWAY_TO_UNLOCK_TYPE_ENUM.POINTS;
|
|
358
|
+
},
|
|
318
359
|
},
|
|
319
360
|
pathway_to_unlock_type_vouchers: {
|
|
320
361
|
type: PathwayToUnlockTypeVouchersSchema,
|
|
321
|
-
required
|
|
362
|
+
required() {
|
|
363
|
+
return this.pathway_to_unlock_type === constants_1.PATHWAY_TO_UNLOCK_TYPE_ENUM.VOUCHER;
|
|
364
|
+
},
|
|
322
365
|
},
|
|
323
366
|
reward_type: {
|
|
324
367
|
type: String,
|
|
@@ -327,31 +370,45 @@ exports.OfferSchema = new mongoose_1.Schema({
|
|
|
327
370
|
},
|
|
328
371
|
reward_items: {
|
|
329
372
|
type: RewardItemsSchema,
|
|
330
|
-
required
|
|
373
|
+
required() {
|
|
374
|
+
return this.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.ITEMS;
|
|
375
|
+
},
|
|
331
376
|
},
|
|
332
377
|
reward_discount: {
|
|
333
378
|
type: RewardDiscountSchema,
|
|
334
|
-
required
|
|
379
|
+
required() {
|
|
380
|
+
return this.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.DISCOUNT;
|
|
381
|
+
},
|
|
335
382
|
},
|
|
336
383
|
reward_discount_items: {
|
|
337
384
|
type: RewardDiscountItemsSchema,
|
|
338
|
-
required
|
|
385
|
+
required() {
|
|
386
|
+
return this.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.DISCOUNT_ITEMS;
|
|
387
|
+
},
|
|
339
388
|
},
|
|
340
389
|
reward_points: {
|
|
341
390
|
type: RewardPointsSchema,
|
|
342
|
-
required
|
|
391
|
+
required() {
|
|
392
|
+
return this.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.POINTS;
|
|
393
|
+
},
|
|
343
394
|
},
|
|
344
395
|
reward_cashback: {
|
|
345
396
|
type: RewardCashbackSchema,
|
|
346
|
-
required
|
|
397
|
+
required() {
|
|
398
|
+
return this.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.CASHBACK;
|
|
399
|
+
},
|
|
347
400
|
},
|
|
348
401
|
reward_gift_cards: {
|
|
349
402
|
type: RewardGiftCardsSchema,
|
|
350
|
-
required
|
|
403
|
+
required() {
|
|
404
|
+
return this.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.GIFT_CARDS;
|
|
405
|
+
},
|
|
351
406
|
},
|
|
352
407
|
reward_voucher: {
|
|
353
408
|
type: RewardVoucherSchema,
|
|
354
|
-
required
|
|
409
|
+
required() {
|
|
410
|
+
return this.reward_type === constants_1.OFFER_REWARD_TYPE_ENUM.VOUCHER;
|
|
411
|
+
},
|
|
355
412
|
},
|
|
356
413
|
createdAt: {
|
|
357
414
|
type: mongoose_1.Schema.Types.Date,
|
|
@@ -14,8 +14,8 @@ export declare const OfferFingerprintSchema: Schema<any, import("mongoose").Mode
|
|
|
14
14
|
updatedAt: NativeDate;
|
|
15
15
|
customer_phone: string;
|
|
16
16
|
offer_id: import("mongoose").Types.ObjectId;
|
|
17
|
+
redeemed_times: number;
|
|
17
18
|
redeemed_at: NativeDate;
|
|
18
|
-
unlocked_at: NativeDate;
|
|
19
19
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
20
20
|
createdAt: NativeDate;
|
|
21
21
|
updatedAt: NativeDate;
|
|
@@ -27,8 +27,8 @@ export declare const OfferFingerprintSchema: Schema<any, import("mongoose").Mode
|
|
|
27
27
|
updatedAt: NativeDate;
|
|
28
28
|
customer_phone: string;
|
|
29
29
|
offer_id: import("mongoose").Types.ObjectId;
|
|
30
|
+
redeemed_times: number;
|
|
30
31
|
redeemed_at: NativeDate;
|
|
31
|
-
unlocked_at: NativeDate;
|
|
32
32
|
}>> & import("mongoose").FlatRecord<{
|
|
33
33
|
createdAt: NativeDate;
|
|
34
34
|
updatedAt: NativeDate;
|
|
@@ -40,8 +40,8 @@ export declare const OfferFingerprintSchema: Schema<any, import("mongoose").Mode
|
|
|
40
40
|
updatedAt: NativeDate;
|
|
41
41
|
customer_phone: string;
|
|
42
42
|
offer_id: import("mongoose").Types.ObjectId;
|
|
43
|
+
redeemed_times: number;
|
|
43
44
|
redeemed_at: NativeDate;
|
|
44
|
-
unlocked_at: NativeDate;
|
|
45
45
|
}> & Required<{
|
|
46
46
|
_id: import("mongoose").Types.ObjectId;
|
|
47
47
|
}> & {
|
|
@@ -25,16 +25,15 @@ exports.OfferFingerprintSchema = new mongoose_1.Schema({
|
|
|
25
25
|
required: true,
|
|
26
26
|
immutable: true,
|
|
27
27
|
},
|
|
28
|
+
redeemed_times: {
|
|
29
|
+
type: Number,
|
|
30
|
+
default: 1,
|
|
31
|
+
},
|
|
28
32
|
redeemed_at: {
|
|
29
33
|
type: mongoose_1.Schema.Types.Date,
|
|
30
34
|
required: true,
|
|
31
35
|
default: null,
|
|
32
36
|
},
|
|
33
|
-
unlocked_at: {
|
|
34
|
-
type: mongoose_1.Schema.Types.Date,
|
|
35
|
-
required: true,
|
|
36
|
-
default: () => new Date(),
|
|
37
|
-
},
|
|
38
37
|
createdAt_mins: {
|
|
39
38
|
type: Number,
|
|
40
39
|
required: true,
|