@lyxa.ai/marketing 1.0.57 → 1.0.59
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 +1 -0
- package/dist/lib/event/event-initializations.js.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.d.ts +1 -0
- package/dist/lib/event/event-listeners/event-listeners.d.ts.map +1 -1
- package/dist/lib/event/event-listeners/event-listeners.js +62 -12
- package/dist/lib/event/event-listeners/event-listeners.js.map +1 -1
- package/dist/lib/event/events/marketing-product-seed.event.d.ts +1 -2
- package/dist/lib/event/events/marketing-product-seed.event.d.ts.map +1 -1
- package/dist/lib/event/events/marketing-product-seed.event.js.map +1 -1
- package/dist/lib/event/events/marketing-product-sync.event.d.ts +11 -0
- package/dist/lib/event/events/marketing-product-sync.event.d.ts.map +1 -0
- package/dist/lib/event/events/marketing-product-sync.event.js +12 -0
- package/dist/lib/event/events/marketing-product-sync.event.js.map +1 -0
- package/dist/lib/index.d.ts +243 -12
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +3 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts +2 -2
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js +2 -2
- package/dist/lib/modules/coupon/services/patterns/repository/CouponRepository.js.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +6 -6
- package/dist/lib/modules/coupon/validations/coupon.validation.js +2 -2
- package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
- package/dist/lib/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
- package/dist/lib/modules/deal-setting/services/deal-setting.service.js +4 -1
- package/dist/lib/modules/deal-setting/services/deal-setting.service.js.map +1 -1
- package/dist/lib/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
- package/dist/lib/modules/featured-setting/services/featured-setting.service.js +3 -0
- package/dist/lib/modules/featured-setting/services/featured-setting.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.d.ts +54 -8
- 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 +11 -0
- package/dist/lib/modules/limited-time-offer/campaign/campaign.router.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js +6 -0
- package/dist/lib/modules/limited-time-offer/campaign/jobs/index.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js +2 -6
- package/dist/lib/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +16 -3
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js +22 -3
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +2 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js +12 -0
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +242 -35
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js +19 -1
- package/dist/lib/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +6 -1
- 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 +45 -1
- 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-scheduler.service.d.ts +3 -0
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js +66 -8
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
- 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 +37 -19
- 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.validation.d.ts +2 -2
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +241 -10
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts +2 -0
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js +15 -3
- package/dist/lib/modules/limited-time-offer/limited-time-offer.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js +1 -1
- package/dist/lib/modules/limited-time-offer/notification/limited-time-offer-notification.constants.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +10 -2
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js +4 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.builder.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +10 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js +43 -0
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.repository.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +187 -2
- 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 +29 -0
- 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.validation.d.ts +395 -0
- 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 +16 -6
- 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 +7 -4
- 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 +31 -6
- 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 +14 -3
- 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 +76 -16
- package/dist/lib/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts +13 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.js +75 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.js.map +1 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts +21 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts.map +1 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.js +83 -0
- package/dist/lib/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.js.map +1 -0
- 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 +60 -46
- package/dist/lib/modules/marketing/services/marketing.service.js.map +1 -1
- package/dist/lib/modules/marketing/services/product-marketing.service.d.ts +2 -3
- package/dist/lib/modules/marketing/services/product-marketing.service.d.ts.map +1 -1
- package/dist/lib/modules/marketing/services/product-marketing.service.js +42 -13
- 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 +95 -27
- package/dist/lib/modules/marketing/services/synchronize-product-marketing.service.js.map +1 -1
- package/dist/types/event/event-initializations.d.ts.map +1 -1
- package/dist/types/event/event-listeners/event-listeners.d.ts +1 -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 +1 -2
- package/dist/types/event/events/marketing-product-seed.event.d.ts.map +1 -1
- package/dist/types/event/events/marketing-product-sync.event.d.ts +11 -0
- package/dist/types/event/events/marketing-product-sync.event.d.ts.map +1 -0
- package/dist/types/index.d.ts +243 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +2 -2
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts +6 -6
- package/dist/types/modules/deal-setting/services/deal-setting.service.d.ts.map +1 -1
- package/dist/types/modules/featured-setting/services/featured-setting.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts +54 -8
- package/dist/types/modules/limited-time-offer/campaign/campaign.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/index.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts +0 -1
- package/dist/types/modules/limited-time-offer/campaign/jobs/limited-time-offer-campaign.worker.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts +16 -3
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.builder.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts +2 -0
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.repository.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts +242 -35
- package/dist/types/modules/limited-time-offer/campaign/limited-time-offer-campaign.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-lifecycle.service.d.ts +6 -1
- 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-scheduler.service.d.ts +3 -0
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign-scheduler.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/campaign/services/limited-time-offer-campaign.service.d.ts +1 -1
- 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.validation.d.ts +2 -2
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +241 -10
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts +2 -0
- package/dist/types/modules/limited-time-offer/limited-time-offer.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/notification/limited-time-offer-notification.constants.d.ts +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts +10 -2
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.builder.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts +10 -0
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.repository.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/participant/limited-time-offer-participant.router.d.ts +187 -2
- 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 +395 -0
- 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 +7 -4
- 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 +14 -3
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts +13 -0
- package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.repository.d.ts.map +1 -0
- package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts +21 -0
- package/dist/types/modules/limited-time-offer/session/limited-time-offer-campaign-session.service.d.ts.map +1 -0
- 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 +7 -3
- 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/package.json +2 -2
|
@@ -730,6 +730,401 @@ export declare const ParticipantStatusResponseSchema: z.ZodObject<{
|
|
|
730
730
|
} | undefined;
|
|
731
731
|
} | undefined;
|
|
732
732
|
}>;
|
|
733
|
+
export declare const AdminEnrollShopEntrySchema: z.ZodEffects<z.ZodObject<{
|
|
734
|
+
isEntireMenu: z.ZodBoolean;
|
|
735
|
+
products: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>, "many">>;
|
|
736
|
+
shopCategories: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>, "many">>;
|
|
737
|
+
discountPercentage: z.ZodNumber;
|
|
738
|
+
maxDiscountCap: z.ZodNumber;
|
|
739
|
+
isOrderCapacityEnabled: z.ZodBoolean;
|
|
740
|
+
maxOrderCapacity: z.ZodOptional<z.ZodNumber>;
|
|
741
|
+
} & {
|
|
742
|
+
shopId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
743
|
+
}, "strip", z.ZodTypeAny, {
|
|
744
|
+
isEntireMenu: boolean;
|
|
745
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
746
|
+
products: import("mongoose").Types.ObjectId[];
|
|
747
|
+
discountPercentage: number;
|
|
748
|
+
maxDiscountCap: number;
|
|
749
|
+
isOrderCapacityEnabled: boolean;
|
|
750
|
+
shopCategories: import("mongoose").Types.ObjectId[];
|
|
751
|
+
maxOrderCapacity?: number | undefined;
|
|
752
|
+
}, {
|
|
753
|
+
isEntireMenu: boolean;
|
|
754
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
755
|
+
discountPercentage: number;
|
|
756
|
+
maxDiscountCap: number;
|
|
757
|
+
isOrderCapacityEnabled: boolean;
|
|
758
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
759
|
+
maxOrderCapacity?: number | undefined;
|
|
760
|
+
shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
761
|
+
}>, {
|
|
762
|
+
isEntireMenu: boolean;
|
|
763
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
764
|
+
products: import("mongoose").Types.ObjectId[];
|
|
765
|
+
discountPercentage: number;
|
|
766
|
+
maxDiscountCap: number;
|
|
767
|
+
isOrderCapacityEnabled: boolean;
|
|
768
|
+
shopCategories: import("mongoose").Types.ObjectId[];
|
|
769
|
+
maxOrderCapacity?: number | undefined;
|
|
770
|
+
}, {
|
|
771
|
+
isEntireMenu: boolean;
|
|
772
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
773
|
+
discountPercentage: number;
|
|
774
|
+
maxDiscountCap: number;
|
|
775
|
+
isOrderCapacityEnabled: boolean;
|
|
776
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
777
|
+
maxOrderCapacity?: number | undefined;
|
|
778
|
+
shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
779
|
+
}>;
|
|
780
|
+
export declare const AdminEnrollShopsSchema: z.ZodObject<{
|
|
781
|
+
shops: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
782
|
+
isEntireMenu: z.ZodBoolean;
|
|
783
|
+
products: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>, "many">>;
|
|
784
|
+
shopCategories: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>, "many">>;
|
|
785
|
+
discountPercentage: z.ZodNumber;
|
|
786
|
+
maxDiscountCap: z.ZodNumber;
|
|
787
|
+
isOrderCapacityEnabled: z.ZodBoolean;
|
|
788
|
+
maxOrderCapacity: z.ZodOptional<z.ZodNumber>;
|
|
789
|
+
} & {
|
|
790
|
+
shopId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
791
|
+
}, "strip", z.ZodTypeAny, {
|
|
792
|
+
isEntireMenu: boolean;
|
|
793
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
794
|
+
products: import("mongoose").Types.ObjectId[];
|
|
795
|
+
discountPercentage: number;
|
|
796
|
+
maxDiscountCap: number;
|
|
797
|
+
isOrderCapacityEnabled: boolean;
|
|
798
|
+
shopCategories: import("mongoose").Types.ObjectId[];
|
|
799
|
+
maxOrderCapacity?: number | undefined;
|
|
800
|
+
}, {
|
|
801
|
+
isEntireMenu: boolean;
|
|
802
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
803
|
+
discountPercentage: number;
|
|
804
|
+
maxDiscountCap: number;
|
|
805
|
+
isOrderCapacityEnabled: boolean;
|
|
806
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
807
|
+
maxOrderCapacity?: number | undefined;
|
|
808
|
+
shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
809
|
+
}>, {
|
|
810
|
+
isEntireMenu: boolean;
|
|
811
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
812
|
+
products: import("mongoose").Types.ObjectId[];
|
|
813
|
+
discountPercentage: number;
|
|
814
|
+
maxDiscountCap: number;
|
|
815
|
+
isOrderCapacityEnabled: boolean;
|
|
816
|
+
shopCategories: import("mongoose").Types.ObjectId[];
|
|
817
|
+
maxOrderCapacity?: number | undefined;
|
|
818
|
+
}, {
|
|
819
|
+
isEntireMenu: boolean;
|
|
820
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
821
|
+
discountPercentage: number;
|
|
822
|
+
maxDiscountCap: number;
|
|
823
|
+
isOrderCapacityEnabled: boolean;
|
|
824
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
825
|
+
maxOrderCapacity?: number | undefined;
|
|
826
|
+
shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
827
|
+
}>, "many">;
|
|
828
|
+
}, "strip", z.ZodTypeAny, {
|
|
829
|
+
shops: {
|
|
830
|
+
isEntireMenu: boolean;
|
|
831
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
832
|
+
products: import("mongoose").Types.ObjectId[];
|
|
833
|
+
discountPercentage: number;
|
|
834
|
+
maxDiscountCap: number;
|
|
835
|
+
isOrderCapacityEnabled: boolean;
|
|
836
|
+
shopCategories: import("mongoose").Types.ObjectId[];
|
|
837
|
+
maxOrderCapacity?: number | undefined;
|
|
838
|
+
}[];
|
|
839
|
+
}, {
|
|
840
|
+
shops: {
|
|
841
|
+
isEntireMenu: boolean;
|
|
842
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
843
|
+
discountPercentage: number;
|
|
844
|
+
maxDiscountCap: number;
|
|
845
|
+
isOrderCapacityEnabled: boolean;
|
|
846
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
847
|
+
maxOrderCapacity?: number | undefined;
|
|
848
|
+
shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
849
|
+
}[];
|
|
850
|
+
}>;
|
|
851
|
+
export declare const AdminJoinParticipantsResponseSchema: z.ZodObject<{
|
|
852
|
+
success: z.ZodBoolean;
|
|
853
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
854
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
855
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
856
|
+
page: z.ZodNumber;
|
|
857
|
+
size: z.ZodNumber;
|
|
858
|
+
totalElements: z.ZodNumber;
|
|
859
|
+
totalPages: z.ZodNumber;
|
|
860
|
+
}, "strip", z.ZodTypeAny, {
|
|
861
|
+
page: number;
|
|
862
|
+
size: number;
|
|
863
|
+
totalElements: number;
|
|
864
|
+
totalPages: number;
|
|
865
|
+
}, {
|
|
866
|
+
page: number;
|
|
867
|
+
size: number;
|
|
868
|
+
totalElements: number;
|
|
869
|
+
totalPages: number;
|
|
870
|
+
}>>;
|
|
871
|
+
documents: z.ZodArray<z.ZodType<{
|
|
872
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
873
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
874
|
+
isEntireMenu: boolean;
|
|
875
|
+
joinedAt: Date;
|
|
876
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
877
|
+
isOrderCapacityEnabled: boolean;
|
|
878
|
+
isWithdrawn: boolean;
|
|
879
|
+
createdAt?: Date | null | undefined;
|
|
880
|
+
updatedAt?: Date | null | undefined;
|
|
881
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
882
|
+
discountPercentage?: number | undefined;
|
|
883
|
+
maxDiscountCap?: number | undefined;
|
|
884
|
+
maxOrderCapacity?: number | undefined;
|
|
885
|
+
withdrawnAt?: Date | null | undefined;
|
|
886
|
+
}[], z.ZodTypeDef, {
|
|
887
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
888
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
889
|
+
isEntireMenu: boolean;
|
|
890
|
+
joinedAt: Date;
|
|
891
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
892
|
+
isOrderCapacityEnabled: boolean;
|
|
893
|
+
isWithdrawn: boolean;
|
|
894
|
+
createdAt?: Date | null | undefined;
|
|
895
|
+
updatedAt?: Date | null | undefined;
|
|
896
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
897
|
+
discountPercentage?: number | undefined;
|
|
898
|
+
maxDiscountCap?: number | undefined;
|
|
899
|
+
maxOrderCapacity?: number | undefined;
|
|
900
|
+
withdrawnAt?: Date | null | undefined;
|
|
901
|
+
}[]>, "many">;
|
|
902
|
+
}, "strip", z.ZodTypeAny, {
|
|
903
|
+
documents: {
|
|
904
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
905
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
906
|
+
isEntireMenu: boolean;
|
|
907
|
+
joinedAt: Date;
|
|
908
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
909
|
+
isOrderCapacityEnabled: boolean;
|
|
910
|
+
isWithdrawn: boolean;
|
|
911
|
+
createdAt?: Date | null | undefined;
|
|
912
|
+
updatedAt?: Date | null | undefined;
|
|
913
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
914
|
+
discountPercentage?: number | undefined;
|
|
915
|
+
maxDiscountCap?: number | undefined;
|
|
916
|
+
maxOrderCapacity?: number | undefined;
|
|
917
|
+
withdrawnAt?: Date | null | undefined;
|
|
918
|
+
}[][];
|
|
919
|
+
metadata?: {
|
|
920
|
+
page: number;
|
|
921
|
+
size: number;
|
|
922
|
+
totalElements: number;
|
|
923
|
+
totalPages: number;
|
|
924
|
+
} | undefined;
|
|
925
|
+
}, {
|
|
926
|
+
documents: {
|
|
927
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
928
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
929
|
+
isEntireMenu: boolean;
|
|
930
|
+
joinedAt: Date;
|
|
931
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
932
|
+
isOrderCapacityEnabled: boolean;
|
|
933
|
+
isWithdrawn: boolean;
|
|
934
|
+
createdAt?: Date | null | undefined;
|
|
935
|
+
updatedAt?: Date | null | undefined;
|
|
936
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
937
|
+
discountPercentage?: number | undefined;
|
|
938
|
+
maxDiscountCap?: number | undefined;
|
|
939
|
+
maxOrderCapacity?: number | undefined;
|
|
940
|
+
withdrawnAt?: Date | null | undefined;
|
|
941
|
+
}[][];
|
|
942
|
+
metadata?: {
|
|
943
|
+
page: number;
|
|
944
|
+
size: number;
|
|
945
|
+
totalElements: number;
|
|
946
|
+
totalPages: number;
|
|
947
|
+
} | undefined;
|
|
948
|
+
}>, z.ZodType<{
|
|
949
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
950
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
951
|
+
isEntireMenu: boolean;
|
|
952
|
+
joinedAt: Date;
|
|
953
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
954
|
+
isOrderCapacityEnabled: boolean;
|
|
955
|
+
isWithdrawn: boolean;
|
|
956
|
+
createdAt?: Date | null | undefined;
|
|
957
|
+
updatedAt?: Date | null | undefined;
|
|
958
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
959
|
+
discountPercentage?: number | undefined;
|
|
960
|
+
maxDiscountCap?: number | undefined;
|
|
961
|
+
maxOrderCapacity?: number | undefined;
|
|
962
|
+
withdrawnAt?: Date | null | undefined;
|
|
963
|
+
}[], z.ZodTypeDef, {
|
|
964
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
965
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
966
|
+
isEntireMenu: boolean;
|
|
967
|
+
joinedAt: Date;
|
|
968
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
969
|
+
isOrderCapacityEnabled: boolean;
|
|
970
|
+
isWithdrawn: boolean;
|
|
971
|
+
createdAt?: Date | null | undefined;
|
|
972
|
+
updatedAt?: Date | null | undefined;
|
|
973
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
974
|
+
discountPercentage?: number | undefined;
|
|
975
|
+
maxDiscountCap?: number | undefined;
|
|
976
|
+
maxOrderCapacity?: number | undefined;
|
|
977
|
+
withdrawnAt?: Date | null | undefined;
|
|
978
|
+
}[]>]>>;
|
|
979
|
+
}, "strip", z.ZodTypeAny, {
|
|
980
|
+
message: string;
|
|
981
|
+
success: boolean;
|
|
982
|
+
data?: {
|
|
983
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
984
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
985
|
+
isEntireMenu: boolean;
|
|
986
|
+
joinedAt: Date;
|
|
987
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
988
|
+
isOrderCapacityEnabled: boolean;
|
|
989
|
+
isWithdrawn: boolean;
|
|
990
|
+
createdAt?: Date | null | undefined;
|
|
991
|
+
updatedAt?: Date | null | undefined;
|
|
992
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
993
|
+
discountPercentage?: number | undefined;
|
|
994
|
+
maxDiscountCap?: number | undefined;
|
|
995
|
+
maxOrderCapacity?: number | undefined;
|
|
996
|
+
withdrawnAt?: Date | null | undefined;
|
|
997
|
+
}[] | {
|
|
998
|
+
documents: {
|
|
999
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
1000
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
1001
|
+
isEntireMenu: boolean;
|
|
1002
|
+
joinedAt: Date;
|
|
1003
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
1004
|
+
isOrderCapacityEnabled: boolean;
|
|
1005
|
+
isWithdrawn: boolean;
|
|
1006
|
+
createdAt?: Date | null | undefined;
|
|
1007
|
+
updatedAt?: Date | null | undefined;
|
|
1008
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
1009
|
+
discountPercentage?: number | undefined;
|
|
1010
|
+
maxDiscountCap?: number | undefined;
|
|
1011
|
+
maxOrderCapacity?: number | undefined;
|
|
1012
|
+
withdrawnAt?: Date | null | undefined;
|
|
1013
|
+
}[][];
|
|
1014
|
+
metadata?: {
|
|
1015
|
+
page: number;
|
|
1016
|
+
size: number;
|
|
1017
|
+
totalElements: number;
|
|
1018
|
+
totalPages: number;
|
|
1019
|
+
} | undefined;
|
|
1020
|
+
} | undefined;
|
|
1021
|
+
}, {
|
|
1022
|
+
message: string;
|
|
1023
|
+
success: boolean;
|
|
1024
|
+
data?: {
|
|
1025
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
1026
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
1027
|
+
isEntireMenu: boolean;
|
|
1028
|
+
joinedAt: Date;
|
|
1029
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
1030
|
+
isOrderCapacityEnabled: boolean;
|
|
1031
|
+
isWithdrawn: boolean;
|
|
1032
|
+
createdAt?: Date | null | undefined;
|
|
1033
|
+
updatedAt?: Date | null | undefined;
|
|
1034
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
1035
|
+
discountPercentage?: number | undefined;
|
|
1036
|
+
maxDiscountCap?: number | undefined;
|
|
1037
|
+
maxOrderCapacity?: number | undefined;
|
|
1038
|
+
withdrawnAt?: Date | null | undefined;
|
|
1039
|
+
}[] | {
|
|
1040
|
+
documents: {
|
|
1041
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
1042
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
1043
|
+
isEntireMenu: boolean;
|
|
1044
|
+
joinedAt: Date;
|
|
1045
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
1046
|
+
isOrderCapacityEnabled: boolean;
|
|
1047
|
+
isWithdrawn: boolean;
|
|
1048
|
+
createdAt?: Date | null | undefined;
|
|
1049
|
+
updatedAt?: Date | null | undefined;
|
|
1050
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
1051
|
+
discountPercentage?: number | undefined;
|
|
1052
|
+
maxDiscountCap?: number | undefined;
|
|
1053
|
+
maxOrderCapacity?: number | undefined;
|
|
1054
|
+
withdrawnAt?: Date | null | undefined;
|
|
1055
|
+
}[][];
|
|
1056
|
+
metadata?: {
|
|
1057
|
+
page: number;
|
|
1058
|
+
size: number;
|
|
1059
|
+
totalElements: number;
|
|
1060
|
+
totalPages: number;
|
|
1061
|
+
} | undefined;
|
|
1062
|
+
} | undefined;
|
|
1063
|
+
}>;
|
|
1064
|
+
export declare const AdminUpdateShopSchema: z.ZodEffects<z.ZodObject<{
|
|
1065
|
+
isEntireMenu: z.ZodBoolean;
|
|
1066
|
+
products: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>, "many">>;
|
|
1067
|
+
shopCategories: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>, "many">>;
|
|
1068
|
+
discountPercentage: z.ZodNumber;
|
|
1069
|
+
maxDiscountCap: z.ZodNumber;
|
|
1070
|
+
isOrderCapacityEnabled: z.ZodBoolean;
|
|
1071
|
+
maxOrderCapacity: z.ZodOptional<z.ZodNumber>;
|
|
1072
|
+
} & {
|
|
1073
|
+
shopId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
1074
|
+
}, "strip", z.ZodTypeAny, {
|
|
1075
|
+
isEntireMenu: boolean;
|
|
1076
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
1077
|
+
products: import("mongoose").Types.ObjectId[];
|
|
1078
|
+
discountPercentage: number;
|
|
1079
|
+
maxDiscountCap: number;
|
|
1080
|
+
isOrderCapacityEnabled: boolean;
|
|
1081
|
+
shopCategories: import("mongoose").Types.ObjectId[];
|
|
1082
|
+
maxOrderCapacity?: number | undefined;
|
|
1083
|
+
}, {
|
|
1084
|
+
isEntireMenu: boolean;
|
|
1085
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
1086
|
+
discountPercentage: number;
|
|
1087
|
+
maxDiscountCap: number;
|
|
1088
|
+
isOrderCapacityEnabled: boolean;
|
|
1089
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
1090
|
+
maxOrderCapacity?: number | undefined;
|
|
1091
|
+
shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
1092
|
+
}>, {
|
|
1093
|
+
isEntireMenu: boolean;
|
|
1094
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
1095
|
+
products: import("mongoose").Types.ObjectId[];
|
|
1096
|
+
discountPercentage: number;
|
|
1097
|
+
maxDiscountCap: number;
|
|
1098
|
+
isOrderCapacityEnabled: boolean;
|
|
1099
|
+
shopCategories: import("mongoose").Types.ObjectId[];
|
|
1100
|
+
maxOrderCapacity?: number | undefined;
|
|
1101
|
+
}, {
|
|
1102
|
+
isEntireMenu: boolean;
|
|
1103
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
1104
|
+
discountPercentage: number;
|
|
1105
|
+
maxDiscountCap: number;
|
|
1106
|
+
isOrderCapacityEnabled: boolean;
|
|
1107
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
1108
|
+
maxOrderCapacity?: number | undefined;
|
|
1109
|
+
shopCategories?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
1110
|
+
}>;
|
|
1111
|
+
export declare const AdminWithdrawShopSchema: z.ZodObject<{
|
|
1112
|
+
shopId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
1113
|
+
}, "strip", z.ZodTypeAny, {
|
|
1114
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
1115
|
+
}, {
|
|
1116
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
1117
|
+
}>;
|
|
1118
|
+
export declare const AdminGetParticipantByShopSchema: z.ZodObject<{
|
|
1119
|
+
shopId: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
|
|
1120
|
+
}, "strip", z.ZodTypeAny, {
|
|
1121
|
+
shopId: import("mongoose").Types.ObjectId;
|
|
1122
|
+
}, {
|
|
1123
|
+
shopId: string | import("mongoose").Types.ObjectId;
|
|
1124
|
+
}>;
|
|
1125
|
+
export type AdminWithdrawShopDTO = DTO<typeof AdminWithdrawShopSchema>;
|
|
1126
|
+
export type AdminEnrollShopEntryDTO = DTO<typeof AdminEnrollShopEntrySchema>;
|
|
1127
|
+
export type AdminEnrollShopsDTO = DTO<typeof AdminEnrollShopsSchema>;
|
|
733
1128
|
export type JoinLtoCampaignDTO = DTO<typeof JoinLtoCampaignSchema>;
|
|
734
1129
|
export type ParticipantDTO = DTO<typeof ParticipantSchema>;
|
|
735
1130
|
export type CampaignSummaryDTO = DTO<typeof CampaignSummarySchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-participant.validation.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAuB,GAAG,EAAgB,MAAM,yCAAyC,CAAC;AAEjG,oBAAY,YAAY;IACpB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,MAAM,WAAW;CACpB;
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.validation.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAuB,GAAG,EAAgB,MAAM,yCAAyC,CAAC;AAEjG,oBAAY,YAAY;IACpB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,MAAM,WAAW;CACpB;AAsCD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAkD,CAAC;AAErF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe5B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;EAQhC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;EASnC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;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AAC;AAChE,eAAO,MAAM,uBAAuB;;;;;;EAA+C,CAAC;AACpF,eAAO,MAAM,+BAA+B;;;;;;EAA+C,CAAC;AAE5F,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,uBAAuB,GAAG,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC7E,MAAM,MAAM,mBAAmB,GAAG,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACrE,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACnE,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC3D,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACnE,MAAM,MAAM,qBAAqB,GAAG,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACzE,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC;AAGvF,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,GAAG;IAAC,SAAS,EAAE,qBAAqB,CAAC,aAAa,CAAC,CAAA;CAAC,CAAC"}
|
package/dist/lib/modules/limited-time-offer/participant/limited-time-offer-participant.validation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParticipantStatusResponseSchema = exports.ParticipantResponseSchema = exports.ParticipantStatusSchema = exports.ParticipantSummarySchema = exports.CampaignSummarySchema = exports.ParticipantSchema = exports.JoinLtoCampaignSchema = exports.LtoCardState = void 0;
|
|
3
|
+
exports.AdminGetParticipantByShopSchema = exports.AdminWithdrawShopSchema = exports.AdminUpdateShopSchema = exports.AdminJoinParticipantsResponseSchema = exports.AdminEnrollShopsSchema = exports.AdminEnrollShopEntrySchema = exports.ParticipantStatusResponseSchema = exports.ParticipantResponseSchema = exports.ParticipantStatusSchema = exports.ParticipantSummarySchema = exports.CampaignSummarySchema = exports.ParticipantSchema = exports.JoinLtoCampaignSchema = exports.LtoCardState = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const validation_1 = require("@lyxa.ai/core/dist/utilities/validation");
|
|
6
6
|
var LtoCardState;
|
|
@@ -10,8 +10,7 @@ var LtoCardState;
|
|
|
10
10
|
LtoCardState["LIVE"] = "LIVE";
|
|
11
11
|
LtoCardState["JOINED"] = "JOINED";
|
|
12
12
|
})(LtoCardState || (exports.LtoCardState = LtoCardState = {}));
|
|
13
|
-
|
|
14
|
-
.object({
|
|
13
|
+
const joinLtoCampaignBase = zod_1.z.object({
|
|
15
14
|
isEntireMenu: zod_1.z.boolean(),
|
|
16
15
|
products: zod_1.z.array(validation_1.ZodValidation.objectId()).default([]),
|
|
17
16
|
shopCategories: zod_1.z.array(validation_1.ZodValidation.objectId()).default([]),
|
|
@@ -19,8 +18,8 @@ exports.JoinLtoCampaignSchema = zod_1.z
|
|
|
19
18
|
maxDiscountCap: validation_1.ZodValidation.number('Max discount cap'),
|
|
20
19
|
isOrderCapacityEnabled: zod_1.z.boolean(),
|
|
21
20
|
maxOrderCapacity: validation_1.ZodValidation.number('Max order capacity').optional(),
|
|
22
|
-
})
|
|
23
|
-
|
|
21
|
+
});
|
|
22
|
+
const joinRefinement = (d, ctx) => {
|
|
24
23
|
if (!d.isEntireMenu && d.products.length === 0 && d.shopCategories.length === 0) {
|
|
25
24
|
ctx.addIssue({
|
|
26
25
|
code: zod_1.z.ZodIssueCode.custom,
|
|
@@ -42,7 +41,8 @@ exports.JoinLtoCampaignSchema = zod_1.z
|
|
|
42
41
|
path: ['maxOrderCapacity']
|
|
43
42
|
});
|
|
44
43
|
}
|
|
45
|
-
}
|
|
44
|
+
};
|
|
45
|
+
exports.JoinLtoCampaignSchema = joinLtoCampaignBase.superRefine(joinRefinement);
|
|
46
46
|
exports.ParticipantSchema = zod_1.z.object({
|
|
47
47
|
_id: validation_1.ZodValidation.objectId(),
|
|
48
48
|
campaign: validation_1.ZodValidation.objectId(),
|
|
@@ -85,4 +85,14 @@ exports.ParticipantStatusSchema = zod_1.z.object({
|
|
|
85
85
|
});
|
|
86
86
|
exports.ParticipantResponseSchema = (0, validation_1.createResponseSchema)(exports.ParticipantSchema);
|
|
87
87
|
exports.ParticipantStatusResponseSchema = (0, validation_1.createResponseSchema)(exports.ParticipantStatusSchema);
|
|
88
|
+
exports.AdminEnrollShopEntrySchema = joinLtoCampaignBase
|
|
89
|
+
.extend({ shopId: validation_1.ZodValidation.objectId() })
|
|
90
|
+
.superRefine(joinRefinement);
|
|
91
|
+
exports.AdminEnrollShopsSchema = zod_1.z.object({
|
|
92
|
+
shops: zod_1.z.array(exports.AdminEnrollShopEntrySchema).min(1),
|
|
93
|
+
});
|
|
94
|
+
exports.AdminJoinParticipantsResponseSchema = (0, validation_1.createResponseSchema)(zod_1.z.array(exports.ParticipantSchema));
|
|
95
|
+
exports.AdminUpdateShopSchema = exports.AdminEnrollShopEntrySchema;
|
|
96
|
+
exports.AdminWithdrawShopSchema = zod_1.z.object({ shopId: validation_1.ZodValidation.objectId() });
|
|
97
|
+
exports.AdminGetParticipantByShopSchema = zod_1.z.object({ shopId: validation_1.ZodValidation.objectId() });
|
|
88
98
|
//# sourceMappingURL=limited-time-offer-participant.validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-participant.validation.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,wEAAiG;AAEjG,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,6BAAa,CAAA;IACb,uCAAuB,CAAA;IACvB,6BA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C,CAAC,OAAO,CAAC,EAAE,CAAC;IACzD,WAAW,EAAE,0BAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC;AAEU,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,aAAa,EAAE,OAAC,CAAC,UAAU,CAAC,YAAY,CAAC;IACzC,QAAQ,EAAE,6BAAqB,CAAC,QAAQ,EAAE;IAC1C,WAAW,EAAE,gCAAwB,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC;AAEU,QAAA,yBAAyB,GAAG,IAAA,iCAAoB,EAAC,yBAAiB,CAAC,CAAC;AACpE,QAAA,+BAA+B,GAAG,IAAA,iCAAoB,EAAC,+BAAuB,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport {createResponseSchema, DTO, ZodValidation} from '@lyxa.ai/core/dist/utilities/validation';\n\nexport enum LtoCardState {\n NONE = 'NONE',\n SCHEDULED = 'SCHEDULED',\n LIVE = 'LIVE',\n JOINED = 'JOINED',\n}\n\nexport const JoinLtoCampaignSchema = z\n .object({\n isEntireMenu: z.boolean(),\n products: z.array(ZodValidation.objectId()).default([]),\n shopCategories: z.array(ZodValidation.objectId()).default([]),\n discountPercentage: ZodValidation.number('Discount percentage'),\n maxDiscountCap: ZodValidation.number('Max discount cap'),\n isOrderCapacityEnabled: z.boolean(),\n maxOrderCapacity: ZodValidation.number('Max order capacity').optional(),\n })\n .superRefine((d, ctx) => {\n if (!d.isEntireMenu && d.products.length === 0 && d.shopCategories.length === 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'At least one product or category must be selected',\n path: ['products']\n });\n }\n if (d.isOrderCapacityEnabled && !d.maxOrderCapacity) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Max order capacity is required when capacity is enabled',\n path: ['maxOrderCapacity']\n });\n }\n if (d.isOrderCapacityEnabled && d.maxOrderCapacity !== undefined && d.maxOrderCapacity <= 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Max order capacity must be greater than 0',\n path: ['maxOrderCapacity']\n });\n }\n });\n\nexport const ParticipantSchema = z.object({\n _id: ZodValidation.objectId(),\n campaign: ZodValidation.objectId(),\n shop: ZodValidation.objectId(),\n joinedAt: z.date(),\n products: z.array(ZodValidation.objectId()).default([]),\n isEntireMenu: z.boolean(),\n discountPercentage: ZodValidation.number('Discount percentage').optional(),\n maxDiscountCap: ZodValidation.number('Max discount cap').optional(),\n isOrderCapacityEnabled: z.boolean(),\n maxOrderCapacity: ZodValidation.number('Max order capacity').optional(),\n isWithdrawn: z.boolean(),\n withdrawnAt: z.date().nullable().optional(),\n createdAt: z.date().nullable().optional(),\n updatedAt: z.date().nullable().optional(),\n});\n\nexport const CampaignSummarySchema = z.object({\n _id: ZodValidation.objectId(),\n title: ZodValidation.string('Title').optional(),\n subTitle: ZodValidation.string('Subtitle').optional(),\n startDate: z.date().nullable().optional(),\n endDate: z.date().nullable().optional(),\n discountOptions: z.array(ZodValidation.number('Discount option')).default([]),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).default([]),\n});\n\nexport const ParticipantSummarySchema = z.object({\n discountPercentage: ZodValidation.number('Discount percentage').optional(),\n maxDiscountCap: ZodValidation.number('Max discount cap').optional(),\n joinedAt: z.date(),\n isEntireMenu: z.boolean(),\n isOrderCapacityEnabled: z.boolean(),\n maxOrderCapacity: ZodValidation.number('Max order capacity').optional(),\n productIds: z.array(ZodValidation.objectId()).default([]),\n marketingId: ZodValidation.objectId().optional(),\n});\n\nexport const ParticipantStatusSchema = z.object({\n campaignState: z.nativeEnum(LtoCardState),\n campaign: CampaignSummarySchema.optional(),\n participant: ParticipantSummarySchema.optional(),\n});\n\nexport const ParticipantResponseSchema = createResponseSchema(ParticipantSchema);\nexport const ParticipantStatusResponseSchema = createResponseSchema(ParticipantStatusSchema);\n\nexport type JoinLtoCampaignDTO = DTO<typeof JoinLtoCampaignSchema>;\nexport type ParticipantDTO = DTO<typeof ParticipantSchema>;\nexport type CampaignSummaryDTO = DTO<typeof CampaignSummarySchema>;\nexport type ParticipantSummaryDTO = DTO<typeof ParticipantSummarySchema>;\nexport type ParticipantStatusDTO = DTO<typeof ParticipantStatusSchema>;\nexport type ActiveParticipantMarketingDTO = Pick<ParticipantSummaryDTO, 'marketingId'>;\n// shopCategories are intentionally excluded: the participant record does not persist category\n// selections — they live on the linked marketing doc and are derived from there for display.\nexport type UpdateParticipantDataDTO = Omit<JoinLtoCampaignDTO, 'shopCategories'> & {marketing: ParticipantSummaryDTO['marketingId']};\n"]}
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant.validation.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/limited-time-offer-participant.validation.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,wEAAiG;AAEjG,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,6BAAa,CAAA;IACb,uCAAuB,CAAA;IACvB,6BAAa,CAAA;IACb,iCAAiB,CAAA;AACrB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,YAAY,EAAE,OAAC,CAAC,OAAO,EAAE;IACzB,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,0BAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACvD,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,0BAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7D,kBAAkB,EAAE,0BAAa,CAAC,MAAM,CAAC,qBAAqB,CAAC;IAC/D,cAAc,EAAE,0BAAa,CAAC,MAAM,CAAC,kBAAkB,CAAC;IACxD,sBAAsB,EAAE,OAAC,CAAC,OAAO,EAAE;IACnC,gBAAgB,EAAE,0BAAa,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE;CAC1E,CAAC,CAAC;AAIH,M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AAE,CAAC;KAC5C,WAAW,CAAC,cAAc,CAAC,CAAC;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,kCAA0B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CACpD,CAAC,CAAC;AAEU,QAAA,mCAAmC,GAAG,IAAA,iCAAoB,EAAC,OAAC,CAAC,KAAK,CAAC,yBAAiB,CAAC,CAAC,CAAC;AAGvF,QAAA,qBAAqB,GAAG,kCAA0B,CAAC;AACnD,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,0BAAa,CAAC,QAAQ,EAAE,EAAC,CAAC,CAAC;AACvE,QAAA,+BAA+B,GAAG,OAAC,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,0BAAa,CAAC,QAAQ,EAAE,EAAC,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport {createResponseSchema, DTO, ZodValidation} from '@lyxa.ai/core/dist/utilities/validation';\n\nexport enum LtoCardState {\n NONE = 'NONE',\n SCHEDULED = 'SCHEDULED',\n LIVE = 'LIVE',\n JOINED = 'JOINED',\n}\n\nconst joinLtoCampaignBase = z.object({\n isEntireMenu: z.boolean(),\n products: z.array(ZodValidation.objectId()).default([]),\n shopCategories: z.array(ZodValidation.objectId()).default([]),\n discountPercentage: ZodValidation.number('Discount percentage'),\n maxDiscountCap: ZodValidation.number('Max discount cap'),\n isOrderCapacityEnabled: z.boolean(),\n maxOrderCapacity: ZodValidation.number('Max order capacity').optional(),\n});\n\ntype JoinLtoCampaignBase = z.infer<typeof joinLtoCampaignBase>;\n\nconst joinRefinement = (d: JoinLtoCampaignBase, ctx: z.RefinementCtx) => {\n if (!d.isEntireMenu && d.products.length === 0 && d.shopCategories.length === 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'At least one product or category must be selected',\n path: ['products']\n });\n }\n if (d.isOrderCapacityEnabled && !d.maxOrderCapacity) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Max order capacity is required when capacity is enabled',\n path: ['maxOrderCapacity']\n });\n }\n if (d.isOrderCapacityEnabled && d.maxOrderCapacity !== undefined && d.maxOrderCapacity <= 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Max order capacity must be greater than 0',\n path: ['maxOrderCapacity']\n });\n }\n};\n\nexport const JoinLtoCampaignSchema = joinLtoCampaignBase.superRefine(joinRefinement);\n\nexport const ParticipantSchema = z.object({\n _id: ZodValidation.objectId(),\n campaign: ZodValidation.objectId(),\n shop: ZodValidation.objectId(),\n joinedAt: z.date(),\n products: z.array(ZodValidation.objectId()).default([]),\n isEntireMenu: z.boolean(),\n discountPercentage: ZodValidation.number('Discount percentage').optional(),\n maxDiscountCap: ZodValidation.number('Max discount cap').optional(),\n isOrderCapacityEnabled: z.boolean(),\n maxOrderCapacity: ZodValidation.number('Max order capacity').optional(),\n isWithdrawn: z.boolean(),\n withdrawnAt: z.date().nullable().optional(),\n createdAt: z.date().nullable().optional(),\n updatedAt: z.date().nullable().optional(),\n});\n\nexport const CampaignSummarySchema = z.object({\n _id: ZodValidation.objectId(),\n title: ZodValidation.string('Title').optional(),\n subTitle: ZodValidation.string('Subtitle').optional(),\n startDate: z.date().nullable().optional(),\n endDate: z.date().nullable().optional(),\n discountOptions: z.array(ZodValidation.number('Discount option')).default([]),\n maxDiscountCaps: z.array(ZodValidation.number('Max discount cap')).default([]),\n});\n\nexport const ParticipantSummarySchema = z.object({\n discountPercentage: ZodValidation.number('Discount percentage').optional(),\n maxDiscountCap: ZodValidation.number('Max discount cap').optional(),\n joinedAt: z.date(),\n isEntireMenu: z.boolean(),\n isOrderCapacityEnabled: z.boolean(),\n maxOrderCapacity: ZodValidation.number('Max order capacity').optional(),\n productIds: z.array(ZodValidation.objectId()).default([]),\n marketingId: ZodValidation.objectId().optional(),\n});\n\nexport const ParticipantStatusSchema = z.object({\n campaignState: z.nativeEnum(LtoCardState),\n campaign: CampaignSummarySchema.optional(),\n participant: ParticipantSummarySchema.optional(),\n});\n\nexport const ParticipantResponseSchema = createResponseSchema(ParticipantSchema);\nexport const ParticipantStatusResponseSchema = createResponseSchema(ParticipantStatusSchema);\n\nexport const AdminEnrollShopEntrySchema = joinLtoCampaignBase\n .extend({ shopId: ZodValidation.objectId() })\n .superRefine(joinRefinement);\n\nexport const AdminEnrollShopsSchema = z.object({\n shops: z.array(AdminEnrollShopEntrySchema).min(1),\n});\n\nexport const AdminJoinParticipantsResponseSchema = createResponseSchema(z.array(ParticipantSchema));\n\n// Admin edit reuses the enroll entry shape (shopId + join fields); withdraw and get-by-shop only need the shop.\nexport const AdminUpdateShopSchema = AdminEnrollShopEntrySchema;\nexport const AdminWithdrawShopSchema = z.object({shopId: ZodValidation.objectId()});\nexport const AdminGetParticipantByShopSchema = z.object({shopId: ZodValidation.objectId()});\n\nexport type AdminWithdrawShopDTO = DTO<typeof AdminWithdrawShopSchema>;\nexport type AdminEnrollShopEntryDTO = DTO<typeof AdminEnrollShopEntrySchema>;\nexport type AdminEnrollShopsDTO = DTO<typeof AdminEnrollShopsSchema>;\nexport type JoinLtoCampaignDTO = DTO<typeof JoinLtoCampaignSchema>;\nexport type ParticipantDTO = DTO<typeof ParticipantSchema>;\nexport type CampaignSummaryDTO = DTO<typeof CampaignSummarySchema>;\nexport type ParticipantSummaryDTO = DTO<typeof ParticipantSummarySchema>;\nexport type ParticipantStatusDTO = DTO<typeof ParticipantStatusSchema>;\nexport type ActiveParticipantMarketingDTO = Pick<ParticipantSummaryDTO, 'marketingId'>;\n// shopCategories are intentionally excluded: the participant record does not persist category\n// selections — they live on the linked marketing doc and are derived from there for display.\nexport type UpdateParticipantDataDTO = Omit<JoinLtoCampaignDTO, 'shopCategories'> & {marketing: ParticipantSummaryDTO['marketingId']};\n"]}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { mongoose } from '@typegoose/typegoose';
|
|
2
2
|
import { LimitedTimeOfferCampaign } from '@lyxa.ai/core/dist/libraries/mongo/models';
|
|
3
|
+
import { MarketingType } from '@lyxa.ai/core/dist/utilities/enum';
|
|
3
4
|
import { JoinLtoCampaignDTO } from '../limited-time-offer-participant.validation';
|
|
4
5
|
export declare class LtoParticipantMarketingService {
|
|
5
6
|
private repository;
|
|
6
7
|
constructor();
|
|
7
8
|
applyMarketing(shopId: mongoose.Types.ObjectId, campaign: LimitedTimeOfferCampaign & {
|
|
8
9
|
_id: mongoose.Types.ObjectId;
|
|
9
|
-
}, dto: JoinLtoCampaignDTO): Promise<
|
|
10
|
+
}, dto: JoinLtoCampaignDTO): Promise<{
|
|
11
|
+
marketingId: mongoose.Types.ObjectId;
|
|
12
|
+
pausedMarketingIds: mongoose.Types.ObjectId[];
|
|
13
|
+
}>;
|
|
10
14
|
removeMarketing(marketingId: mongoose.Types.ObjectId): Promise<void>;
|
|
11
|
-
replaceMarketing(oldMarketingId: mongoose.Types.ObjectId, shopId: mongoose.Types.ObjectId, campaign: LimitedTimeOfferCampaign & {
|
|
12
|
-
_id: mongoose.Types.ObjectId;
|
|
13
|
-
}, dto: JoinLtoCampaignDTO): Promise<mongoose.Types.ObjectId>;
|
|
14
15
|
removeAllCampaignMarketings(campaignId: mongoose.Types.ObjectId): Promise<void>;
|
|
16
|
+
pauseActiveShopMarketings(shopId: mongoose.Types.ObjectId, marketingType: MarketingType): Promise<mongoose.Types.ObjectId[]>;
|
|
17
|
+
resumeMarketings(marketingIds: mongoose.Types.ObjectId[]): Promise<void>;
|
|
15
18
|
}
|
|
16
19
|
export declare const ltoParticipantMarketingService: LtoParticipantMarketingService;
|
|
17
20
|
//# sourceMappingURL=limited-time-offer-participant-marketing.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-participant-marketing.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAC,wBAAwB,EAAC,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAC,kBAAkB,EAAC,MAAM,8CAA8C,CAAC;AAIhF,qBACa,8BAA8B;IACvC,OAAO,CAAC,UAAU,CAA2B;;IAMhC,cAAc,CACvB,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,QAAQ,EAAE,wBAAwB,GAAG;QAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAA;KAAC,EACnE,GAAG,EAAE,kBAAkB,GACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant-marketing.service.d.ts","sourceRoot":"/","sources":["modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAC,wBAAwB,EAAC,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAkB,aAAa,EAAC,MAAM,mCAAmC,CAAC;AAGjF,OAAO,EAAC,kBAAkB,EAAC,MAAM,8CAA8C,CAAC;AAIhF,qBACa,8BAA8B;IACvC,OAAO,CAAC,UAAU,CAA2B;;IAMhC,cAAc,CACvB,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAC/B,QAAQ,EAAE,wBAAwB,GAAG;QAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAA;KAAC,EACnE,GAAG,EAAE,kBAAkB,GACxB,OAAO,CAAC;QAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QAAC,kBAAkB,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAA;KAAC,CAAC;IAiBpF,eAAe,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE,2BAA2B,CAAC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/E,yBAAyB,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAQ5H,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAQxF;AAED,eAAO,MAAM,8BAA8B,gCAAgD,CAAC"}
|
|
@@ -45,6 +45,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
45
|
exports.ltoParticipantMarketingService = exports.LtoParticipantMarketingService = void 0;
|
|
46
46
|
const typedi_1 = __importStar(require("typedi"));
|
|
47
47
|
const services_1 = require("../../../marketing/services");
|
|
48
|
+
const enum_1 = require("@lyxa.ai/core/dist/utilities/enum");
|
|
48
49
|
const limited_time_offer_participant_builder_1 = require("../limited-time-offer-participant.builder");
|
|
49
50
|
const limited_time_offer_participant_repository_1 = require("../limited-time-offer-participant.repository");
|
|
50
51
|
let LtoParticipantMarketingService = class LtoParticipantMarketingService {
|
|
@@ -53,20 +54,44 @@ let LtoParticipantMarketingService = class LtoParticipantMarketingService {
|
|
|
53
54
|
this.repository = typedi_1.default.get(limited_time_offer_participant_repository_1.LtoParticipantRepository);
|
|
54
55
|
}
|
|
55
56
|
async applyMarketing(shopId, campaign, dto) {
|
|
56
|
-
const
|
|
57
|
-
|
|
57
|
+
const productIds = dto.isEntireMenu ? [] : (dto.products ?? []);
|
|
58
|
+
const pausedMarketingIds = productIds.length
|
|
59
|
+
? await services_1.productMarketingService.pauseConflictingMarketings(productIds)
|
|
60
|
+
: [];
|
|
61
|
+
try {
|
|
62
|
+
const marketing = await services_1.marketingService.create(limited_time_offer_participant_builder_1.LtoParticipantQueryBuilder.buildMarketingInput(shopId, campaign, dto));
|
|
63
|
+
return { marketingId: marketing._id, pausedMarketingIds };
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
await this.resumeMarketings(pausedMarketingIds);
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
58
69
|
}
|
|
59
70
|
async removeMarketing(marketingId) {
|
|
60
71
|
await services_1.marketingService.deleteById({ _id: marketingId, softDelete: true });
|
|
61
72
|
}
|
|
62
|
-
async replaceMarketing(oldMarketingId, shopId, campaign, dto) {
|
|
63
|
-
await this.removeMarketing(oldMarketingId);
|
|
64
|
-
return this.applyMarketing(shopId, campaign, dto);
|
|
65
|
-
}
|
|
66
73
|
async removeAllCampaignMarketings(campaignId) {
|
|
67
74
|
const marketingIds = await this.repository.findMarketingIdsByCampaign(campaignId);
|
|
68
75
|
await services_1.marketingService.deleteManyByIds(marketingIds);
|
|
69
76
|
}
|
|
77
|
+
async pauseActiveShopMarketings(shopId, marketingType) {
|
|
78
|
+
const ids = await this.repository.findActiveMarketingIdsByShop(shopId, marketingType);
|
|
79
|
+
if (!ids.length)
|
|
80
|
+
return [];
|
|
81
|
+
await this.repository.updateMarketingStatus(ids, enum_1.MarketingStatus.PAUSED);
|
|
82
|
+
await services_1.synchronizeProductMarketingService.syncProductMarketingInfoByMarketingIds(ids);
|
|
83
|
+
return ids;
|
|
84
|
+
}
|
|
85
|
+
async resumeMarketings(marketingIds) {
|
|
86
|
+
if (!marketingIds?.length)
|
|
87
|
+
return;
|
|
88
|
+
const revivable = await this.repository.findRevivableMarketings(marketingIds);
|
|
89
|
+
if (!revivable.length)
|
|
90
|
+
return;
|
|
91
|
+
const ids = revivable.map(m => m._id);
|
|
92
|
+
await this.repository.updateMarketingStatus(ids, enum_1.MarketingStatus.ACTIVE);
|
|
93
|
+
await services_1.synchronizeProductMarketingService.syncProductMarketingInfoByMarketingIds(ids);
|
|
94
|
+
}
|
|
70
95
|
};
|
|
71
96
|
exports.LtoParticipantMarketingService = LtoParticipantMarketingService;
|
|
72
97
|
exports.LtoParticipantMarketingService = LtoParticipantMarketingService = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limited-time-offer-participant-marketing.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,
|
|
1
|
+
{"version":3,"file":"limited-time-offer-participant-marketing.service.js","sourceRoot":"/","sources":["modules/limited-time-offer/participant/services/limited-time-offer-participant-marketing.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,0DAA0H;AAE1H,4DAAiF;AAIjF,sGAAqF;AACrF,4GAAsF;AAG/E,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAC/B,UAAU,CAA2B;IAE7C;QACI,IAAI,CAAC,UAAU,GAAG,gBAAS,CAAC,GAAG,CAAC,oEAAwB,CAAC,CAAC;IAC9D,CAAC;IAEM,KAAK,CAAC,cAAc,CACvB,MAA+B,EAC/B,QAAmE,EACnE,GAAuB;QAEvB,MAAM,UAAU,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QAChE,MAAM,kBAAkB,GAAG,UAAU,CAAC,MAAM;YACxC,CAAC,CAAC,MAAM,kCAAuB,CAAC,0BAA0B,CAAC,UAAU,CAAC;YACtE,CAAC,CAAC,EAAE,CAAC;QAET,IAAI,CAAC;YACD,MAAM,SAAS,GAAG,MAAM,2BAAgB,CAAC,MAAM,CAC3C,mEAA0B,CAAC,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,CACxE,CAAC;YACF,OAAO,EAAC,WAA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AAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,GAAG,EAAE,sBAAe,CAAC,MAAM,CAAC,CAAC;QACzE,MAAM,6CAAkC,CAAC,sCAAsC,CAAC,GAAG,CAAC,CAAC;IACzF,CAAC;CACJ,CAAA;AArDY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,gBAAO,GAAE;;GACG,8BAA8B,CAqD1C;AAEY,QAAA,8BAA8B,GAAG,gBAAS,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC","sourcesContent":["import Container, {Service} from 'typedi';\nimport {mongoose} from '@typegoose/typegoose';\nimport {marketingService, productMarketingService, synchronizeProductMarketingService} from '@modules/marketing/services';\nimport {LimitedTimeOfferCampaign} from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport {MarketingStatus, MarketingType} from '@lyxa.ai/core/dist/utilities/enum';\nimport {publishSyncSingleShopSectionsInCacheProcessEvent} from '@lyxa.ai/core/dist/utilities/events-common-methods';\nimport {ChangeStreamOperationTypes} from '@lyxa.ai/core/dist/libraries/event/events/mongo-stream-changes-batch-process-shops-event';\nimport {JoinLtoCampaignDTO} from '../limited-time-offer-participant.validation';\nimport {LtoParticipantQueryBuilder} from '../limited-time-offer-participant.builder';\nimport {LtoParticipantRepository} from '../limited-time-offer-participant.repository';\n\n@Service()\nexport class LtoParticipantMarketingService {\n private repository: LtoParticipantRepository;\n\n constructor() {\n this.repository = Container.get(LtoParticipantRepository);\n }\n\n public async applyMarketing(\n shopId: mongoose.Types.ObjectId,\n campaign: LimitedTimeOfferCampaign & {_id: mongoose.Types.ObjectId},\n dto: JoinLtoCampaignDTO,\n ): Promise<{marketingId: mongoose.Types.ObjectId; pausedMarketingIds: mongoose.Types.ObjectId[]}> {\n const productIds = dto.isEntireMenu ? [] : (dto.products ?? []);\n const pausedMarketingIds = productIds.length\n ? await productMarketingService.pauseConflictingMarketings(productIds)\n : [];\n\n try {\n const marketing = await marketingService.create(\n LtoParticipantQueryBuilder.buildMarketingInput(shopId, campaign, dto),\n );\n return {marketingId: marketing._id, pausedMarketingIds};\n } catch (err) {\n await this.resumeMarketings(pausedMarketingIds);\n throw err;\n }\n }\n\n public async removeMarketing(marketingId: mongoose.Types.ObjectId): Promise<void> {\n await marketingService.deleteById({_id: marketingId, softDelete: true});\n }\n\n public async removeAllCampaignMarketings(campaignId: mongoose.Types.ObjectId): Promise<void> {\n const marketingIds = await this.repository.findMarketingIdsByCampaign(campaignId);\n await marketingService.deleteManyByIds(marketingIds);\n }\n\n public async pauseActiveShopMarketings(shopId: mongoose.Types.ObjectId, marketingType: MarketingType): Promise<mongoose.Types.ObjectId[]> {\n const ids = await this.repository.findActiveMarketingIdsByShop(shopId, marketingType);\n if (!ids.length) return [];\n await this.repository.updateMarketingStatus(ids, MarketingStatus.PAUSED);\n await synchronizeProductMarketingService.syncProductMarketingInfoByMarketingIds(ids);\n return ids;\n }\n\n public async resumeMarketings(marketingIds: mongoose.Types.ObjectId[]): Promise<void> {\n if (!marketingIds?.length) return;\n const revivable = await this.repository.findRevivableMarketings(marketingIds);\n if (!revivable.length) return;\n const ids = revivable.map(m => m._id);\n await this.repository.updateMarketingStatus(ids, MarketingStatus.ACTIVE);\n await synchronizeProductMarketingService.syncProductMarketingInfoByMarketingIds(ids);\n }\n}\n\nexport const ltoParticipantMarketingService = Container.get(LtoParticipantMarketingService);\n"]}
|