@lyxa.ai/marketing 1.0.42 → 1.0.44
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/lib/event/event-initializations.d.ts.map +1 -1
- package/dist/lib/event/event-initializations.js +2 -0
- package/dist/lib/event/event-initializations.js.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.d.ts +2 -0
- package/dist/lib/event/event-listeners/event-listeners.d.ts.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.js +59 -0
- package/dist/lib/event/event-listeners/event-listeners.js.map +1 -1
- package/dist/lib/event/events/marketing-product-seed.event.d.ts +17 -0
- package/dist/lib/event/events/marketing-product-seed.event.d.ts.map +1 -0
- package/dist/lib/event/events/marketing-product-seed.event.js +12 -0
- package/dist/lib/event/events/marketing-product-seed.event.js.map +1 -0
- package/dist/lib/index.d.ts +224 -82
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts +118 -0
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js +33 -1
- package/dist/lib/modules/coupon/routers/coupon.router.js.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts +32 -0
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -0
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +504 -0
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +420 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js +40 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
- package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts +1118 -0
- package/dist/lib/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -0
- package/dist/lib/modules/coupon/validations/create-coupon.validation.js +13 -0
- package/dist/lib/modules/coupon/validations/create-coupon.validation.js.map +1 -0
- package/dist/lib/modules/coupon/validations/index.d.ts +1 -0
- package/dist/lib/modules/coupon/validations/index.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/index.js +1 -0
- package/dist/lib/modules/coupon/validations/index.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +29 -72
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js +3 -16
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +36 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +48 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +22 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js +131 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +78 -78
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +1 -2
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js +6 -11
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +16 -51
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js +33 -156
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts +8 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.js +13 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.builder.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts +14 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.js +77 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.repository.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +1 -2
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js +19 -26
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer-config.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/config/limited-time-offer.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +92 -77
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +53 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +55 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +21 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +142 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +63 -5
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js +8 -2
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js +2 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.service.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +161 -27
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js +11 -9
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +6 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js +17 -38
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +20 -8
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js +38 -27
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
- package/dist/lib/modules/marketing/routers/marketing.router.d.ts +12 -3
- package/dist/lib/modules/marketing/routers/marketing.router.d.ts.map +1 -1
- package/dist/lib/modules/marketing/routers/marketing.router.js +7 -0
- package/dist/lib/modules/marketing/routers/marketing.router.js.map +1 -1
- package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.js +11 -9
- package/dist/lib/modules/marketing/services/buy1-get1-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/discount-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/discount-marketing.service.js +15 -13
- package/dist/lib/modules/marketing/services/discount-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.d.ts +1 -0
- package/dist/lib/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/marketing.service.js +57 -7
- package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +11 -0
- package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/product-marketing.service.js +23 -0
- package/dist/lib/modules/marketing/services/product-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js +6 -31
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/validations/marketing.validation.d.ts +2 -2
- package/dist/lib/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/lib/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +2 -2
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts +1 -0
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js +14 -0
- package/dist/lib/modules/punch-marketing-history/services/punch-marketing-history.service.js.map +1 -1
- package/dist/lib/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +4 -4
- package/dist/types/event/event-initializations.d.ts.map +1 -1
- package/dist/types/event/event-listeners/event-listeners.d.ts +2 -0
- package/dist/types/event/event-listeners/event-listeners.d.ts.map +1 -1
- package/dist/types/event/events/marketing-product-seed.event.d.ts +17 -0
- package/dist/types/event/events/marketing-product-seed.event.d.ts.map +1 -0
- package/dist/types/index.d.ts +224 -82
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +118 -0
- package/dist/types/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts +32 -0
- package/dist/types/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -0
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts +420 -1
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts +1118 -0
- package/dist/types/modules/coupon/validations/create-coupon.validation.d.ts.map +1 -0
- package/dist/types/modules/coupon/validations/index.d.ts +1 -0
- package/dist/types/modules/coupon/validations/index.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +29 -72
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +36 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +22 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +78 -78
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +1 -2
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +16 -51
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts +8 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.builder.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts +14 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.repository.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts +1 -2
- package/dist/types/modules/limited-time-offer/config/limited-time-offer-config.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/config/limited-time-offer.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +92 -77
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +53 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +21 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +63 -5
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts +161 -27
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts +6 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts +20 -8
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/routers/marketing.router.d.ts +12 -3
- package/dist/types/modules/marketing/routers/marketing.router.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/buy1-get1-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/discount-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/marketing.service.d.ts +1 -0
- package/dist/types/modules/marketing/services/marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/product-marketing.service.d.ts +11 -0
- package/dist/types/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/services/synchronize-product-marketing.service.d.ts.map +1 -1
- package/dist/types/modules/marketing/validations/marketing.validation.d.ts +2 -2
- package/dist/types/modules/marketing/validations/product-marketing.validation.d.ts +2 -2
- package/dist/types/modules/punch-marketing-history/routers/punch-marketing-history.router.d.ts +2 -2
- package/dist/types/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts +1 -0
- package/dist/types/modules/punch-marketing-history/services/punch-marketing-history.service.d.ts.map +1 -1
- package/dist/types/modules/punch-marketing-history/validations/punch-marketing-history.validation.d.ts +4 -4
- package/package.json +3 -3
- package/dist/types/events/event-initializations.d.ts +0 -2
- package/dist/types/events/event-initializations.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { DTO } from '@lyxa.ai/core/dist/utilities/validation/global-validation';
|
|
3
|
-
import { CouponExpirationReason, Status, ValueType } from '@lyxa.ai/core/dist/utilities/enum';
|
|
3
|
+
import { CouponExpirationReason, CouponType, GraphType, ItemType, Status, ValueType } from '@lyxa.ai/core/dist/utilities/enum';
|
|
4
4
|
export declare const couponFields: {
|
|
5
5
|
code: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
6
6
|
orderLimitPerUser: z.ZodDefault<z.ZodNullable<z.ZodOptional<z.ZodNumber>>>;
|
|
@@ -1476,6 +1476,421 @@ export declare const IsNewUserGiftBoxShownSchema: z.ZodObject<{
|
|
|
1476
1476
|
}, {
|
|
1477
1477
|
isNewUserGiftBoxShown: boolean;
|
|
1478
1478
|
}>;
|
|
1479
|
+
export declare const BaseDateInputSchema: z.ZodObject<{
|
|
1480
|
+
startDate: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>, Date, string | Date>;
|
|
1481
|
+
endDate: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>, Date, string | Date>;
|
|
1482
|
+
}, "strict", z.ZodTypeAny, {
|
|
1483
|
+
startDate: Date;
|
|
1484
|
+
endDate: Date;
|
|
1485
|
+
}, {
|
|
1486
|
+
startDate: string | Date;
|
|
1487
|
+
endDate: string | Date;
|
|
1488
|
+
}>;
|
|
1489
|
+
export declare const DateInputSchema: z.ZodEffects<z.ZodObject<{
|
|
1490
|
+
startDate: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>, Date, string | Date>;
|
|
1491
|
+
endDate: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>, Date, string | Date>;
|
|
1492
|
+
}, "strict", z.ZodTypeAny, {
|
|
1493
|
+
startDate: Date;
|
|
1494
|
+
endDate: Date;
|
|
1495
|
+
}, {
|
|
1496
|
+
startDate: string | Date;
|
|
1497
|
+
endDate: string | Date;
|
|
1498
|
+
}>, {
|
|
1499
|
+
startDate: Date;
|
|
1500
|
+
endDate: Date;
|
|
1501
|
+
}, {
|
|
1502
|
+
startDate: string | Date;
|
|
1503
|
+
endDate: string | Date;
|
|
1504
|
+
}>;
|
|
1505
|
+
export declare const GraphInputSchema: z.ZodEffects<z.ZodObject<{
|
|
1506
|
+
startDate: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>, Date, string | Date>;
|
|
1507
|
+
endDate: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Date, string>, z.ZodDate]>, Date, string | Date>, Date, string | Date>, Date, string | Date>;
|
|
1508
|
+
} & {
|
|
1509
|
+
graphType: z.ZodDefault<z.ZodNativeEnum<typeof GraphType>>;
|
|
1510
|
+
itemType: z.ZodOptional<z.ZodNativeEnum<typeof ItemType>>;
|
|
1511
|
+
}, "strict", z.ZodTypeAny, {
|
|
1512
|
+
startDate: Date;
|
|
1513
|
+
endDate: Date;
|
|
1514
|
+
graphType: GraphType;
|
|
1515
|
+
itemType?: ItemType | undefined;
|
|
1516
|
+
}, {
|
|
1517
|
+
startDate: string | Date;
|
|
1518
|
+
endDate: string | Date;
|
|
1519
|
+
graphType?: GraphType | undefined;
|
|
1520
|
+
itemType?: ItemType | undefined;
|
|
1521
|
+
}>, {
|
|
1522
|
+
startDate: Date;
|
|
1523
|
+
endDate: Date;
|
|
1524
|
+
graphType: GraphType;
|
|
1525
|
+
itemType?: ItemType | undefined;
|
|
1526
|
+
}, {
|
|
1527
|
+
startDate: string | Date;
|
|
1528
|
+
endDate: string | Date;
|
|
1529
|
+
graphType?: GraphType | undefined;
|
|
1530
|
+
itemType?: ItemType | undefined;
|
|
1531
|
+
}>;
|
|
1532
|
+
export declare const CouponMetricsOutputSchema: z.ZodObject<{
|
|
1533
|
+
activeCoupons: z.ZodDefault<z.ZodNumber>;
|
|
1534
|
+
totalCreated: z.ZodDefault<z.ZodNumber>;
|
|
1535
|
+
totalRedeemedCoupons: z.ZodDefault<z.ZodNumber>;
|
|
1536
|
+
redemptionRate: z.ZodDefault<z.ZodNumber>;
|
|
1537
|
+
totalCouponOrders: z.ZodDefault<z.ZodNumber>;
|
|
1538
|
+
totalRevenue: z.ZodDefault<z.ZodNumber>;
|
|
1539
|
+
totalProfit: z.ZodDefault<z.ZodNumber>;
|
|
1540
|
+
}, "strip", z.ZodTypeAny, {
|
|
1541
|
+
activeCoupons: number;
|
|
1542
|
+
totalCreated: number;
|
|
1543
|
+
totalRedeemedCoupons: number;
|
|
1544
|
+
redemptionRate: number;
|
|
1545
|
+
totalCouponOrders: number;
|
|
1546
|
+
totalRevenue: number;
|
|
1547
|
+
totalProfit: number;
|
|
1548
|
+
}, {
|
|
1549
|
+
activeCoupons?: number | undefined;
|
|
1550
|
+
totalCreated?: number | undefined;
|
|
1551
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1552
|
+
redemptionRate?: number | undefined;
|
|
1553
|
+
totalCouponOrders?: number | undefined;
|
|
1554
|
+
totalRevenue?: number | undefined;
|
|
1555
|
+
totalProfit?: number | undefined;
|
|
1556
|
+
}>;
|
|
1557
|
+
export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
1558
|
+
success: z.ZodBoolean;
|
|
1559
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
1560
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
1561
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
1562
|
+
page: z.ZodNumber;
|
|
1563
|
+
size: z.ZodNumber;
|
|
1564
|
+
totalElements: z.ZodNumber;
|
|
1565
|
+
totalPages: z.ZodNumber;
|
|
1566
|
+
}, "strip", z.ZodTypeAny, {
|
|
1567
|
+
page: number;
|
|
1568
|
+
size: number;
|
|
1569
|
+
totalElements: number;
|
|
1570
|
+
totalPages: number;
|
|
1571
|
+
}, {
|
|
1572
|
+
page: number;
|
|
1573
|
+
size: number;
|
|
1574
|
+
totalElements: number;
|
|
1575
|
+
totalPages: number;
|
|
1576
|
+
}>>;
|
|
1577
|
+
documents: z.ZodArray<z.ZodType<{
|
|
1578
|
+
activeCoupons?: number | undefined;
|
|
1579
|
+
totalCreated?: number | undefined;
|
|
1580
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1581
|
+
redemptionRate?: number | undefined;
|
|
1582
|
+
totalCouponOrders?: number | undefined;
|
|
1583
|
+
totalRevenue?: number | undefined;
|
|
1584
|
+
totalProfit?: number | undefined;
|
|
1585
|
+
}, z.ZodTypeDef, {
|
|
1586
|
+
activeCoupons?: number | undefined;
|
|
1587
|
+
totalCreated?: number | undefined;
|
|
1588
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1589
|
+
redemptionRate?: number | undefined;
|
|
1590
|
+
totalCouponOrders?: number | undefined;
|
|
1591
|
+
totalRevenue?: number | undefined;
|
|
1592
|
+
totalProfit?: number | undefined;
|
|
1593
|
+
}>, "many">;
|
|
1594
|
+
}, "strip", z.ZodTypeAny, {
|
|
1595
|
+
documents: {
|
|
1596
|
+
activeCoupons?: number | undefined;
|
|
1597
|
+
totalCreated?: number | undefined;
|
|
1598
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1599
|
+
redemptionRate?: number | undefined;
|
|
1600
|
+
totalCouponOrders?: number | undefined;
|
|
1601
|
+
totalRevenue?: number | undefined;
|
|
1602
|
+
totalProfit?: number | undefined;
|
|
1603
|
+
}[];
|
|
1604
|
+
metadata?: {
|
|
1605
|
+
page: number;
|
|
1606
|
+
size: number;
|
|
1607
|
+
totalElements: number;
|
|
1608
|
+
totalPages: number;
|
|
1609
|
+
} | undefined;
|
|
1610
|
+
}, {
|
|
1611
|
+
documents: {
|
|
1612
|
+
activeCoupons?: number | undefined;
|
|
1613
|
+
totalCreated?: number | undefined;
|
|
1614
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1615
|
+
redemptionRate?: number | undefined;
|
|
1616
|
+
totalCouponOrders?: number | undefined;
|
|
1617
|
+
totalRevenue?: number | undefined;
|
|
1618
|
+
totalProfit?: number | undefined;
|
|
1619
|
+
}[];
|
|
1620
|
+
metadata?: {
|
|
1621
|
+
page: number;
|
|
1622
|
+
size: number;
|
|
1623
|
+
totalElements: number;
|
|
1624
|
+
totalPages: number;
|
|
1625
|
+
} | undefined;
|
|
1626
|
+
}>, z.ZodType<{
|
|
1627
|
+
activeCoupons?: number | undefined;
|
|
1628
|
+
totalCreated?: number | undefined;
|
|
1629
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1630
|
+
redemptionRate?: number | undefined;
|
|
1631
|
+
totalCouponOrders?: number | undefined;
|
|
1632
|
+
totalRevenue?: number | undefined;
|
|
1633
|
+
totalProfit?: number | undefined;
|
|
1634
|
+
}, z.ZodTypeDef, {
|
|
1635
|
+
activeCoupons?: number | undefined;
|
|
1636
|
+
totalCreated?: number | undefined;
|
|
1637
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1638
|
+
redemptionRate?: number | undefined;
|
|
1639
|
+
totalCouponOrders?: number | undefined;
|
|
1640
|
+
totalRevenue?: number | undefined;
|
|
1641
|
+
totalProfit?: number | undefined;
|
|
1642
|
+
}>]>>;
|
|
1643
|
+
}, "strip", z.ZodTypeAny, {
|
|
1644
|
+
message: string;
|
|
1645
|
+
success: boolean;
|
|
1646
|
+
data?: {
|
|
1647
|
+
activeCoupons?: number | undefined;
|
|
1648
|
+
totalCreated?: number | undefined;
|
|
1649
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1650
|
+
redemptionRate?: number | undefined;
|
|
1651
|
+
totalCouponOrders?: number | undefined;
|
|
1652
|
+
totalRevenue?: number | undefined;
|
|
1653
|
+
totalProfit?: number | undefined;
|
|
1654
|
+
} | {
|
|
1655
|
+
documents: {
|
|
1656
|
+
activeCoupons?: number | undefined;
|
|
1657
|
+
totalCreated?: number | undefined;
|
|
1658
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1659
|
+
redemptionRate?: number | undefined;
|
|
1660
|
+
totalCouponOrders?: number | undefined;
|
|
1661
|
+
totalRevenue?: number | undefined;
|
|
1662
|
+
totalProfit?: number | undefined;
|
|
1663
|
+
}[];
|
|
1664
|
+
metadata?: {
|
|
1665
|
+
page: number;
|
|
1666
|
+
size: number;
|
|
1667
|
+
totalElements: number;
|
|
1668
|
+
totalPages: number;
|
|
1669
|
+
} | undefined;
|
|
1670
|
+
} | undefined;
|
|
1671
|
+
}, {
|
|
1672
|
+
message: string;
|
|
1673
|
+
success: boolean;
|
|
1674
|
+
data?: {
|
|
1675
|
+
activeCoupons?: number | undefined;
|
|
1676
|
+
totalCreated?: number | undefined;
|
|
1677
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1678
|
+
redemptionRate?: number | undefined;
|
|
1679
|
+
totalCouponOrders?: number | undefined;
|
|
1680
|
+
totalRevenue?: number | undefined;
|
|
1681
|
+
totalProfit?: number | undefined;
|
|
1682
|
+
} | {
|
|
1683
|
+
documents: {
|
|
1684
|
+
activeCoupons?: number | undefined;
|
|
1685
|
+
totalCreated?: number | undefined;
|
|
1686
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1687
|
+
redemptionRate?: number | undefined;
|
|
1688
|
+
totalCouponOrders?: number | undefined;
|
|
1689
|
+
totalRevenue?: number | undefined;
|
|
1690
|
+
totalProfit?: number | undefined;
|
|
1691
|
+
}[];
|
|
1692
|
+
metadata?: {
|
|
1693
|
+
page: number;
|
|
1694
|
+
size: number;
|
|
1695
|
+
totalElements: number;
|
|
1696
|
+
totalPages: number;
|
|
1697
|
+
} | undefined;
|
|
1698
|
+
} | undefined;
|
|
1699
|
+
}>;
|
|
1700
|
+
export declare const CouponMetricsByTypeSchema: z.ZodObject<{
|
|
1701
|
+
couponType: z.ZodNativeEnum<typeof CouponType>;
|
|
1702
|
+
couponTypeTitle: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
1703
|
+
totalCouponOrders: z.ZodDefault<z.ZodNumber>;
|
|
1704
|
+
totalRevenue: z.ZodDefault<z.ZodNumber>;
|
|
1705
|
+
totalProfit: z.ZodDefault<z.ZodNumber>;
|
|
1706
|
+
averageOrderValue: z.ZodDefault<z.ZodNumber>;
|
|
1707
|
+
usage: z.ZodDefault<z.ZodNumber>;
|
|
1708
|
+
ongoing: z.ZodDefault<z.ZodNumber>;
|
|
1709
|
+
redemptionRate: z.ZodDefault<z.ZodNumber>;
|
|
1710
|
+
}, "strip", z.ZodTypeAny, {
|
|
1711
|
+
redemptionRate: number;
|
|
1712
|
+
totalCouponOrders: number;
|
|
1713
|
+
totalRevenue: number;
|
|
1714
|
+
totalProfit: number;
|
|
1715
|
+
couponType: CouponType;
|
|
1716
|
+
couponTypeTitle: string;
|
|
1717
|
+
averageOrderValue: number;
|
|
1718
|
+
usage: number;
|
|
1719
|
+
ongoing: number;
|
|
1720
|
+
}, {
|
|
1721
|
+
couponType: CouponType;
|
|
1722
|
+
couponTypeTitle: string;
|
|
1723
|
+
redemptionRate?: number | undefined;
|
|
1724
|
+
totalCouponOrders?: number | undefined;
|
|
1725
|
+
totalRevenue?: number | undefined;
|
|
1726
|
+
totalProfit?: number | undefined;
|
|
1727
|
+
averageOrderValue?: number | undefined;
|
|
1728
|
+
usage?: number | undefined;
|
|
1729
|
+
ongoing?: number | undefined;
|
|
1730
|
+
}>;
|
|
1731
|
+
export declare const CouponMetricsByTypeResponseSchema: z.ZodObject<{
|
|
1732
|
+
success: z.ZodBoolean;
|
|
1733
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
1734
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
1735
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
1736
|
+
page: z.ZodNumber;
|
|
1737
|
+
size: z.ZodNumber;
|
|
1738
|
+
totalElements: z.ZodNumber;
|
|
1739
|
+
totalPages: z.ZodNumber;
|
|
1740
|
+
}, "strip", z.ZodTypeAny, {
|
|
1741
|
+
page: number;
|
|
1742
|
+
size: number;
|
|
1743
|
+
totalElements: number;
|
|
1744
|
+
totalPages: number;
|
|
1745
|
+
}, {
|
|
1746
|
+
page: number;
|
|
1747
|
+
size: number;
|
|
1748
|
+
totalElements: number;
|
|
1749
|
+
totalPages: number;
|
|
1750
|
+
}>>;
|
|
1751
|
+
documents: z.ZodArray<z.ZodType<{
|
|
1752
|
+
couponType: CouponType;
|
|
1753
|
+
couponTypeTitle: string;
|
|
1754
|
+
redemptionRate?: number | undefined;
|
|
1755
|
+
totalCouponOrders?: number | undefined;
|
|
1756
|
+
totalRevenue?: number | undefined;
|
|
1757
|
+
totalProfit?: number | undefined;
|
|
1758
|
+
averageOrderValue?: number | undefined;
|
|
1759
|
+
usage?: number | undefined;
|
|
1760
|
+
ongoing?: number | undefined;
|
|
1761
|
+
}[], z.ZodTypeDef, {
|
|
1762
|
+
couponType: CouponType;
|
|
1763
|
+
couponTypeTitle: string;
|
|
1764
|
+
redemptionRate?: number | undefined;
|
|
1765
|
+
totalCouponOrders?: number | undefined;
|
|
1766
|
+
totalRevenue?: number | undefined;
|
|
1767
|
+
totalProfit?: number | undefined;
|
|
1768
|
+
averageOrderValue?: number | undefined;
|
|
1769
|
+
usage?: number | undefined;
|
|
1770
|
+
ongoing?: number | undefined;
|
|
1771
|
+
}[]>, "many">;
|
|
1772
|
+
}, "strip", z.ZodTypeAny, {
|
|
1773
|
+
documents: {
|
|
1774
|
+
couponType: CouponType;
|
|
1775
|
+
couponTypeTitle: string;
|
|
1776
|
+
redemptionRate?: number | undefined;
|
|
1777
|
+
totalCouponOrders?: number | undefined;
|
|
1778
|
+
totalRevenue?: number | undefined;
|
|
1779
|
+
totalProfit?: number | undefined;
|
|
1780
|
+
averageOrderValue?: number | undefined;
|
|
1781
|
+
usage?: number | undefined;
|
|
1782
|
+
ongoing?: number | undefined;
|
|
1783
|
+
}[][];
|
|
1784
|
+
metadata?: {
|
|
1785
|
+
page: number;
|
|
1786
|
+
size: number;
|
|
1787
|
+
totalElements: number;
|
|
1788
|
+
totalPages: number;
|
|
1789
|
+
} | undefined;
|
|
1790
|
+
}, {
|
|
1791
|
+
documents: {
|
|
1792
|
+
couponType: CouponType;
|
|
1793
|
+
couponTypeTitle: string;
|
|
1794
|
+
redemptionRate?: number | undefined;
|
|
1795
|
+
totalCouponOrders?: number | undefined;
|
|
1796
|
+
totalRevenue?: number | undefined;
|
|
1797
|
+
totalProfit?: number | undefined;
|
|
1798
|
+
averageOrderValue?: number | undefined;
|
|
1799
|
+
usage?: number | undefined;
|
|
1800
|
+
ongoing?: number | undefined;
|
|
1801
|
+
}[][];
|
|
1802
|
+
metadata?: {
|
|
1803
|
+
page: number;
|
|
1804
|
+
size: number;
|
|
1805
|
+
totalElements: number;
|
|
1806
|
+
totalPages: number;
|
|
1807
|
+
} | undefined;
|
|
1808
|
+
}>, z.ZodType<{
|
|
1809
|
+
couponType: CouponType;
|
|
1810
|
+
couponTypeTitle: string;
|
|
1811
|
+
redemptionRate?: number | undefined;
|
|
1812
|
+
totalCouponOrders?: number | undefined;
|
|
1813
|
+
totalRevenue?: number | undefined;
|
|
1814
|
+
totalProfit?: number | undefined;
|
|
1815
|
+
averageOrderValue?: number | undefined;
|
|
1816
|
+
usage?: number | undefined;
|
|
1817
|
+
ongoing?: number | undefined;
|
|
1818
|
+
}[], z.ZodTypeDef, {
|
|
1819
|
+
couponType: CouponType;
|
|
1820
|
+
couponTypeTitle: string;
|
|
1821
|
+
redemptionRate?: number | undefined;
|
|
1822
|
+
totalCouponOrders?: number | undefined;
|
|
1823
|
+
totalRevenue?: number | undefined;
|
|
1824
|
+
totalProfit?: number | undefined;
|
|
1825
|
+
averageOrderValue?: number | undefined;
|
|
1826
|
+
usage?: number | undefined;
|
|
1827
|
+
ongoing?: number | undefined;
|
|
1828
|
+
}[]>]>>;
|
|
1829
|
+
}, "strip", z.ZodTypeAny, {
|
|
1830
|
+
message: string;
|
|
1831
|
+
success: boolean;
|
|
1832
|
+
data?: {
|
|
1833
|
+
couponType: CouponType;
|
|
1834
|
+
couponTypeTitle: string;
|
|
1835
|
+
redemptionRate?: number | undefined;
|
|
1836
|
+
totalCouponOrders?: number | undefined;
|
|
1837
|
+
totalRevenue?: number | undefined;
|
|
1838
|
+
totalProfit?: number | undefined;
|
|
1839
|
+
averageOrderValue?: number | undefined;
|
|
1840
|
+
usage?: number | undefined;
|
|
1841
|
+
ongoing?: number | undefined;
|
|
1842
|
+
}[] | {
|
|
1843
|
+
documents: {
|
|
1844
|
+
couponType: CouponType;
|
|
1845
|
+
couponTypeTitle: string;
|
|
1846
|
+
redemptionRate?: number | undefined;
|
|
1847
|
+
totalCouponOrders?: number | undefined;
|
|
1848
|
+
totalRevenue?: number | undefined;
|
|
1849
|
+
totalProfit?: number | undefined;
|
|
1850
|
+
averageOrderValue?: number | undefined;
|
|
1851
|
+
usage?: number | undefined;
|
|
1852
|
+
ongoing?: number | undefined;
|
|
1853
|
+
}[][];
|
|
1854
|
+
metadata?: {
|
|
1855
|
+
page: number;
|
|
1856
|
+
size: number;
|
|
1857
|
+
totalElements: number;
|
|
1858
|
+
totalPages: number;
|
|
1859
|
+
} | undefined;
|
|
1860
|
+
} | undefined;
|
|
1861
|
+
}, {
|
|
1862
|
+
message: string;
|
|
1863
|
+
success: boolean;
|
|
1864
|
+
data?: {
|
|
1865
|
+
couponType: CouponType;
|
|
1866
|
+
couponTypeTitle: string;
|
|
1867
|
+
redemptionRate?: number | undefined;
|
|
1868
|
+
totalCouponOrders?: number | undefined;
|
|
1869
|
+
totalRevenue?: number | undefined;
|
|
1870
|
+
totalProfit?: number | undefined;
|
|
1871
|
+
averageOrderValue?: number | undefined;
|
|
1872
|
+
usage?: number | undefined;
|
|
1873
|
+
ongoing?: number | undefined;
|
|
1874
|
+
}[] | {
|
|
1875
|
+
documents: {
|
|
1876
|
+
couponType: CouponType;
|
|
1877
|
+
couponTypeTitle: string;
|
|
1878
|
+
redemptionRate?: number | undefined;
|
|
1879
|
+
totalCouponOrders?: number | undefined;
|
|
1880
|
+
totalRevenue?: number | undefined;
|
|
1881
|
+
totalProfit?: number | undefined;
|
|
1882
|
+
averageOrderValue?: number | undefined;
|
|
1883
|
+
usage?: number | undefined;
|
|
1884
|
+
ongoing?: number | undefined;
|
|
1885
|
+
}[][];
|
|
1886
|
+
metadata?: {
|
|
1887
|
+
page: number;
|
|
1888
|
+
size: number;
|
|
1889
|
+
totalElements: number;
|
|
1890
|
+
totalPages: number;
|
|
1891
|
+
} | undefined;
|
|
1892
|
+
} | undefined;
|
|
1893
|
+
}>;
|
|
1479
1894
|
export type CreateCouponDTO = DTO<typeof CouponValidationSchema>;
|
|
1480
1895
|
export type CouponDTO = DTO<typeof CouponSchema>;
|
|
1481
1896
|
export type UpdateCouponDTO = DTO<typeof UpdateCouponSchema>;
|
|
@@ -1487,4 +1902,8 @@ export type UpdateCouponStatusDTO = DTO<typeof UpdateCouponStatusSchema>;
|
|
|
1487
1902
|
export type CheckExistingNewUserCouponOutputDTO = DTO<typeof CheckExistingNewUserCouponOutputSchema>;
|
|
1488
1903
|
export type DeviceIdDTO = DTO<typeof DeviceIdSchema>;
|
|
1489
1904
|
export type IsNewUserGiftBoxShownDTO = DTO<typeof IsNewUserGiftBoxShownSchema>;
|
|
1905
|
+
export type DateInputDTO = DTO<typeof DateInputSchema>;
|
|
1906
|
+
export type GraphInputDTO = DTO<typeof GraphInputSchema>;
|
|
1907
|
+
export type CouponMetricsOutputDTO = DTO<typeof CouponMetricsOutputSchema>;
|
|
1908
|
+
export type CouponMetricsByTypeDTO = DTO<typeof CouponMetricsByTypeSchema>;
|
|
1490
1909
|
//# sourceMappingURL=coupon.validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.validation.d.ts","sourceRoot":"/","sources":["modules/coupon/validations/coupon.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGN,GAAG,EACH,MAAM,2DAA2D,CAAC;AACnE,OAAO,
|
|
1
|
+
{"version":3,"file":"coupon.validation.d.ts","sourceRoot":"/","sources":["modules/coupon/validations/coupon.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGN,GAAG,EACH,MAAM,2DAA2D,CAAC;AACnE,OAAO,EACN,sBAAsB,EACtB,UAAU,EACV,SAAS,EACT,QAAQ,EACR,MAAM,EACN,SAAS,EACT,MAAM,mCAAmC,CAAC;AAU3C,eAAO,MAAM,YAAY;;;;;;CAkBxB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCtB,CAAC;AAYF,QAAA,MACa,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACpB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAChB,cAAc,mNACV,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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iftBoxShownSchema = exports.DeviceIdSchema = exports.CouponValidationResponseSchema = exports.CheckExistingNewUserCouponOutputSchema = exports.UpdateCouponStatusSchema = exports.CouponCodeSchema = exports.CouponValidationOutputSchema = exports.ValidateCouponSchema = exports.GetUserCouponSchema = exports.UpdateCouponSchema = exports.CouponIdValidationSchema = exports.CouponSchema = exports.CouponValidationSchema = exports.GetUserCouponsResponseSchema = exports.baseFields = exports.couponFields = void 0;
|
|
3
|
+
exports.CouponMetricsByTypeResponseSchema = exports.CouponMetricsByTypeSchema = exports.CouponMetricsResponseSchema = exports.CouponMetricsOutputSchema = exports.GraphInputSchema = exports.DateInputSchema = exports.BaseDateInputSchema = exports.IsNewUserGiftBoxShownSchema = exports.DeviceIdSchema = exports.CouponValidationResponseSchema = exports.CheckExistingNewUserCouponOutputSchema = exports.UpdateCouponStatusSchema = exports.CouponCodeSchema = exports.CouponValidationOutputSchema = exports.ValidateCouponSchema = exports.GetUserCouponSchema = exports.UpdateCouponSchema = exports.CouponIdValidationSchema = exports.CouponSchema = exports.CouponValidationSchema = exports.GetUserCouponsResponseSchema = exports.baseFields = exports.couponFields = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const global_validation_1 = require("@lyxa.ai/core/dist/utilities/validation/global-validation");
|
|
6
6
|
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
@@ -112,4 +112,43 @@ exports.CheckExistingNewUserCouponOutputSchema = zod_1.z.object({
|
|
|
112
112
|
exports.CouponValidationResponseSchema = (0, common_validation_1.createResponseSchema)(exports.CouponValidationOutputSchema);
|
|
113
113
|
exports.DeviceIdSchema = zod_1.z.object({ deviceId: zod_1.z.string() });
|
|
114
114
|
exports.IsNewUserGiftBoxShownSchema = zod_1.z.object({ isNewUserGiftBoxShown: zod_1.z.boolean() });
|
|
115
|
+
exports.BaseDateInputSchema = zod_1.z
|
|
116
|
+
.object({
|
|
117
|
+
startDate: global_validation_1.ZodValidation.date('Start Date').transform(val => (0, dayjs_1.dayjs)(val).startOf('day').toDate()),
|
|
118
|
+
endDate: global_validation_1.ZodValidation.date('End Date').transform(val => (0, dayjs_1.dayjs)(val).endOf('day').toDate()),
|
|
119
|
+
})
|
|
120
|
+
.strict();
|
|
121
|
+
exports.DateInputSchema = exports.BaseDateInputSchema.refine(data => !(0, dayjs_1.dayjs)(data.startDate).isAfter((0, dayjs_1.dayjs)(data.endDate)), {
|
|
122
|
+
message: 'Start date cannot be after end date',
|
|
123
|
+
path: ['startDate'],
|
|
124
|
+
});
|
|
125
|
+
exports.GraphInputSchema = exports.BaseDateInputSchema.extend({
|
|
126
|
+
graphType: global_validation_1.ZodValidation.enumType(enum_1.GraphType, 'Type').default(enum_1.GraphType.DAILY),
|
|
127
|
+
itemType: global_validation_1.ZodValidation.enumType(enum_1.ItemType, 'Item Type').optional(),
|
|
128
|
+
}).refine(data => !(0, dayjs_1.dayjs)(data.startDate).isAfter((0, dayjs_1.dayjs)(data.endDate)), {
|
|
129
|
+
message: 'Start date cannot be after end date',
|
|
130
|
+
path: ['startDate'],
|
|
131
|
+
});
|
|
132
|
+
exports.CouponMetricsOutputSchema = zod_1.z.object({
|
|
133
|
+
activeCoupons: global_validation_1.ZodValidation.number('Active coupons').default(0),
|
|
134
|
+
totalCreated: global_validation_1.ZodValidation.number('Total created coupons').default(0),
|
|
135
|
+
totalRedeemedCoupons: global_validation_1.ZodValidation.number('Total redeemed coupons').default(0),
|
|
136
|
+
redemptionRate: global_validation_1.ZodValidation.number('Redemption rate').default(0),
|
|
137
|
+
totalCouponOrders: global_validation_1.ZodValidation.number('Total coupon orders').default(0),
|
|
138
|
+
totalRevenue: global_validation_1.ZodValidation.number('Total revenue from coupons').default(0),
|
|
139
|
+
totalProfit: global_validation_1.ZodValidation.number('Total profit from coupons').default(0),
|
|
140
|
+
});
|
|
141
|
+
exports.CouponMetricsResponseSchema = (0, common_validation_1.createResponseSchema)(exports.CouponMetricsOutputSchema);
|
|
142
|
+
exports.CouponMetricsByTypeSchema = zod_1.z.object({
|
|
143
|
+
couponType: global_validation_1.ZodValidation.enumType(enum_1.CouponType, 'Coupon Type'),
|
|
144
|
+
couponTypeTitle: global_validation_1.ZodValidation.string('Coupon Type Title'),
|
|
145
|
+
totalCouponOrders: global_validation_1.ZodValidation.number('Total coupon orders').default(0),
|
|
146
|
+
totalRevenue: global_validation_1.ZodValidation.number('Total revenue from coupons').default(0),
|
|
147
|
+
totalProfit: global_validation_1.ZodValidation.number('Total profit from coupons').default(0),
|
|
148
|
+
averageOrderValue: global_validation_1.ZodValidation.number('Average order value for coupons of this type').default(0),
|
|
149
|
+
usage: global_validation_1.ZodValidation.number('Usage').default(0),
|
|
150
|
+
ongoing: global_validation_1.ZodValidation.number('Ongoing').default(0),
|
|
151
|
+
redemptionRate: global_validation_1.ZodValidation.number('Redemption rate for this coupon type').default(0),
|
|
152
|
+
});
|
|
153
|
+
exports.CouponMetricsByTypeResponseSchema = (0, common_validation_1.createResponseSchema)(exports.CouponMetricsByTypeSchema.array());
|
|
115
154
|
//# sourceMappingURL=coupon.validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.validation.js","sourceRoot":"/","sources":["modules/coupon/validations/coupon.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAImE;AACnE,4DAA0G;AAC1G,iGAGmE;AACnE,8DAA2D;AAK9C,QAAA,YAAY,GAAG;IAC3B,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,MAAM,EAAE;QAClC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE;QACvF,SAAS,EAAE,EAAE;QACb,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,6BAA6B;QACzC,UAAU,EAAE,8BAA8B;KAC1C,CAAC;IACF,iBAAiB,EAAE,iCAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC;SAC1D,WAAW,EAAE;SACb,QAAQ,EA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C,CAAC,QAAQ,EAAE;CAC/C,CAAC,CAAC;AAEU,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,UAAU,EAAE,iCAAa,CAAC,MAAM,CAAC,aAAa,CAAC;CAC/C,CAAC,CAAC;AAEU,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChD,GAAG,EAAE,iCAAa,CAAC,sBAAsB;IACzC,MAAM,EAAE,iCAAa,CAAC,QAAQ,CAAC,aAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,aAAM,CAAC,MAAM,CAAC;CAClF,CAAC,CAAC;AAEU,QAAA,sCAAsC,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9D,MAAM,EAAE,iCAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;CACtD,CAAC,CAAC;AAEU,QAAA,8BAA8B,GAAG,IAAA,wCAAoB,EAAC,oCAA4B,CAAC,CAAC;AAEpF,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACpD,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,qBAAqB,EAAE,OAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n\tZodValidation,\n\tcreateSchemaBuilder,\n\tDTO,\n} from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport { CouponExpirationReason, CouponType, Status, ValueType } from '@lyxa.ai/core/dist/utilities/enum';\nimport {\n\tcreateResponseSchema,\n\tDurationSchema,\n} from '@lyxa.ai/core/dist/utilities/validation/common-validation';\nimport { dayjs } from '@lyxa.ai/core/dist/utilities/dayjs';\n\n/**\n * Define the base parent schema fields\n */\nexport const couponFields = {\n\tcode: ZodValidation.string('Code', {\n\t\tregex: { pattern: new RegExp('^[A-Z0-9]+$'), message: 'Coupon name must be uppercase' },\n\t\tmaxLength: 10,\n\t\tminLength: 4,\n\t\tminMessage: 'Coupon must be 4 characters',\n\t\tmaxMessage: 'Coupon must be 10 characters',\n\t}),\n\torderLimitPerUser: ZodValidation.number('OrderLimitPerUser')\n\t\t.nonnegative()\n\t\t.optional()\n\t\t.nullable()\n\t\t.default(null),\n\tisOrderLimitPerUserEnabled: ZodValidation.boolean('Is order limit per user enabled')\n\t\t.optional()\n\t\t.default(false),\n\tcreatedBy: ZodValidation.objectId('Created by').optional(),\n\tisExpired: ZodValidation.boolean('Is expired').optional(),\n};\n\nexport const baseFields = {\n\t...couponFields,\n\tvalueType: ZodValidation.enumType(ValueType, 'Value type'),\n\tvalue: ZodValidation.number('Value'),\n\tsecondaryCurrencyValue: ZodValidation.number('Secondary currency value').optional(),\n\tmaxDiscountLimit: ZodValidation.number('Max discount limit').optional().nullable().default(null),\n\tsecondaryCurrencyMaxDiscountLimit: ZodValidation.number('Secondary currency max discount limit').optional(),\n\tisMaxDiscountLimitEnabled: ZodValidation.boolean('Is max discount limit enabled').optional().default(false),\n\tduration: DurationSchema\n\t\t// .refine((d: any) => d.start >= new Date() && d.end >= new Date(), {\n\t\t// \tmessage: 'Start and end dates must not be in the past',\n\t\t// })\n\t\t.transform(duration => {\n\t\t\tduration.start = dayjs(duration.start).toDate();\n\t\t\tduration.end = dayjs(duration.end).toDate();\n\t\t\treturn duration;\n\t\t}),\n\tspendLimit: ZodValidation.number('Spend limit').optional().nullable().default(null),\n\tisSpendLimitEnabled: ZodValidation.boolean('Is spend limit enabled').optional().default(false),\n\ttotalOrderLimit: ZodValidation.number('Total order limit').optional().nullable().default(null),\n\tisTotalOrderLimitEnabled: ZodValidation.boolean('Is total order limit enabled').optional().default(false),\n\tminOrderValue: ZodValidation.number('Min order value').nullable().default(null),\n\tsecondaryCurrencyMinOrderValue: ZodValidation.number('Secondary currency min order value').optional(),\n\tisMinOrderValueEnabled: ZodValidation.boolean('Is min order value enabled').optional().default(false),\n\tforNewUserOnly: ZodValidation.boolean('ForNewUserOnly').optional().default(false),\n\tstatus: ZodValidation.enumType(Status, 'Status').optional().default(Status.ACTIVE),\n\texpirationReason: ZodValidation.enumType(CouponExpirationReason, 'Expiration reason')\n\t\t.optional()\n\t\t.nullable()\n\t\t.default(null),\n\treferringUser: z\n\t\t.object({\n\t\t\tname: ZodValidation.string('Referring user name').optional(),\n\t\t})\n\t\t.optional(),\n};\n\n/**\n * Create schema builder for Parent entity\n * - Includes timestamps\n * - Excludes 'createdAt' from update operations\n */\nconst schemaBuilder = createSchemaBuilder(baseFields);\n\n/**\n * Get all schemas for the Parent entity\n */\nconst {\n\tBaseSchema: CouponValidationSchema,\n\tEntitySchema: CouponSchema,\n\tIdSchema: CouponIdSchema,\n\tUpdateSchema: UpdateCouponSchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\n/**\n * Export schemas\n */\nexport const GetUserCouponsResponseSchema = z.object({\n\tavailable: z.array(CouponSchema),\n\tused: z.array(CouponSchema),\n\texpired: z.array(CouponSchema),\n});\n\nexport {\n\tCouponValidationSchema,\n\tCouponSchema,\n\tCouponIdSchema as CouponIdValidationSchema,\n\tUpdateCouponSchema,\n};\n\n/**\n * Schema for getting user coupons\n */\nexport const GetUserCouponSchema = z.object({\n\tuser: ZodValidation.objectId('User').optional(),\n\tshop: ZodValidation.objectId('Shop').optional(),\n\tpage: ZodValidation.number('Page').optional().default(0),\n\tsize: ZodValidation.number('Page size').optional().default(100),\n});\n\n/**\n * Schema for validating coupons\n */\nexport const ValidateCouponSchema = z.object({\n\tuser: ZodValidation.objectIdOrStringSchema,\n\tshop: ZodValidation.objectIdOrStringSchema,\n\tcoupon: ZodValidation.string('Coupon').optional(),\n\tamountBeforeCoupon: ZodValidation.number('Amount before coupon'),\n\tsecondaryAmountBeforeCoupon: ZodValidation.number('Secondary amount before coupon'),\n\tscheduledAt: ZodValidation.date('Scheduled at').optional(),\n});\n\nconst discountCutSchema = z.object({\n\tcompanyCut: ZodValidation.number('companyCut').optional(),\n\tsecondaryCompanyCut: ZodValidation.number('secondaryCompanyCut').optional(),\n\tshopCut: ZodValidation.number('shopCut').optional(),\n\tsecondaryShopCut: ZodValidation.number('secondaryShopCut').optional(),\n});\n\n/**\n * Schema for coupon validation output\n */\nexport const CouponValidationOutputSchema = z.object({\n\tisValid: ZodValidation.boolean('IsValid').default(false),\n\tmessage: ZodValidation.string('Message').optional(),\n\tamountAfterCoupon: ZodValidation.number('Amount after coupon').optional(),\n\tsecondaryAmountAfterCoupon: ZodValidation.number('Secondary amount after coupon').optional(),\n\tdiscountAmount: ZodValidation.number('Coupon Discount').optional(),\n\tsecondaryDiscountAmount: ZodValidation.number('Secondary coupon discount').optional(),\n\tdiscountCut: discountCutSchema.optional(),\n\tcouponDetails: z.record(z.unknown()).optional(), // Flexible field for any additional coupon details\n});\n\nexport const CouponCodeSchema = z.object({\n\tcouponCode: ZodValidation.string('Coupon code'),\n});\n\nexport const UpdateCouponStatusSchema = z.object({\n\t_id: ZodValidation.objectIdOrStringSchema,\n\tstatus: ZodValidation.enumType(Status, 'Status').optional().default(Status.ACTIVE),\n});\n\nexport const CheckExistingNewUserCouponOutputSchema = z.object({\n\texists: ZodValidation.boolean('Exists').default(false),\n});\n\nexport const CouponValidationResponseSchema = createResponseSchema(CouponValidationOutputSchema);\n\nexport const DeviceIdSchema = z.object({ deviceId: z.string() });\nexport const IsNewUserGiftBoxShownSchema = z.object({ isNewUserGiftBoxShown: z.boolean() });\n\n/**\n * Export DTO types\n */\nexport type CreateCouponDTO = DTO<typeof CouponValidationSchema>;\nexport type CouponDTO = DTO<typeof CouponSchema>;\nexport type UpdateCouponDTO = DTO<typeof UpdateCouponSchema>;\nexport type GetUserCouponDTO = DTO<typeof GetUserCouponSchema>;\nexport type ValidateCouponDTO = DTO<typeof ValidateCouponSchema>;\nexport type CouponValidationOutputDTO = DTO<typeof CouponValidationOutputSchema>;\nexport type GetUserCouponsResponseDTO = DTO<typeof GetUserCouponsResponseSchema>;\nexport type UpdateCouponStatusDTO = DTO<typeof UpdateCouponStatusSchema>;\nexport type CheckExistingNewUserCouponOutputDTO = DTO<typeof CheckExistingNewUserCouponOutputSchema>;\nexport type DeviceIdDTO = DTO<typeof DeviceIdSchema>;\nexport type IsNewUserGiftBoxShownDTO = DTO<typeof IsNewUserGiftBoxShownSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"coupon.validation.js","sourceRoot":"/","sources":["modules/coupon/validations/coupon.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iGAImE;AACnE,4DAO2C;AAC3C,iGAGmE;AACnE,8DAA2D;AAK9C,QAAA,YAAY,GAAG;IAC3B,IAAI,EAAE,iCAAa,CAAC,MAAM,CAAC,MAAM,EAAE;QAClC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE;QACvF,SAAS,EAAE,EAAE;QACb,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,6BAA6B;QACzC,UAAU,EAAE,8BAA8B;KAC1C,CAAC;IACF,iBAAiB,EAAE,iCAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC;SAC1D,WAAW,EAAE;SACb,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,OAAO,CAAC,IAAI,CAAC;IACf,0BAA0B,EAAE,iCAAa,CAAC,OAAO,CAAC,iCAAiC,CAAC;SAClF,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;IAChB,SAAS,EAAE,iCAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE;IAC1D,SAAS,EAAE,iCAAa,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE;CACzD,CAAC;AAEW,QAAA,UAAU,GAAG;IACzB,GAAG,oBAAY;IACf,SAAS,EAAE,iCAAa,CAAC,QAAQ,CAAC,gBAAS,EAAE,YAAY,CAAC;IAC1D,KAAK,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AAU,EAAE,iCAAa,CAAC,QAAQ,CAAC,iBAAU,EAAE,aAAa,CAAC;IAC7D,eAAe,EAAE,iCAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAC1D,iBAAiB,EAAE,iCAAa,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACzE,YAAY,EAAE,iCAAa,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3E,WAAW,EAAE,iCAAa,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACzE,iBAAiB,EAAE,iCAAa,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAClG,KAAK,EAAE,iCAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,OAAO,EAAE,iCAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,cAAc,EAAE,iCAAa,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACvF,CAAC,CAAC;AAEU,QAAA,iCAAiC,GAAG,IAAA,wCAAoB,EAAC,iCAAyB,CAAC,KAAK,EAAE,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport {\n\tZodValidation,\n\tcreateSchemaBuilder,\n\tDTO,\n} from '@lyxa.ai/core/dist/utilities/validation/global-validation';\nimport {\n\tCouponExpirationReason,\n\tCouponType,\n\tGraphType,\n\tItemType,\n\tStatus,\n\tValueType,\n} from '@lyxa.ai/core/dist/utilities/enum';\nimport {\n\tcreateResponseSchema,\n\tDurationSchema,\n} from '@lyxa.ai/core/dist/utilities/validation/common-validation';\nimport { dayjs } from '@lyxa.ai/core/dist/utilities/dayjs';\n\n/**\n * Define the base parent schema fields\n */\nexport const couponFields = {\n\tcode: ZodValidation.string('Code', {\n\t\tregex: { pattern: new RegExp('^[A-Z0-9]+$'), message: 'Coupon name must be uppercase' },\n\t\tmaxLength: 10,\n\t\tminLength: 4,\n\t\tminMessage: 'Coupon must be 4 characters',\n\t\tmaxMessage: 'Coupon must be 10 characters',\n\t}),\n\torderLimitPerUser: ZodValidation.number('OrderLimitPerUser')\n\t\t.nonnegative()\n\t\t.optional()\n\t\t.nullable()\n\t\t.default(null),\n\tisOrderLimitPerUserEnabled: ZodValidation.boolean('Is order limit per user enabled')\n\t\t.optional()\n\t\t.default(false),\n\tcreatedBy: ZodValidation.objectId('Created by').optional(),\n\tisExpired: ZodValidation.boolean('Is expired').optional(),\n};\n\nexport const baseFields = {\n\t...couponFields,\n\tvalueType: ZodValidation.enumType(ValueType, 'Value type'),\n\tvalue: ZodValidation.number('Value'),\n\tsecondaryCurrencyValue: ZodValidation.number('Secondary currency value').optional(),\n\tmaxDiscountLimit: ZodValidation.number('Max discount limit').optional().nullable().default(null),\n\tsecondaryCurrencyMaxDiscountLimit: ZodValidation.number('Secondary currency max discount limit').optional(),\n\tisMaxDiscountLimitEnabled: ZodValidation.boolean('Is max discount limit enabled').optional().default(false),\n\tduration: DurationSchema\n\t\t// .refine((d: any) => d.start >= new Date() && d.end >= new Date(), {\n\t\t// \tmessage: 'Start and end dates must not be in the past',\n\t\t// })\n\t\t.transform(duration => {\n\t\t\tduration.start = dayjs(duration.start).toDate();\n\t\t\tduration.end = dayjs(duration.end).toDate();\n\t\t\treturn duration;\n\t\t}),\n\tspendLimit: ZodValidation.number('Spend limit').optional().nullable().default(null),\n\tisSpendLimitEnabled: ZodValidation.boolean('Is spend limit enabled').optional().default(false),\n\ttotalOrderLimit: ZodValidation.number('Total order limit').optional().nullable().default(null),\n\tisTotalOrderLimitEnabled: ZodValidation.boolean('Is total order limit enabled').optional().default(false),\n\tminOrderValue: ZodValidation.number('Min order value').nullable().default(null),\n\tsecondaryCurrencyMinOrderValue: ZodValidation.number('Secondary currency min order value').optional(),\n\tisMinOrderValueEnabled: ZodValidation.boolean('Is min order value enabled').optional().default(false),\n\tforNewUserOnly: ZodValidation.boolean('ForNewUserOnly').optional().default(false),\n\tstatus: ZodValidation.enumType(Status, 'Status').optional().default(Status.ACTIVE),\n\texpirationReason: ZodValidation.enumType(CouponExpirationReason, 'Expiration reason')\n\t\t.optional()\n\t\t.nullable()\n\t\t.default(null),\n\treferringUser: z\n\t\t.object({\n\t\t\tname: ZodValidation.string('Referring user name').optional(),\n\t\t})\n\t\t.optional(),\n};\n\n/**\n * Create schema builder for Parent entity\n * - Includes timestamps\n * - Excludes 'createdAt' from update operations\n */\nconst schemaBuilder = createSchemaBuilder(baseFields);\n\n/**\n * Get all schemas for the Parent entity\n */\nconst {\n\tBaseSchema: CouponValidationSchema,\n\tEntitySchema: CouponSchema,\n\tIdSchema: CouponIdSchema,\n\tUpdateSchema: UpdateCouponSchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\n/**\n * Export schemas\n */\nexport const GetUserCouponsResponseSchema = z.object({\n\tavailable: z.array(CouponSchema),\n\tused: z.array(CouponSchema),\n\texpired: z.array(CouponSchema),\n});\n\nexport {\n\tCouponValidationSchema,\n\tCouponSchema,\n\tCouponIdSchema as CouponIdValidationSchema,\n\tUpdateCouponSchema,\n};\n\n/**\n * Schema for getting user coupons\n */\nexport const GetUserCouponSchema = z.object({\n\tuser: ZodValidation.objectId('User').optional(),\n\tshop: ZodValidation.objectId('Shop').optional(),\n\tpage: ZodValidation.number('Page').optional().default(0),\n\tsize: ZodValidation.number('Page size').optional().default(100),\n});\n\n/**\n * Schema for validating coupons\n */\nexport const ValidateCouponSchema = z.object({\n\tuser: ZodValidation.objectIdOrStringSchema,\n\tshop: ZodValidation.objectIdOrStringSchema,\n\tcoupon: ZodValidation.string('Coupon').optional(),\n\tamountBeforeCoupon: ZodValidation.number('Amount before coupon'),\n\tsecondaryAmountBeforeCoupon: ZodValidation.number('Secondary amount before coupon'),\n\tscheduledAt: ZodValidation.date('Scheduled at').optional(),\n});\n\nconst discountCutSchema = z.object({\n\tcompanyCut: ZodValidation.number('companyCut').optional(),\n\tsecondaryCompanyCut: ZodValidation.number('secondaryCompanyCut').optional(),\n\tshopCut: ZodValidation.number('shopCut').optional(),\n\tsecondaryShopCut: ZodValidation.number('secondaryShopCut').optional(),\n});\n\n/**\n * Schema for coupon validation output\n */\nexport const CouponValidationOutputSchema = z.object({\n\tisValid: ZodValidation.boolean('IsValid').default(false),\n\tmessage: ZodValidation.string('Message').optional(),\n\tamountAfterCoupon: ZodValidation.number('Amount after coupon').optional(),\n\tsecondaryAmountAfterCoupon: ZodValidation.number('Secondary amount after coupon').optional(),\n\tdiscountAmount: ZodValidation.number('Coupon Discount').optional(),\n\tsecondaryDiscountAmount: ZodValidation.number('Secondary coupon discount').optional(),\n\tdiscountCut: discountCutSchema.optional(),\n\tcouponDetails: z.record(z.unknown()).optional(), // Flexible field for any additional coupon details\n});\n\nexport const CouponCodeSchema = z.object({\n\tcouponCode: ZodValidation.string('Coupon code'),\n});\n\nexport const UpdateCouponStatusSchema = z.object({\n\t_id: ZodValidation.objectIdOrStringSchema,\n\tstatus: ZodValidation.enumType(Status, 'Status').optional().default(Status.ACTIVE),\n});\n\nexport const CheckExistingNewUserCouponOutputSchema = z.object({\n\texists: ZodValidation.boolean('Exists').default(false),\n});\n\nexport const CouponValidationResponseSchema = createResponseSchema(CouponValidationOutputSchema);\n\nexport const DeviceIdSchema = z.object({ deviceId: z.string() });\nexport const IsNewUserGiftBoxShownSchema = z.object({ isNewUserGiftBoxShown: z.boolean() });\n\nexport const BaseDateInputSchema = z\n\t.object({\n\t\tstartDate: ZodValidation.date('Start Date').transform(val => dayjs(val).startOf('day').toDate()),\n\t\tendDate: ZodValidation.date('End Date').transform(val => dayjs(val).endOf('day').toDate()),\n\t})\n\t.strict();\n\nexport const DateInputSchema = BaseDateInputSchema.refine(\n\tdata => !dayjs(data.startDate).isAfter(dayjs(data.endDate)),\n\t{\n\t\tmessage: 'Start date cannot be after end date',\n\t\tpath: ['startDate'],\n\t}\n);\n\nexport const GraphInputSchema = BaseDateInputSchema.extend({\n\tgraphType: ZodValidation.enumType(GraphType, 'Type').default(GraphType.DAILY),\n\titemType: ZodValidation.enumType(ItemType, 'Item Type').optional(),\n}).refine(data => !dayjs(data.startDate).isAfter(dayjs(data.endDate)), {\n\tmessage: 'Start date cannot be after end date',\n\tpath: ['startDate'],\n});\n\nexport const CouponMetricsOutputSchema = z.object({\n\tactiveCoupons: ZodValidation.number('Active coupons').default(0),\n\ttotalCreated: ZodValidation.number('Total created coupons').default(0),\n\ttotalRedeemedCoupons: ZodValidation.number('Total redeemed coupons').default(0),\n\tredemptionRate: ZodValidation.number('Redemption rate').default(0),\n\ttotalCouponOrders: ZodValidation.number('Total coupon orders').default(0),\n\ttotalRevenue: ZodValidation.number('Total revenue from coupons').default(0),\n\ttotalProfit: ZodValidation.number('Total profit from coupons').default(0),\n});\n\nexport const CouponMetricsResponseSchema = createResponseSchema(CouponMetricsOutputSchema);\n\nexport const CouponMetricsByTypeSchema = z.object({\n\tcouponType: ZodValidation.enumType(CouponType, 'Coupon Type'),\n\tcouponTypeTitle: ZodValidation.string('Coupon Type Title'),\n\ttotalCouponOrders: ZodValidation.number('Total coupon orders').default(0),\n\ttotalRevenue: ZodValidation.number('Total revenue from coupons').default(0),\n\ttotalProfit: ZodValidation.number('Total profit from coupons').default(0),\n\taverageOrderValue: ZodValidation.number('Average order value for coupons of this type').default(0),\n\tusage: ZodValidation.number('Usage').default(0),\n\tongoing: ZodValidation.number('Ongoing').default(0),\n\tredemptionRate: ZodValidation.number('Redemption rate for this coupon type').default(0),\n});\n\nexport const CouponMetricsByTypeResponseSchema = createResponseSchema(CouponMetricsByTypeSchema.array());\n\n/**\n * Export DTO types\n */\nexport type CreateCouponDTO = DTO<typeof CouponValidationSchema>;\nexport type CouponDTO = DTO<typeof CouponSchema>;\nexport type UpdateCouponDTO = DTO<typeof UpdateCouponSchema>;\nexport type GetUserCouponDTO = DTO<typeof GetUserCouponSchema>;\nexport type ValidateCouponDTO = DTO<typeof ValidateCouponSchema>;\nexport type CouponValidationOutputDTO = DTO<typeof CouponValidationOutputSchema>;\nexport type GetUserCouponsResponseDTO = DTO<typeof GetUserCouponsResponseSchema>;\nexport type UpdateCouponStatusDTO = DTO<typeof UpdateCouponStatusSchema>;\nexport type CheckExistingNewUserCouponOutputDTO = DTO<typeof CheckExistingNewUserCouponOutputSchema>;\nexport type DeviceIdDTO = DTO<typeof DeviceIdSchema>;\nexport type IsNewUserGiftBoxShownDTO = DTO<typeof IsNewUserGiftBoxShownSchema>;\nexport type DateInputDTO = DTO<typeof DateInputSchema>;\nexport type GraphInputDTO = DTO<typeof GraphInputSchema>;\nexport type CouponMetricsOutputDTO = DTO<typeof CouponMetricsOutputSchema>;\nexport type CouponMetricsByTypeDTO = DTO<typeof CouponMetricsByTypeSchema>;\n"]}
|