@lyxa.ai/marketing 1.0.43 → 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 +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 +7 -0
- package/dist/lib/event/event-listeners/event-listeners.js.map +1 -1
- package/dist/lib/index.d.ts +60 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts +2 -0
- package/dist/lib/modules/coupon/routers/coupon.router.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map +1 -1
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js +1 -0
- package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.js.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts +13 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/lib/modules/coupon/validations/coupon.validation.js +1 -0
- package/dist/lib/modules/coupon/validations/coupon.validation.js.map +1 -1
- package/dist/lib/modules/limited-time-offer/limited-time-offer.router.d.ts +58 -0
- 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.repository.d.ts +4 -1
- 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 +18 -2
- 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 +58 -0
- 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 +7 -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 +137 -3
- 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 +3 -0
- 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 +4 -0
- 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 +1 -0
- 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 +19 -0
- 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.js.map +1 -1
- 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/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/index.d.ts +60 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/coupon/routers/coupon.router.d.ts +2 -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.map +1 -1
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts +13 -0
- package/dist/types/modules/coupon/validations/coupon.validation.d.ts.map +1 -1
- package/dist/types/modules/limited-time-offer/limited-time-offer.router.d.ts +58 -0
- 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.repository.d.ts +4 -1
- 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 +58 -0
- 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 +137 -3
- 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 +3 -0
- 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 +1 -0
- package/dist/types/modules/limited-time-offer/participant/services/limited-time-offer-participant.service.d.ts.map +1 -1
- 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/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-initializations.d.ts","sourceRoot":"/","sources":["event/event-initializations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-initializations.d.ts","sourceRoot":"/","sources":["event/event-initializations.ts"],"names":[],"mappings":"AAOA,wBAAsB,kBAAkB,kBAKvC"}
|
|
@@ -6,6 +6,7 @@ const jobs_1 = require("../modules/limited-time-offer/campaign/jobs");
|
|
|
6
6
|
async function initEventListeners() {
|
|
7
7
|
(0, event_listeners_1.subscribeToSyncAllProductsProductMarketingInfoProcessEvent)();
|
|
8
8
|
await (0, event_listeners_1.subscribeToMarketingEntireMenuSeedEvent)();
|
|
9
|
+
await (0, event_listeners_1.subscribeToMarketingReturnPunchCouponEvent)();
|
|
9
10
|
await (0, jobs_1.startBullMQWorkers)();
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=event-initializations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-initializations.js","sourceRoot":"/","sources":["event/event-initializations.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"event-initializations.js","sourceRoot":"/","sources":["event/event-initializations.ts"],"names":[],"mappings":";;AAOA,gDAKC;AAZD,uEAI2C;AAC3C,oEAA+E;AAExE,KAAK,UAAU,kBAAkB;IACpC,IAAA,4EAA0D,GAAE,CAAC;IAC7D,MAAM,IAAA,yDAAuC,GAAE,CAAC;IAChD,MAAM,IAAA,4DAA0C,GAAE,CAAC;IACnD,MAAM,IAAA,yBAAkB,GAAE,CAAC;AAC/B,CAAC","sourcesContent":["import {\n subscribeToSyncAllProductsProductMarketingInfoProcessEvent,\n subscribeToMarketingEntireMenuSeedEvent,\n subscribeToMarketingReturnPunchCouponEvent,\n} from './event-listeners/event-listeners';\nimport { startBullMQWorkers } from '@modules/limited-time-offer/campaign/jobs';\n\nexport async function initEventListeners() {\n subscribeToSyncAllProductsProductMarketingInfoProcessEvent();\n await subscribeToMarketingEntireMenuSeedEvent();\n await subscribeToMarketingReturnPunchCouponEvent();\n await startBullMQWorkers();\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare function subscribeToSyncAllProductsProductMarketingInfoProcessEvent(): Promise<void>;
|
|
2
2
|
export declare function subscribeToMarketingEntireMenuSeedEvent(): Promise<void>;
|
|
3
|
+
export declare function subscribeToMarketingReturnPunchCouponEvent(): Promise<void>;
|
|
3
4
|
//# sourceMappingURL=event-listeners.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-listeners.d.ts","sourceRoot":"/","sources":["event/event-listeners/event-listeners.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event-listeners.d.ts","sourceRoot":"/","sources":["event/event-listeners/event-listeners.ts"],"names":[],"mappings":"AAaA,wBAAsB,0DAA0D,kBAI/E;AAED,wBAAsB,uCAAuC,kBAmD5D;AAED,wBAAsB,0CAA0C,kBAI/D"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.subscribeToSyncAllProductsProductMarketingInfoProcessEvent = subscribeToSyncAllProductsProductMarketingInfoProcessEvent;
|
|
4
4
|
exports.subscribeToMarketingEntireMenuSeedEvent = subscribeToMarketingEntireMenuSeedEvent;
|
|
5
|
+
exports.subscribeToMarketingReturnPunchCouponEvent = subscribeToMarketingReturnPunchCouponEvent;
|
|
5
6
|
const event_1 = require("@lyxa.ai/core/dist/libraries/event");
|
|
6
7
|
const core_1 = require("@lyxa.ai/core");
|
|
7
8
|
const services_1 = require("../../modules/marketing/services");
|
|
@@ -10,6 +11,7 @@ const typegoose_1 = require("@typegoose/typegoose");
|
|
|
10
11
|
const mongo_stream_changes_batch_process_shops_event_1 = require("@lyxa.ai/core/dist/libraries/event/events/mongo-stream-changes-batch-process-shops-event");
|
|
11
12
|
const events_common_methods_1 = require("@lyxa.ai/core/dist/utilities/events-common-methods");
|
|
12
13
|
const marketing_product_seed_event_1 = require("../events/marketing-product-seed.event");
|
|
14
|
+
const services_2 = require("../../modules/punch-marketing-history/services");
|
|
13
15
|
async function subscribeToSyncAllProductsProductMarketingInfoProcessEvent() {
|
|
14
16
|
await (0, event_1.subscribeToEvent)(EventEnums_1.PublishEventEnums.SYNC_ALL_PRODUCTS_PRODUCT_MARKETING_INFO_EVENT, async (payload) => {
|
|
15
17
|
services_1.synchronizeProductMarketingService.processAllProductsProductMarketingInfoEvent(payload);
|
|
@@ -61,4 +63,9 @@ async function subscribeToMarketingEntireMenuSeedEvent() {
|
|
|
61
63
|
});
|
|
62
64
|
});
|
|
63
65
|
}
|
|
66
|
+
async function subscribeToMarketingReturnPunchCouponEvent() {
|
|
67
|
+
await (0, event_1.subscribeToEvent)(EventEnums_1.PublishEventEnums.MARKETING_RETURN_PUNCH_COUPON_EVENT, async (payload) => {
|
|
68
|
+
services_2.punchMarketingHistoryService.returnPunchCoupon(payload.orderId);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
64
71
|
//# sourceMappingURL=event-listeners.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-listeners.js","sourceRoot":"/","sources":["event/event-listeners/event-listeners.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"event-listeners.js","sourceRoot":"/","sources":["event/event-listeners/event-listeners.ts"],"names":[],"mappings":";;AAaA,gIAIC;AAED,0FAmDC;AAED,gGAIC;AA5ED,8DAAsE;AACtE,wCAA6C;AAC7C,0DAA0G;AAC1G,8EAAkF;AAClF,oDAAgD;AAChD,6JAAsI;AACtI,8FAAsH;AACtH,yFAGgD;AAChD,wEAAyF;AAElF,KAAK,UAAU,0DAA0D;IAC/E,MAAM,IAAA,wBAAgB,EAAC,8BAAiB,CAAC,8CAA8C,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;QACxG,6CAAkC,CAAC,2CAA2C,CAAC,OAAO,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,uCAAuC;IAC5D,MAAM,IAAA,wBAAgB,EAAC,+DAAgC,EAAE,KAAK,EAAE,OAAoC,EAAE,EAAE;QACvG,MAAM,MAAM,GAAG,IAAA,mBAAY,GAAE,CAAC,YAAY,EAAE,C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AC;gBAEH,OAAO;YACR,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,SAAS,GAAG,KAAK,CAAC;gBAClB,IAAI,OAAO,GAAG,YAAY,EAAE,CAAC;oBAC5B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;gBACnE,CAAC;YACF,CAAC;QACF,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,sBAAsB,YAAY,oCAAoC,EAAE,SAAS,EAAE;YAC3G,GAAG,EAAE,4BAA4B;YACjC,IAAI,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;SACvD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,0CAA0C;IAC/D,MAAM,IAAA,wBAAgB,EAAC,8BAAiB,CAAC,mCAAmC,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;QAC7F,uCAA4B,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { subscribeToEvent } from '@lyxa.ai/core/dist/libraries/event';\nimport { getLibraries } from '@lyxa.ai/core';\nimport { productMarketingService, synchronizeProductMarketingService } from '@modules/marketing/services';\nimport { PublishEventEnums } from '@lyxa.ai/core/dist/libraries/event/EventEnums';\nimport { mongoose } from '@typegoose/typegoose';\nimport { ChangeStreamOperationTypes } from '@lyxa.ai/core/dist/libraries/event/events/mongo-stream-changes-batch-process-shops-event';\nimport { publishSyncSingleShopSectionsInCacheProcessEvent } from '@lyxa.ai/core/dist/utilities/events-common-methods';\nimport {\n\tMARKETING_ENTIRE_MENU_SEED_EVENT,\n\tMarketingProductSeedPayload,\n} from '../events/marketing-product-seed.event';\nimport { punchMarketingHistoryService } from '@modules/punch-marketing-history/services';\n\nexport async function subscribeToSyncAllProductsProductMarketingInfoProcessEvent() {\n\tawait subscribeToEvent(PublishEventEnums.SYNC_ALL_PRODUCTS_PRODUCT_MARKETING_INFO_EVENT, async payload => {\n\t\tsynchronizeProductMarketingService.processAllProductsProductMarketingInfoEvent(payload);\n\t});\n}\n\nexport async function subscribeToMarketingEntireMenuSeedEvent() {\n\tawait subscribeToEvent(MARKETING_ENTIRE_MENU_SEED_EVENT, async (payload: MarketingProductSeedPayload) => {\n\t\tconst logger = getLibraries().getLoggerKit();\n\t\tconst { marketingId: mid, shopId: sid, page, pageSize } = payload;\n\t\tconst marketingId = new mongoose.Types.ObjectId(mid);\n\t\tconst shopId = new mongoose.Types.ObjectId(sid);\n\n\t\tconst MAX_ATTEMPTS = 3;\n\t\tlet lastError: unknown;\n\n\t\tfor (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {\n\t\t\ttry {\n\t\t\t\tconst productIds = await productMarketingService.upsertProductMarketingsForPage({\n\t\t\t\t\tshop: shopId,\n\t\t\t\t\tmarketingId,\n\t\t\t\t\tpage,\n\t\t\t\t\tpageSize,\n\t\t\t\t\tisAppliedByCompany: payload.isAppliedByCompany,\n\t\t\t\t\tisBuy1Get1: payload.isBuy1Get1,\n\t\t\t\t\tvalue: payload.value,\n\t\t\t\t\tvalueType: payload.valueType,\n\t\t\t\t});\n\n\t\t\t\tif (productIds.length) {\n\t\t\t\t\tawait synchronizeProductMarketingService.syncProductMarketingInfoByProductIds(productIds);\n\t\t\t\t}\n\n\t\t\t\tpublishSyncSingleShopSectionsInCacheProcessEvent({\n\t\t\t\t\tshopId,\n\t\t\t\t\toperation: ChangeStreamOperationTypes.UPDATE,\n\t\t\t\t});\n\n\t\t\t\tlogger.debug(`page ${page} seeded — ${productIds.length} products updated`, {\n\t\t\t\t\ttag: 'marketing.seed.entire-menu',\n\t\t\t\t\tdata: { marketingId: mid, shopId: sid, page, count: productIds.length },\n\t\t\t\t});\n\n\t\t\t\treturn;\n\t\t\t} catch (error) {\n\t\t\t\tlastError = error;\n\t\t\t\tif (attempt < MAX_ATTEMPTS) {\n\t\t\t\t\tawait new Promise(resolve => setTimeout(resolve, 2000 * attempt));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlogger.error(`page ${page} seed failed after ${MAX_ATTEMPTS} attempts — manual reseed required`, lastError, {\n\t\t\ttag: 'marketing.seed.entire-menu',\n\t\t\tdata: { marketingId: mid, shopId: sid, page, pageSize },\n\t\t});\n\t});\n}\n\nexport async function subscribeToMarketingReturnPunchCouponEvent() {\n\tawait subscribeToEvent(PublishEventEnums.MARKETING_RETURN_PUNCH_COUPON_EVENT, async payload => {\n\t\tpunchMarketingHistoryService.returnPunchCoupon(payload.orderId);\n\t});\n}\n"]}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -6211,6 +6211,7 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
|
|
|
6211
6211
|
data?: {
|
|
6212
6212
|
activeCoupons?: number | undefined;
|
|
6213
6213
|
totalCreated?: number | undefined;
|
|
6214
|
+
totalRedeemedCoupons?: number | undefined;
|
|
6214
6215
|
redemptionRate?: number | undefined;
|
|
6215
6216
|
totalCouponOrders?: number | undefined;
|
|
6216
6217
|
totalRevenue?: number | undefined;
|
|
@@ -6219,6 +6220,7 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
|
|
|
6219
6220
|
documents: {
|
|
6220
6221
|
activeCoupons?: number | undefined;
|
|
6221
6222
|
totalCreated?: number | undefined;
|
|
6223
|
+
totalRedeemedCoupons?: number | undefined;
|
|
6222
6224
|
redemptionRate?: number | undefined;
|
|
6223
6225
|
totalCouponOrders?: number | undefined;
|
|
6224
6226
|
totalRevenue?: number | undefined;
|
|
@@ -7636,6 +7638,60 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
|
|
|
7636
7638
|
};
|
|
7637
7639
|
meta: object;
|
|
7638
7640
|
}>;
|
|
7641
|
+
update: import("@trpc/server").TRPCMutationProcedure<{
|
|
7642
|
+
input: {
|
|
7643
|
+
isEntireMenu: boolean;
|
|
7644
|
+
discountPercentage: number;
|
|
7645
|
+
maxDiscountCap: number;
|
|
7646
|
+
isOrderCapacityEnabled: boolean;
|
|
7647
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
7648
|
+
maxOrderCapacity?: number | undefined;
|
|
7649
|
+
};
|
|
7650
|
+
output: {
|
|
7651
|
+
message: string;
|
|
7652
|
+
success: boolean;
|
|
7653
|
+
data?: {
|
|
7654
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
7655
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
7656
|
+
joinedAt: Date;
|
|
7657
|
+
isEntireMenu: boolean;
|
|
7658
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
7659
|
+
isOrderCapacityEnabled: boolean;
|
|
7660
|
+
isWithdrawn: boolean;
|
|
7661
|
+
createdAt?: Date | null | undefined;
|
|
7662
|
+
updatedAt?: Date | null | undefined;
|
|
7663
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
7664
|
+
discountPercentage?: number | undefined;
|
|
7665
|
+
maxDiscountCap?: number | undefined;
|
|
7666
|
+
maxOrderCapacity?: number | undefined;
|
|
7667
|
+
withdrawnAt?: Date | null | undefined;
|
|
7668
|
+
} | {
|
|
7669
|
+
documents: {
|
|
7670
|
+
_id: string | import("mongoose").Types.ObjectId;
|
|
7671
|
+
shop: string | import("mongoose").Types.ObjectId;
|
|
7672
|
+
joinedAt: Date;
|
|
7673
|
+
isEntireMenu: boolean;
|
|
7674
|
+
campaign: string | import("mongoose").Types.ObjectId;
|
|
7675
|
+
isOrderCapacityEnabled: boolean;
|
|
7676
|
+
isWithdrawn: boolean;
|
|
7677
|
+
createdAt?: Date | null | undefined;
|
|
7678
|
+
updatedAt?: Date | null | undefined;
|
|
7679
|
+
products?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
7680
|
+
discountPercentage?: number | undefined;
|
|
7681
|
+
maxDiscountCap?: number | undefined;
|
|
7682
|
+
maxOrderCapacity?: number | undefined;
|
|
7683
|
+
withdrawnAt?: Date | null | undefined;
|
|
7684
|
+
}[];
|
|
7685
|
+
metadata?: {
|
|
7686
|
+
page: number;
|
|
7687
|
+
size: number;
|
|
7688
|
+
totalElements: number;
|
|
7689
|
+
totalPages: number;
|
|
7690
|
+
} | undefined;
|
|
7691
|
+
} | undefined;
|
|
7692
|
+
};
|
|
7693
|
+
meta: object;
|
|
7694
|
+
}>;
|
|
7639
7695
|
withdraw: import("@trpc/server").TRPCMutationProcedure<{
|
|
7640
7696
|
input: void;
|
|
7641
7697
|
output: {
|
|
@@ -7664,6 +7720,8 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
|
|
|
7664
7720
|
joinedAt: Date;
|
|
7665
7721
|
isEntireMenu: boolean;
|
|
7666
7722
|
isOrderCapacityEnabled: boolean;
|
|
7723
|
+
productIds?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
7724
|
+
marketingId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
7667
7725
|
discountPercentage?: number | undefined;
|
|
7668
7726
|
maxDiscountCap?: number | undefined;
|
|
7669
7727
|
maxOrderCapacity?: number | undefined;
|
|
@@ -7684,6 +7742,8 @@ declare const marketingMicroServiceRouter: import("@trpc/server").TRPCBuiltRoute
|
|
|
7684
7742
|
joinedAt: Date;
|
|
7685
7743
|
isEntireMenu: boolean;
|
|
7686
7744
|
isOrderCapacityEnabled: boolean;
|
|
7745
|
+
productIds?: (string | import("mongoose").Types.ObjectId)[] | undefined;
|
|
7746
|
+
marketingId?: string | import("mongoose").Types.ObjectId | undefined;
|
|
7687
7747
|
discountPercentage?: number | undefined;
|
|
7688
7748
|
maxDiscountCap?: number | undefined;
|
|
7689
7749
|
maxOrderCapacity?: number | undefined;
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
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/server").TRPCBuiltRouter<{
|
|
|
5409
5409
|
data?: {
|
|
5410
5410
|
activeCoupons?: number | undefined;
|
|
5411
5411
|
totalCreated?: number | undefined;
|
|
5412
|
+
totalRedeemedCoupons?: number | undefined;
|
|
5412
5413
|
redemptionRate?: number | undefined;
|
|
5413
5414
|
totalCouponOrders?: number | undefined;
|
|
5414
5415
|
totalRevenue?: number | undefined;
|
|
@@ -5417,6 +5418,7 @@ export declare const couponRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
5417
5418
|
documents: {
|
|
5418
5419
|
activeCoupons?: number | undefined;
|
|
5419
5420
|
totalCreated?: number | undefined;
|
|
5421
|
+
totalRedeemedCoupons?: number | undefined;
|
|
5420
5422
|
redemptionRate?: number | undefined;
|
|
5421
5423
|
totalCouponOrders?: number | undefined;
|
|
5422
5424
|
totalRevenue?: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupon.router.d.ts","sourceRoot":"/","sources":["modules/coupon/routers/coupon.router.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiRgmuB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAD1nuB,CAAC"}
|
package/dist/lib/modules/coupon/services/patterns/repository/CouponMetricsRepository.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CouponMetricsRepository.d.ts","sourceRoot":"/","sources":["modules/coupon/services/patterns/repository/CouponMetricsRepository.ts"],"names":[],"mappings":"AAGA,OAAO,EAGN,QAAQ,EACR,SAAS,EACT,kBAAkB,EAElB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEN,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,MAAM,+CAA+C,CAAC;AAIvD,qBAAa,uBAAuB;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,OAAO,CAAC,UAAU,CAAoB;;IAOtC,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,qCAAqC;IAa7C,OAAO,CAAC,mBAAmB;YAWb,qBAAqB;YASrB,sBAAsB;YAQtB,qBAAqB;IA+DtB,sBAAsB,CAAC,QAAQ,EAAE,YAAY;IA4I1D,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,eAAe;IAwBvB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,uBAAuB;IAQlB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CouponMetricsRepository.d.ts","sourceRoot":"/","sources":["modules/coupon/services/patterns/repository/CouponMetricsRepository.ts"],"names":[],"mappings":"AAGA,OAAO,EAGN,QAAQ,EACR,SAAS,EACT,kBAAkB,EAElB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAEN,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,MAAM,+CAA+C,CAAC;AAIvD,qBAAa,uBAAuB;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,OAAO,CAAC,UAAU,CAAoB;;IAOtC,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,qCAAqC;IAa7C,OAAO,CAAC,mBAAmB;YAWb,qBAAqB;YASrB,sBAAsB;YAQtB,qBAAqB;IA+DtB,sBAAsB,CAAC,QAAQ,EAAE,YAAY;IA4I1D,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,eAAe;IAwBvB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,uBAAuB;IAQlB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAgC/E,uBAAuB,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,QAAQ;;;;;;;;;IAgBrE,wBAAwB,CAAC,IAAI,EAAE,aAAa;IAiE5C,+BAA+B,CAAC,IAAI,EAAE,aAAa;IA2HnD,wBAAwB,CAAC,IAAI,EAAE,aAAa;CAwDzD"}
|
|
@@ -276,6 +276,7 @@ class CouponMetricsRepository {
|
|
|
276
276
|
return {
|
|
277
277
|
activeCoupons,
|
|
278
278
|
totalCreated: createdCouponIds.length,
|
|
279
|
+
totalRedeemedCoupons: usageMetrics.totalCouponOrders,
|
|
279
280
|
redemptionRate,
|
|
280
281
|
totalCouponOrders: usageMetrics.totalCouponOrders,
|
|
281
282
|
totalRevenue: (0, shared_1.roundBaseCurrency)(usageMetrics.totalRevenue),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CouponMetricsRepository.js","sourceRoot":"/","sources":["modules/coupon/services/patterns/repository/CouponMetricsRepository.ts"],"names":[],"mappings":";;;AAAA,sEAA4F;AAE5F,8DAA2D;AAC3D,4DAO2C;AAC3C,gEAAwE;AACxE,4DAAiE;AAQjE,0CAAoD;AAEpD,MAAa,uBAAuB;IAClB,KAAK,CAAqB;IACnC,UAAU,CAAoB;IAEtC;QACC,IAAI,CAAC,KAAK,GAAG,oBAAiC,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,mBAA+B,CAAC;IACnD,CAAC;IAEO,mBAAmB;QAC1B,OAAO;YACN,cAAc,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;YAClC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,iBAAU,CAAC,aAAa,EAAE,iBAAU,CAAC,eAAe,CAAC,EAAE;YAC5E,SAAS,EAAE,IAAI;SACf,CAAC;IACH,CAAC;IAEO,qCAAqC,CAC5C,SAAe,EACf,OAAa;QAEb,OAAO;YACN,GAAG,IAAI,CAAC,mBAAmB,EAAE;YAC7B,SAAS,EAAE;gBACV,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,OAAO;aACb;SACD,CAAC;IACH,CAAC;IAEO,mBAAmB,CAAC,SAAe,EAAE,OAAa;QACzD,OAAO;YACN,QAAQ,EAAE;gBACT,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,OAAO;aACb;YACD,MAAM,EAAE,yBAAkB,CAAC,SAAS;YACpC,+BAA+B,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE;SAC9C,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,qBAAqB,C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/dist/libraries/mongo/models';\nimport { Duration } from '@lyxa.ai/core/dist/libraries/mongo/models/shared/duration.model';\nimport { dayjs } from '@lyxa.ai/core/dist/utilities/dayjs';\nimport {\n\tCouponType,\n\tGraphType,\n\tItemType,\n\tOrderType,\n\tRegularOrderStatus,\n\tStatus,\n} from '@lyxa.ai/core/dist/utilities/enum';\nimport { roundBaseCurrency } from '@lyxa.ai/core/dist/utilities/shared';\nimport { LyxaTimezone } from '@lyxa.ai/core/dist/utilities/time';\nimport {\n\tCouponMetricsByTypeDTO,\n\tCouponMetricsOutputDTO,\n\tDateInputDTO,\n\tGraphInputDTO,\n} from '@modules/coupon/validations/coupon.validation';\nimport { mongoose } from '@typegoose/typegoose';\nimport { fillMissingPeriods } from '@utility/utils';\n\nexport class CouponMetricsRepository {\n\tprivate readonly model: typeof CouponModel;\n\tprivate orderModel: typeof OrderModel;\n\n\tconstructor() {\n\t\tthis.model = CouponModel as typeof CouponModel;\n\t\tthis.orderModel = OrderModel as typeof OrderModel;\n\t}\n\n\tprivate getBaseCouponFilter(): mongoose.FilterQuery<Coupon> {\n\t\treturn {\n\t\t\tupdatedVersion: { $exists: false },\n\t\t\tcouponType: { $nin: [CouponType.REFERRAL_CODE, CouponType.REFERRAL_REWARD] },\n\t\t\tdeletedAt: null,\n\t\t};\n\t}\n\n\tprivate getCouponCreatedWithinDateRangeFilter(\n\t\tstartDate: Date,\n\t\tendDate: Date\n\t): mongoose.FilterQuery<Coupon> {\n\t\treturn {\n\t\t\t...this.getBaseCouponFilter(),\n\t\t\tcreatedAt: {\n\t\t\t\t$gte: startDate,\n\t\t\t\t$lte: endDate,\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate getCouponOrderMatch(startDate: Date, endDate: Date): mongoose.PipelineStage.Match['$match'] {\n\t\treturn {\n\t\t\tplacedAt: {\n\t\t\t\t$gte: startDate,\n\t\t\t\t$lte: endDate,\n\t\t\t},\n\t\t\tstatus: RegularOrderStatus.DELIVERED,\n\t\t\t'adjustedFinance.coupon.coupon': { $ne: null },\n\t\t};\n\t}\n\n\tprivate async getActiveCouponsCount(now: Date) {\n\t\treturn this.model.countDocuments({\n\t\t\t...this.getBaseCouponFilter(),\n\t\t\tstatus: Status.ACTIVE,\n\t\t\t'duration.start': { $lte: now },\n\t\t\t'duration.end': { $gte: now },\n\t\t});\n\t}\n\n\tprivate async getTotalCreatedCoupons(startDate: Date, endDate: Date) {\n\t\treturn this.model\n\t\t\t.find({\n\t\t\t\t...this.getCouponCreatedWithinDateRangeFilter(startDate, endDate),\n\t\t\t})\n\t\t\t.select('_id');\n\t}\n\n\tprivate async getCouponUsageMetrics(\n\t\tstartDate: Date,\n\t\tendDate: Date,\n\t\tcoupons: mongoose.Types.ObjectId[] = []\n\t) {\n\t\tconst match = {\n\t\t\t...this.getCouponOrderMatch(startDate, endDate),\n\t\t\t'adjustedFinance.coupon.coupon': { $in: coupons },\n\t\t};\n\n\t\tconst [result] = await this.orderModel.aggregate<{\n\t\t\ttotalCouponOrders: number;\n\t\t\ttotalRevenue: number;\n\t\t\ttotalProfit: number;\n\t\t\tredeemedCoupons: number;\n\t\t}>([\n\t\t\t{\n\t\t\t\t$match: match,\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: null,\n\n\t\t\t\t\ttotalCouponOrders: { $sum: 1 },\n\n\t\t\t\t\ttotalRevenue: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.pricing.total',\n\t\t\t\t\t},\n\n\t\t\t\t\ttotalProfit: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.companyProfit.totalProfit',\n\t\t\t\t\t},\n\n\t\t\t\t\tuniqueCoupons: {\n\t\t\t\t\t\t$addToSet: '$adjustedFinance.coupon.coupon',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\ttotalCouponOrders: 1,\n\t\t\t\t\ttotalRevenue: 1,\n\t\t\t\t\ttotalProfit: 1,\n\t\t\t\t\tredeemedCoupons: {\n\t\t\t\t\t\t$size: '$uniqueCoupons',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\n\t\treturn (\n\t\t\tresult ?? {\n\t\t\t\ttotalCouponOrders: 0,\n\t\t\t\ttotalRevenue: 0,\n\t\t\t\ttotalProfit: 0,\n\t\t\t\tredeemedCoupons: 0,\n\t\t\t}\n\t\t);\n\t}\n\n\tpublic async getCouponMetricsByType(duration: DateInputDTO) {\n\t\tconst startDate = dayjs(duration.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(duration.endDate).endOf('day').toDate();\n\n\t\tconst [totalOrders, activeCouponsCount] = await Promise.all([\n\t\t\tthis.orderModel.countDocuments({\n\t\t\t\tplacedAt: {\n\t\t\t\t\t$gte: startDate,\n\t\t\t\t\t$lte: endDate,\n\t\t\t\t},\n\t\t\t\tstatus: RegularOrderStatus.DELIVERED,\n\t\t\t}),\n\t\t\tthis.model.aggregate([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\t...this.getBaseCouponFilter(),\n\t\t\t\t\t\tstatus: Status.ACTIVE,\n\t\t\t\t\t\t'duration.start': { $lte: dayjs().toDate() },\n\t\t\t\t\t\t'duration.end': { $gte: dayjs().toDate() },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: '$couponType',\n\t\t\t\t\t\tcount: { $sum: 1 },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]),\n\t\t]);\n\n\t\tconst activeCouponsMap = activeCouponsCount.reduce(\n\t\t\t(acc, curr) => {\n\t\t\t\tacc[curr._id] = curr.count;\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{} as Record<string, number>\n\t\t);\n\n\t\tconst result = await this.orderModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t...this.getCouponOrderMatch(startDate, endDate),\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$lookup: {\n\t\t\t\t\tfrom: 'coupons',\n\t\t\t\t\tlocalField: 'adjustedFinance.coupon.coupon',\n\t\t\t\t\tforeignField: '_id',\n\t\t\t\t\tas: 'couponDetails',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$unwind: '$couponDetails',\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t'couponDetails.couponType': { $nin: [CouponType.REFERRAL_CODE, CouponType.REFERRAL_REWARD] },\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$couponDetails.couponType',\n\n\t\t\t\t\tcouponType: { $first: '$couponDetails.couponType' },\n\n\t\t\t\t\ttotalCouponOrders: { $sum: 1 },\n\n\t\t\t\t\ttotalRevenue: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.pricing.total',\n\t\t\t\t\t},\n\n\t\t\t\t\ttotalProfit: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.companyProfit.totalProfit',\n\t\t\t\t\t},\n\n\t\t\t\t\tamountSpent: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.pricing.couponDiscount',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\taverageOrderValue: {\n\t\t\t\t\t\t$cond: [\n\t\t\t\t\t\t\t{ $eq: ['$totalCouponOrders', 0] },\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$round: [{ $divide: ['$totalRevenue', '$totalCouponOrders'] }, 2],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\n\t\t\t\t\tusage: {\n\t\t\t\t\t\t$cond: [\n\t\t\t\t\t\t\t{ $eq: [totalOrders, 0] },\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$multiply: [\n\t\t\t\t\t\t\t\t\t100,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$round: [{ $divide: ['$totalCouponOrders', totalOrders] }, 2],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\tcouponType: 1,\n\t\t\t\t\ttotalCouponOrders: 1,\n\t\t\t\t\ttotalRevenue: { $round: ['$totalRevenue', 2] },\n\t\t\t\t\ttotalProfit: { $round: ['$totalProfit', 2] },\n\t\t\t\t\taverageOrderValue: 1,\n\t\t\t\t\tusage: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\n\t\tthis.fillMissingRows(result);\n\n\t\tconst tableData = result.map(item => ({\n\t\t\t...item,\n\t\t\tcouponTypeTitle: this.getCouponTypeTitle(item.couponType),\n\t\t\tongoing: activeCouponsMap[item.couponType] ?? 0,\n\t\t\tredemptionRate: 0, // calculate after business discussion on how to define redemption rate by coupon type\n\t\t}));\n\n\t\treturn tableData;\n\t}\n\n\tprivate getCouponTypeTitle(couponType: CouponType) {\n\t\tconst couponTypeTitles: Record<CouponType, string> = {\n\t\t\t[CouponType.GLOBAL]: 'Global',\n\t\t\t[CouponType.SHOPS_CATEGORIES]: 'Shop/Category',\n\t\t\t[CouponType.INDIVIDUAL_STORE]: 'Single Shop',\n\t\t\t[CouponType.INDIVIDUAL_USER]: 'Individual User',\n\t\t\t[CouponType.CUSTOM_COUPON]: 'Customized Coupon',\n\t\t\t[CouponType.REFERRAL_CODE]: 'Referral Code',\n\t\t\t[CouponType.REFERRAL_REWARD]: 'Referral Reward',\n\t\t};\n\t\treturn couponTypeTitles[couponType] || 'Unknown';\n\t}\n\n\tprivate fillMissingRows(data: CouponMetricsByTypeDTO[]) {\n\t\tconst missingTypes = Object.values(CouponType).filter(\n\t\t\ttype =>\n\t\t\t\t![CouponType.REFERRAL_CODE, CouponType.REFERRAL_REWARD].includes(type) &&\n\t\t\t\t!data.some(row => row.couponType === type)\n\t\t);\n\n\t\tmissingTypes.forEach(type => {\n\t\t\tdata.push({\n\t\t\t\tcouponType: type,\n\t\t\t\tcouponTypeTitle: this.getCouponTypeTitle(type),\n\t\t\t\ttotalCouponOrders: 0,\n\t\t\t\ttotalRevenue: 0,\n\t\t\t\ttotalProfit: 0,\n\t\t\t\taverageOrderValue: 0,\n\t\t\t\tusage: 0,\n\t\t\t\tongoing: 0,\n\t\t\t\tredemptionRate: 0,\n\t\t\t});\n\t\t});\n\n\t\tdata.sort((a, b) => this.compareCouponTypes(a.couponType, b.couponType));\n\t}\n\n\tprivate compareCouponTypes(a: CouponType, b: CouponType) {\n\t\tconst order = [\n\t\t\tCouponType.GLOBAL,\n\t\t\tCouponType.SHOPS_CATEGORIES,\n\t\t\tCouponType.INDIVIDUAL_STORE,\n\t\t\tCouponType.INDIVIDUAL_USER,\n\t\t\tCouponType.CUSTOM_COUPON,\n\t\t];\n\t\treturn order.indexOf(a) - order.indexOf(b);\n\t}\n\n\tprivate calculateRedemptionRate(totalCreated: number, redeemedCoupons: number) {\n\t\tif (totalCreated <= 0) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn Number(((redeemedCoupons / totalCreated) * 100).toFixed(2));\n\t}\n\n\tpublic async getCouponMetrics(duration: DateInputDTO): Promise<CouponMetricsOutputDTO> {\n\t\tconst startDate = dayjs(duration.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(duration.endDate).endOf('day').toDate();\n\t\tconst now = new Date();\n\n\t\tconst [activeCoupons, createdCoupons] = await Promise.all([\n\t\t\tthis.getActiveCouponsCount(now),\n\t\t\tthis.getTotalCreatedCoupons(startDate, endDate),\n\t\t]);\n\n\t\tconst createdCouponIds = createdCoupons.map(coupon => coupon._id);\n\n\t\tconst usageMetrics = await this.getCouponUsageMetrics(startDate, endDate, createdCouponIds);\n\n\t\tconst redemptionRate = this.calculateRedemptionRate(\n\t\t\tcreatedCouponIds.length,\n\t\t\tusageMetrics.redeemedCoupons\n\t\t);\n\n\t\treturn {\n\t\t\tactiveCoupons,\n\n\t\t\ttotalCreated: createdCouponIds.length,\n\t\t\tredemptionRate,\n\n\t\t\ttotalCouponOrders: usageMetrics.totalCouponOrders,\n\t\t\ttotalRevenue: roundBaseCurrency(usageMetrics.totalRevenue),\n\t\t\ttotalProfit: roundBaseCurrency(usageMetrics.totalProfit),\n\t\t};\n\t}\n\n\tpublic getOrderGraphMatchStage(startDate: Date, endDate: Date, itemType?: ItemType) {\n\t\treturn {\n\t\t\tplacedAt: {\n\t\t\t\t$gte: startDate,\n\t\t\t\t$lte: endDate,\n\t\t\t},\n\t\t\torderType: OrderType.REGULAR,\n\t\t\tstatus: RegularOrderStatus.DELIVERED,\n\t\t\t...(itemType\n\t\t\t\t? {\n\t\t\t\t\t\titemType,\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t};\n\t}\n\n\tpublic async getCouponOrdersGraphData(data: GraphInputDTO) {\n\t\tconst startDate = dayjs(data.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(data.endDate).endOf('day').toDate();\n\n\t\tconst dateFormat = data.graphType === GraphType.MONTHLY ? '%Y-%m' : '%Y-%m-%d';\n\n\t\tconst result = await this.orderModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t...this.getOrderGraphMatchStage(startDate, endDate, data.itemType),\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\thasCoupon: {\n\t\t\t\t\t\t$cond: [{ $ifNull: ['$adjustedFinance.coupon.coupon', false] }, 1, 0],\n\t\t\t\t\t},\n\t\t\t\t\tdate: {\n\t\t\t\t\t\t$dateToString: {\n\t\t\t\t\t\t\tformat: dateFormat,\n\t\t\t\t\t\t\tdate: '$placedAt',\n\t\t\t\t\t\t\ttimezone: LyxaTimezone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$date',\n\n\t\t\t\t\ttotalOrders: { $sum: 1 },\n\n\t\t\t\t\tordersWithCoupon: {\n\t\t\t\t\t\t$sum: '$hasCoupon',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\tdate: '$_id',\n\t\t\t\t\ttotalOrders: 1,\n\t\t\t\t\tordersWithCoupon: 1,\n\t\t\t\t\tordersWithoutCoupon: { $subtract: ['$totalOrders', '$ordersWithCoupon'] },\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$sort: { date: 1 },\n\t\t\t},\n\t\t]);\n\n\t\t// Fill in missing dates with zero for graph continuity\n\t\tconst graphData = fillMissingPeriods(result, data.startDate, data.endDate, data.graphType, {\n\t\t\ttotalOrders: 0,\n\t\t\tordersWithCoupon: 0,\n\t\t\tordersWithoutCoupon: 0,\n\t\t});\n\n\t\treturn graphData;\n\t}\n\n\tpublic async getUsersNewVsReturningGraphData(data: GraphInputDTO) {\n\t\tconst startDate = dayjs(data.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(data.endDate).endOf('day').toDate();\n\n\t\tconst dateFormat = data.graphType === GraphType.MONTHLY ? '%Y-%m' : '%Y-%m-%d';\n\n\t\tconst result = await this.orderModel.aggregate([\n\t\t\t// Orders in selected period\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t...this.getOrderGraphMatchStage(startDate, endDate, data.itemType),\n\t\t\t\t\t'adjustedFinance.coupon.coupon': { $ne: null },\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Build graph bucket\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\tdate: {\n\t\t\t\t\t\t$dateToString: {\n\t\t\t\t\t\t\tformat: dateFormat,\n\t\t\t\t\t\t\tdate: '$placedAt',\n\t\t\t\t\t\t\ttimezone: LyxaTimezone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Unique user per period bucket\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: {\n\t\t\t\t\t\tuser: '$user',\n\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Lookup prior order (existence check)\n\t\t\t{\n\t\t\t\t$lookup: {\n\t\t\t\t\tfrom: 'orders',\n\t\t\t\t\tlet: { userId: '$_id.user' },\n\t\t\t\t\tpipeline: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$expr: {\n\t\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t\t{ $eq: ['$user', '$$userId'] },\n\t\t\t\t\t\t\t\t\t\t{ $eq: ['$status', RegularOrderStatus.DELIVERED] },\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t$expr: {\n\t\t\t\t\t\t\t\t\t\t\t\t$lt: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$ifNull: ['$placedAt', '$createdAt'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tstartDate,\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ $limit: 1 },\n\t\t\t\t\t],\n\t\t\t\t\tas: 'previousOrders',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Classify\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\tisReturning: {\n\t\t\t\t\t\t$gt: [{ $size: '$previousOrders' }, 0],\n\t\t\t\t\t},\n\t\t\t\t\tdate: '$_id.date',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Aggregate graph metrics\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$date',\n\n\t\t\t\t\ttotalUsers: { $sum: 1 },\n\n\t\t\t\t\treturningUsers: {\n\t\t\t\t\t\t$sum: {\n\t\t\t\t\t\t\t$cond: ['$isReturning', 1, 0],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\n\t\t\t\t\tnewUsers: {\n\t\t\t\t\t\t$sum: {\n\t\t\t\t\t\t\t$cond: ['$isReturning', 0, 1],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\tdate: '$_id',\n\t\t\t\t\ttotalUsers: 1,\n\t\t\t\t\tnewUsers: 1,\n\t\t\t\t\treturningUsers: 1,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{ $sort: { date: 1 } },\n\t\t]);\n\n\t\tconst graphData = fillMissingPeriods(result, data.startDate, data.endDate, data.graphType, {\n\t\t\ttotalUsers: 0,\n\t\t\tnewUsers: 0,\n\t\t\treturningUsers: 0,\n\t\t});\n\n\t\treturn graphData;\n\t}\n\n\tpublic async getCouponProfitGraphData(data: GraphInputDTO) {\n\t\tconst startDate = dayjs(data.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(data.endDate).endOf('day').toDate();\n\n\t\tconst dateFormat = data.graphType === GraphType.MONTHLY ? '%Y-%m' : '%Y-%m-%d';\n\n\t\tconst result = await this.orderModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t...this.getOrderGraphMatchStage(startDate, endDate, data.itemType),\n\t\t\t\t\t'adjustedFinance.coupon.coupon': { $ne: null },\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\tdate: {\n\t\t\t\t\t\t$dateToString: {\n\t\t\t\t\t\t\tformat: dateFormat,\n\t\t\t\t\t\t\tdate: '$placedAt',\n\t\t\t\t\t\t\ttimezone: LyxaTimezone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$date',\n\n\t\t\t\t\ttotalProfit: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.companyProfit.totalProfit',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\tdate: '$_id',\n\t\t\t\t\ttotalProfit: 1,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$sort: { date: 1 },\n\t\t\t},\n\t\t]);\n\n\t\t// Fill in missing dates with zero for graph continuity\n\t\tconst graphData = fillMissingPeriods(result, data.startDate, data.endDate, data.graphType, {\n\t\t\ttotalProfit: 0,\n\t\t});\n\n\t\treturn graphData;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CouponMetricsRepository.js","sourceRoot":"/","sources":["modules/coupon/services/patterns/repository/CouponMetricsRepository.ts"],"names":[],"mappings":";;;AAAA,sEAA4F;AAE5F,8DAA2D;AAC3D,4DAO2C;AAC3C,gEAAwE;AACxE,4DAAiE;AAQjE,0CAAoD;AAEpD,MAAa,uBAAuB;IAClB,KAAK,CAAqB;IACnC,UAAU,CAAoB;IAEtC;QACC,IAAI,CAAC,KAAK,GAAG,oBAAiC,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,mBAA+B,CAAC;IACnD,CAAC;IAEO,mBAAmB;QAC1B,OAAO;YACN,cAAc,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;YAClC,UAAU,EAAE,EAAE,IA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AAY;yBACtB;qBACD;iBACD;aACD;YAED;gBACC,MAAM,EAAE;oBACP,GAAG,EAAE,OAAO;oBAEZ,WAAW,EAAE;wBACZ,IAAI,EAAE,4CAA4C;qBAClD;iBACD;aACD;YAED;gBACC,QAAQ,EAAE;oBACT,GAAG,EAAE,CAAC;oBACN,IAAI,EAAE,MAAM;oBACZ,WAAW,EAAE,CAAC;iBACd;aACD;YAED;gBACC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;aAClB;SACD,CAAC,CAAC;QAGH,MAAM,SAAS,GAAG,IAAA,0BAAkB,EAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE;YAC1F,WAAW,EAAE,CAAC;SACd,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AAjmBD,0DAimBC","sourcesContent":["import { Coupon, CouponModel, OrderModel } from '@lyxa.ai/core/dist/libraries/mongo/models';\nimport { Duration } from '@lyxa.ai/core/dist/libraries/mongo/models/shared/duration.model';\nimport { dayjs } from '@lyxa.ai/core/dist/utilities/dayjs';\nimport {\n\tCouponType,\n\tGraphType,\n\tItemType,\n\tOrderType,\n\tRegularOrderStatus,\n\tStatus,\n} from '@lyxa.ai/core/dist/utilities/enum';\nimport { roundBaseCurrency } from '@lyxa.ai/core/dist/utilities/shared';\nimport { LyxaTimezone } from '@lyxa.ai/core/dist/utilities/time';\nimport {\n\tCouponMetricsByTypeDTO,\n\tCouponMetricsOutputDTO,\n\tDateInputDTO,\n\tGraphInputDTO,\n} from '@modules/coupon/validations/coupon.validation';\nimport { mongoose } from '@typegoose/typegoose';\nimport { fillMissingPeriods } from '@utility/utils';\n\nexport class CouponMetricsRepository {\n\tprivate readonly model: typeof CouponModel;\n\tprivate orderModel: typeof OrderModel;\n\n\tconstructor() {\n\t\tthis.model = CouponModel as typeof CouponModel;\n\t\tthis.orderModel = OrderModel as typeof OrderModel;\n\t}\n\n\tprivate getBaseCouponFilter(): mongoose.FilterQuery<Coupon> {\n\t\treturn {\n\t\t\tupdatedVersion: { $exists: false },\n\t\t\tcouponType: { $nin: [CouponType.REFERRAL_CODE, CouponType.REFERRAL_REWARD] },\n\t\t\tdeletedAt: null,\n\t\t};\n\t}\n\n\tprivate getCouponCreatedWithinDateRangeFilter(\n\t\tstartDate: Date,\n\t\tendDate: Date\n\t): mongoose.FilterQuery<Coupon> {\n\t\treturn {\n\t\t\t...this.getBaseCouponFilter(),\n\t\t\tcreatedAt: {\n\t\t\t\t$gte: startDate,\n\t\t\t\t$lte: endDate,\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate getCouponOrderMatch(startDate: Date, endDate: Date): mongoose.PipelineStage.Match['$match'] {\n\t\treturn {\n\t\t\tplacedAt: {\n\t\t\t\t$gte: startDate,\n\t\t\t\t$lte: endDate,\n\t\t\t},\n\t\t\tstatus: RegularOrderStatus.DELIVERED,\n\t\t\t'adjustedFinance.coupon.coupon': { $ne: null },\n\t\t};\n\t}\n\n\tprivate async getActiveCouponsCount(now: Date) {\n\t\treturn this.model.countDocuments({\n\t\t\t...this.getBaseCouponFilter(),\n\t\t\tstatus: Status.ACTIVE,\n\t\t\t'duration.start': { $lte: now },\n\t\t\t'duration.end': { $gte: now },\n\t\t});\n\t}\n\n\tprivate async getTotalCreatedCoupons(startDate: Date, endDate: Date) {\n\t\treturn this.model\n\t\t\t.find({\n\t\t\t\t...this.getCouponCreatedWithinDateRangeFilter(startDate, endDate),\n\t\t\t})\n\t\t\t.select('_id');\n\t}\n\n\tprivate async getCouponUsageMetrics(\n\t\tstartDate: Date,\n\t\tendDate: Date,\n\t\tcoupons: mongoose.Types.ObjectId[] = []\n\t) {\n\t\tconst match = {\n\t\t\t...this.getCouponOrderMatch(startDate, endDate),\n\t\t\t'adjustedFinance.coupon.coupon': { $in: coupons },\n\t\t};\n\n\t\tconst [result] = await this.orderModel.aggregate<{\n\t\t\ttotalCouponOrders: number;\n\t\t\ttotalRevenue: number;\n\t\t\ttotalProfit: number;\n\t\t\tredeemedCoupons: number;\n\t\t}>([\n\t\t\t{\n\t\t\t\t$match: match,\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: null,\n\n\t\t\t\t\ttotalCouponOrders: { $sum: 1 },\n\n\t\t\t\t\ttotalRevenue: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.pricing.total',\n\t\t\t\t\t},\n\n\t\t\t\t\ttotalProfit: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.companyProfit.totalProfit',\n\t\t\t\t\t},\n\n\t\t\t\t\tuniqueCoupons: {\n\t\t\t\t\t\t$addToSet: '$adjustedFinance.coupon.coupon',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\ttotalCouponOrders: 1,\n\t\t\t\t\ttotalRevenue: 1,\n\t\t\t\t\ttotalProfit: 1,\n\t\t\t\t\tredeemedCoupons: {\n\t\t\t\t\t\t$size: '$uniqueCoupons',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\n\t\treturn (\n\t\t\tresult ?? {\n\t\t\t\ttotalCouponOrders: 0,\n\t\t\t\ttotalRevenue: 0,\n\t\t\t\ttotalProfit: 0,\n\t\t\t\tredeemedCoupons: 0,\n\t\t\t}\n\t\t);\n\t}\n\n\tpublic async getCouponMetricsByType(duration: DateInputDTO) {\n\t\tconst startDate = dayjs(duration.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(duration.endDate).endOf('day').toDate();\n\n\t\tconst [totalOrders, activeCouponsCount] = await Promise.all([\n\t\t\tthis.orderModel.countDocuments({\n\t\t\t\tplacedAt: {\n\t\t\t\t\t$gte: startDate,\n\t\t\t\t\t$lte: endDate,\n\t\t\t\t},\n\t\t\t\tstatus: RegularOrderStatus.DELIVERED,\n\t\t\t}),\n\t\t\tthis.model.aggregate([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\t...this.getBaseCouponFilter(),\n\t\t\t\t\t\tstatus: Status.ACTIVE,\n\t\t\t\t\t\t'duration.start': { $lte: dayjs().toDate() },\n\t\t\t\t\t\t'duration.end': { $gte: dayjs().toDate() },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: '$couponType',\n\t\t\t\t\t\tcount: { $sum: 1 },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]),\n\t\t]);\n\n\t\tconst activeCouponsMap = activeCouponsCount.reduce(\n\t\t\t(acc, curr) => {\n\t\t\t\tacc[curr._id] = curr.count;\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{} as Record<string, number>\n\t\t);\n\n\t\tconst result = await this.orderModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t...this.getCouponOrderMatch(startDate, endDate),\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$lookup: {\n\t\t\t\t\tfrom: 'coupons',\n\t\t\t\t\tlocalField: 'adjustedFinance.coupon.coupon',\n\t\t\t\t\tforeignField: '_id',\n\t\t\t\t\tas: 'couponDetails',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$unwind: '$couponDetails',\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t'couponDetails.couponType': { $nin: [CouponType.REFERRAL_CODE, CouponType.REFERRAL_REWARD] },\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$couponDetails.couponType',\n\n\t\t\t\t\tcouponType: { $first: '$couponDetails.couponType' },\n\n\t\t\t\t\ttotalCouponOrders: { $sum: 1 },\n\n\t\t\t\t\ttotalRevenue: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.pricing.total',\n\t\t\t\t\t},\n\n\t\t\t\t\ttotalProfit: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.companyProfit.totalProfit',\n\t\t\t\t\t},\n\n\t\t\t\t\tamountSpent: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.pricing.couponDiscount',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\taverageOrderValue: {\n\t\t\t\t\t\t$cond: [\n\t\t\t\t\t\t\t{ $eq: ['$totalCouponOrders', 0] },\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$round: [{ $divide: ['$totalRevenue', '$totalCouponOrders'] }, 2],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\n\t\t\t\t\tusage: {\n\t\t\t\t\t\t$cond: [\n\t\t\t\t\t\t\t{ $eq: [totalOrders, 0] },\n\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t$multiply: [\n\t\t\t\t\t\t\t\t\t100,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t$round: [{ $divide: ['$totalCouponOrders', totalOrders] }, 2],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\tcouponType: 1,\n\t\t\t\t\ttotalCouponOrders: 1,\n\t\t\t\t\ttotalRevenue: { $round: ['$totalRevenue', 2] },\n\t\t\t\t\ttotalProfit: { $round: ['$totalProfit', 2] },\n\t\t\t\t\taverageOrderValue: 1,\n\t\t\t\t\tusage: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\n\t\tthis.fillMissingRows(result);\n\n\t\tconst tableData = result.map(item => ({\n\t\t\t...item,\n\t\t\tcouponTypeTitle: this.getCouponTypeTitle(item.couponType),\n\t\t\tongoing: activeCouponsMap[item.couponType] ?? 0,\n\t\t\tredemptionRate: 0, // calculate after business discussion on how to define redemption rate by coupon type\n\t\t}));\n\n\t\treturn tableData;\n\t}\n\n\tprivate getCouponTypeTitle(couponType: CouponType) {\n\t\tconst couponTypeTitles: Record<CouponType, string> = {\n\t\t\t[CouponType.GLOBAL]: 'Global',\n\t\t\t[CouponType.SHOPS_CATEGORIES]: 'Shop/Category',\n\t\t\t[CouponType.INDIVIDUAL_STORE]: 'Single Shop',\n\t\t\t[CouponType.INDIVIDUAL_USER]: 'Individual User',\n\t\t\t[CouponType.CUSTOM_COUPON]: 'Customized Coupon',\n\t\t\t[CouponType.REFERRAL_CODE]: 'Referral Code',\n\t\t\t[CouponType.REFERRAL_REWARD]: 'Referral Reward',\n\t\t};\n\t\treturn couponTypeTitles[couponType] || 'Unknown';\n\t}\n\n\tprivate fillMissingRows(data: CouponMetricsByTypeDTO[]) {\n\t\tconst missingTypes = Object.values(CouponType).filter(\n\t\t\ttype =>\n\t\t\t\t![CouponType.REFERRAL_CODE, CouponType.REFERRAL_REWARD].includes(type) &&\n\t\t\t\t!data.some(row => row.couponType === type)\n\t\t);\n\n\t\tmissingTypes.forEach(type => {\n\t\t\tdata.push({\n\t\t\t\tcouponType: type,\n\t\t\t\tcouponTypeTitle: this.getCouponTypeTitle(type),\n\t\t\t\ttotalCouponOrders: 0,\n\t\t\t\ttotalRevenue: 0,\n\t\t\t\ttotalProfit: 0,\n\t\t\t\taverageOrderValue: 0,\n\t\t\t\tusage: 0,\n\t\t\t\tongoing: 0,\n\t\t\t\tredemptionRate: 0,\n\t\t\t});\n\t\t});\n\n\t\tdata.sort((a, b) => this.compareCouponTypes(a.couponType, b.couponType));\n\t}\n\n\tprivate compareCouponTypes(a: CouponType, b: CouponType) {\n\t\tconst order = [\n\t\t\tCouponType.GLOBAL,\n\t\t\tCouponType.SHOPS_CATEGORIES,\n\t\t\tCouponType.INDIVIDUAL_STORE,\n\t\t\tCouponType.INDIVIDUAL_USER,\n\t\t\tCouponType.CUSTOM_COUPON,\n\t\t];\n\t\treturn order.indexOf(a) - order.indexOf(b);\n\t}\n\n\tprivate calculateRedemptionRate(totalCreated: number, redeemedCoupons: number) {\n\t\tif (totalCreated <= 0) {\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn Number(((redeemedCoupons / totalCreated) * 100).toFixed(2));\n\t}\n\n\tpublic async getCouponMetrics(duration: DateInputDTO): Promise<CouponMetricsOutputDTO> {\n\t\tconst startDate = dayjs(duration.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(duration.endDate).endOf('day').toDate();\n\t\tconst now = new Date();\n\n\t\tconst [activeCoupons, createdCoupons] = await Promise.all([\n\t\t\tthis.getActiveCouponsCount(now),\n\t\t\tthis.getTotalCreatedCoupons(startDate, endDate),\n\t\t]);\n\n\t\tconst createdCouponIds = createdCoupons.map(coupon => coupon._id);\n\n\t\tconst usageMetrics = await this.getCouponUsageMetrics(startDate, endDate, createdCouponIds);\n\n\t\tconst redemptionRate = this.calculateRedemptionRate(\n\t\t\tcreatedCouponIds.length,\n\t\t\tusageMetrics.redeemedCoupons\n\t\t);\n\n\t\treturn {\n\t\t\tactiveCoupons,\n\n\t\t\ttotalCreated: createdCouponIds.length,\n\t\t\ttotalRedeemedCoupons: usageMetrics.totalCouponOrders,\n\t\t\tredemptionRate,\n\n\t\t\ttotalCouponOrders: usageMetrics.totalCouponOrders,\n\t\t\ttotalRevenue: roundBaseCurrency(usageMetrics.totalRevenue),\n\t\t\ttotalProfit: roundBaseCurrency(usageMetrics.totalProfit),\n\t\t};\n\t}\n\n\tpublic getOrderGraphMatchStage(startDate: Date, endDate: Date, itemType?: ItemType) {\n\t\treturn {\n\t\t\tplacedAt: {\n\t\t\t\t$gte: startDate,\n\t\t\t\t$lte: endDate,\n\t\t\t},\n\t\t\torderType: OrderType.REGULAR,\n\t\t\tstatus: RegularOrderStatus.DELIVERED,\n\t\t\t...(itemType\n\t\t\t\t? {\n\t\t\t\t\t\titemType,\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t};\n\t}\n\n\tpublic async getCouponOrdersGraphData(data: GraphInputDTO) {\n\t\tconst startDate = dayjs(data.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(data.endDate).endOf('day').toDate();\n\n\t\tconst dateFormat = data.graphType === GraphType.MONTHLY ? '%Y-%m' : '%Y-%m-%d';\n\n\t\tconst result = await this.orderModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t...this.getOrderGraphMatchStage(startDate, endDate, data.itemType),\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\thasCoupon: {\n\t\t\t\t\t\t$cond: [{ $ifNull: ['$adjustedFinance.coupon.coupon', false] }, 1, 0],\n\t\t\t\t\t},\n\t\t\t\t\tdate: {\n\t\t\t\t\t\t$dateToString: {\n\t\t\t\t\t\t\tformat: dateFormat,\n\t\t\t\t\t\t\tdate: '$placedAt',\n\t\t\t\t\t\t\ttimezone: LyxaTimezone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$date',\n\n\t\t\t\t\ttotalOrders: { $sum: 1 },\n\n\t\t\t\t\tordersWithCoupon: {\n\t\t\t\t\t\t$sum: '$hasCoupon',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\tdate: '$_id',\n\t\t\t\t\ttotalOrders: 1,\n\t\t\t\t\tordersWithCoupon: 1,\n\t\t\t\t\tordersWithoutCoupon: { $subtract: ['$totalOrders', '$ordersWithCoupon'] },\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$sort: { date: 1 },\n\t\t\t},\n\t\t]);\n\n\t\t// Fill in missing dates with zero for graph continuity\n\t\tconst graphData = fillMissingPeriods(result, data.startDate, data.endDate, data.graphType, {\n\t\t\ttotalOrders: 0,\n\t\t\tordersWithCoupon: 0,\n\t\t\tordersWithoutCoupon: 0,\n\t\t});\n\n\t\treturn graphData;\n\t}\n\n\tpublic async getUsersNewVsReturningGraphData(data: GraphInputDTO) {\n\t\tconst startDate = dayjs(data.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(data.endDate).endOf('day').toDate();\n\n\t\tconst dateFormat = data.graphType === GraphType.MONTHLY ? '%Y-%m' : '%Y-%m-%d';\n\n\t\tconst result = await this.orderModel.aggregate([\n\t\t\t// Orders in selected period\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t...this.getOrderGraphMatchStage(startDate, endDate, data.itemType),\n\t\t\t\t\t'adjustedFinance.coupon.coupon': { $ne: null },\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Build graph bucket\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\tdate: {\n\t\t\t\t\t\t$dateToString: {\n\t\t\t\t\t\t\tformat: dateFormat,\n\t\t\t\t\t\t\tdate: '$placedAt',\n\t\t\t\t\t\t\ttimezone: LyxaTimezone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Unique user per period bucket\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: {\n\t\t\t\t\t\tuser: '$user',\n\t\t\t\t\t\tdate: '$date',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Lookup prior order (existence check)\n\t\t\t{\n\t\t\t\t$lookup: {\n\t\t\t\t\tfrom: 'orders',\n\t\t\t\t\tlet: { userId: '$_id.user' },\n\t\t\t\t\tpipeline: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$match: {\n\t\t\t\t\t\t\t\t$expr: {\n\t\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t\t{ $eq: ['$user', '$$userId'] },\n\t\t\t\t\t\t\t\t\t\t{ $eq: ['$status', RegularOrderStatus.DELIVERED] },\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t$expr: {\n\t\t\t\t\t\t\t\t\t\t\t\t$lt: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t$ifNull: ['$placedAt', '$createdAt'],\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\tstartDate,\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ $limit: 1 },\n\t\t\t\t\t],\n\t\t\t\t\tas: 'previousOrders',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Classify\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\tisReturning: {\n\t\t\t\t\t\t$gt: [{ $size: '$previousOrders' }, 0],\n\t\t\t\t\t},\n\t\t\t\t\tdate: '$_id.date',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t// Aggregate graph metrics\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$date',\n\n\t\t\t\t\ttotalUsers: { $sum: 1 },\n\n\t\t\t\t\treturningUsers: {\n\t\t\t\t\t\t$sum: {\n\t\t\t\t\t\t\t$cond: ['$isReturning', 1, 0],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\n\t\t\t\t\tnewUsers: {\n\t\t\t\t\t\t$sum: {\n\t\t\t\t\t\t\t$cond: ['$isReturning', 0, 1],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\tdate: '$_id',\n\t\t\t\t\ttotalUsers: 1,\n\t\t\t\t\tnewUsers: 1,\n\t\t\t\t\treturningUsers: 1,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{ $sort: { date: 1 } },\n\t\t]);\n\n\t\tconst graphData = fillMissingPeriods(result, data.startDate, data.endDate, data.graphType, {\n\t\t\ttotalUsers: 0,\n\t\t\tnewUsers: 0,\n\t\t\treturningUsers: 0,\n\t\t});\n\n\t\treturn graphData;\n\t}\n\n\tpublic async getCouponProfitGraphData(data: GraphInputDTO) {\n\t\tconst startDate = dayjs(data.startDate).startOf('day').toDate();\n\t\tconst endDate = dayjs(data.endDate).endOf('day').toDate();\n\n\t\tconst dateFormat = data.graphType === GraphType.MONTHLY ? '%Y-%m' : '%Y-%m-%d';\n\n\t\tconst result = await this.orderModel.aggregate([\n\t\t\t{\n\t\t\t\t$match: {\n\t\t\t\t\t...this.getOrderGraphMatchStage(startDate, endDate, data.itemType),\n\t\t\t\t\t'adjustedFinance.coupon.coupon': { $ne: null },\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$addFields: {\n\t\t\t\t\tdate: {\n\t\t\t\t\t\t$dateToString: {\n\t\t\t\t\t\t\tformat: dateFormat,\n\t\t\t\t\t\t\tdate: '$placedAt',\n\t\t\t\t\t\t\ttimezone: LyxaTimezone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$group: {\n\t\t\t\t\t_id: '$date',\n\n\t\t\t\t\ttotalProfit: {\n\t\t\t\t\t\t$sum: '$adjustedFinance.companyProfit.totalProfit',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$project: {\n\t\t\t\t\t_id: 0,\n\t\t\t\t\tdate: '$_id',\n\t\t\t\t\ttotalProfit: 1,\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t{\n\t\t\t\t$sort: { date: 1 },\n\t\t\t},\n\t\t]);\n\n\t\t// Fill in missing dates with zero for graph continuity\n\t\tconst graphData = fillMissingPeriods(result, data.startDate, data.endDate, data.graphType, {\n\t\t\ttotalProfit: 0,\n\t\t});\n\n\t\treturn graphData;\n\t}\n}\n"]}
|
|
@@ -1532,6 +1532,7 @@ export declare const GraphInputSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1532
1532
|
export declare const CouponMetricsOutputSchema: z.ZodObject<{
|
|
1533
1533
|
activeCoupons: z.ZodDefault<z.ZodNumber>;
|
|
1534
1534
|
totalCreated: z.ZodDefault<z.ZodNumber>;
|
|
1535
|
+
totalRedeemedCoupons: z.ZodDefault<z.ZodNumber>;
|
|
1535
1536
|
redemptionRate: z.ZodDefault<z.ZodNumber>;
|
|
1536
1537
|
totalCouponOrders: z.ZodDefault<z.ZodNumber>;
|
|
1537
1538
|
totalRevenue: z.ZodDefault<z.ZodNumber>;
|
|
@@ -1539,6 +1540,7 @@ export declare const CouponMetricsOutputSchema: z.ZodObject<{
|
|
|
1539
1540
|
}, "strip", z.ZodTypeAny, {
|
|
1540
1541
|
activeCoupons: number;
|
|
1541
1542
|
totalCreated: number;
|
|
1543
|
+
totalRedeemedCoupons: number;
|
|
1542
1544
|
redemptionRate: number;
|
|
1543
1545
|
totalCouponOrders: number;
|
|
1544
1546
|
totalRevenue: number;
|
|
@@ -1546,6 +1548,7 @@ export declare const CouponMetricsOutputSchema: z.ZodObject<{
|
|
|
1546
1548
|
}, {
|
|
1547
1549
|
activeCoupons?: number | undefined;
|
|
1548
1550
|
totalCreated?: number | undefined;
|
|
1551
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1549
1552
|
redemptionRate?: number | undefined;
|
|
1550
1553
|
totalCouponOrders?: number | undefined;
|
|
1551
1554
|
totalRevenue?: number | undefined;
|
|
@@ -1574,6 +1577,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1574
1577
|
documents: z.ZodArray<z.ZodType<{
|
|
1575
1578
|
activeCoupons?: number | undefined;
|
|
1576
1579
|
totalCreated?: number | undefined;
|
|
1580
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1577
1581
|
redemptionRate?: number | undefined;
|
|
1578
1582
|
totalCouponOrders?: number | undefined;
|
|
1579
1583
|
totalRevenue?: number | undefined;
|
|
@@ -1581,6 +1585,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1581
1585
|
}, z.ZodTypeDef, {
|
|
1582
1586
|
activeCoupons?: number | undefined;
|
|
1583
1587
|
totalCreated?: number | undefined;
|
|
1588
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1584
1589
|
redemptionRate?: number | undefined;
|
|
1585
1590
|
totalCouponOrders?: number | undefined;
|
|
1586
1591
|
totalRevenue?: number | undefined;
|
|
@@ -1590,6 +1595,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1590
1595
|
documents: {
|
|
1591
1596
|
activeCoupons?: number | undefined;
|
|
1592
1597
|
totalCreated?: number | undefined;
|
|
1598
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1593
1599
|
redemptionRate?: number | undefined;
|
|
1594
1600
|
totalCouponOrders?: number | undefined;
|
|
1595
1601
|
totalRevenue?: number | undefined;
|
|
@@ -1605,6 +1611,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1605
1611
|
documents: {
|
|
1606
1612
|
activeCoupons?: number | undefined;
|
|
1607
1613
|
totalCreated?: number | undefined;
|
|
1614
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1608
1615
|
redemptionRate?: number | undefined;
|
|
1609
1616
|
totalCouponOrders?: number | undefined;
|
|
1610
1617
|
totalRevenue?: number | undefined;
|
|
@@ -1619,6 +1626,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1619
1626
|
}>, z.ZodType<{
|
|
1620
1627
|
activeCoupons?: number | undefined;
|
|
1621
1628
|
totalCreated?: number | undefined;
|
|
1629
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1622
1630
|
redemptionRate?: number | undefined;
|
|
1623
1631
|
totalCouponOrders?: number | undefined;
|
|
1624
1632
|
totalRevenue?: number | undefined;
|
|
@@ -1626,6 +1634,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1626
1634
|
}, z.ZodTypeDef, {
|
|
1627
1635
|
activeCoupons?: number | undefined;
|
|
1628
1636
|
totalCreated?: number | undefined;
|
|
1637
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1629
1638
|
redemptionRate?: number | undefined;
|
|
1630
1639
|
totalCouponOrders?: number | undefined;
|
|
1631
1640
|
totalRevenue?: number | undefined;
|
|
@@ -1637,6 +1646,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1637
1646
|
data?: {
|
|
1638
1647
|
activeCoupons?: number | undefined;
|
|
1639
1648
|
totalCreated?: number | undefined;
|
|
1649
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1640
1650
|
redemptionRate?: number | undefined;
|
|
1641
1651
|
totalCouponOrders?: number | undefined;
|
|
1642
1652
|
totalRevenue?: number | undefined;
|
|
@@ -1645,6 +1655,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1645
1655
|
documents: {
|
|
1646
1656
|
activeCoupons?: number | undefined;
|
|
1647
1657
|
totalCreated?: number | undefined;
|
|
1658
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1648
1659
|
redemptionRate?: number | undefined;
|
|
1649
1660
|
totalCouponOrders?: number | undefined;
|
|
1650
1661
|
totalRevenue?: number | undefined;
|
|
@@ -1663,6 +1674,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1663
1674
|
data?: {
|
|
1664
1675
|
activeCoupons?: number | undefined;
|
|
1665
1676
|
totalCreated?: number | undefined;
|
|
1677
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1666
1678
|
redemptionRate?: number | undefined;
|
|
1667
1679
|
totalCouponOrders?: number | undefined;
|
|
1668
1680
|
totalRevenue?: number | undefined;
|
|
@@ -1671,6 +1683,7 @@ export declare const CouponMetricsResponseSchema: z.ZodObject<{
|
|
|
1671
1683
|
documents: {
|
|
1672
1684
|
activeCoupons?: number | undefined;
|
|
1673
1685
|
totalCreated?: number | undefined;
|
|
1686
|
+
totalRedeemedCoupons?: number | undefined;
|
|
1674
1687
|
redemptionRate?: number | undefined;
|
|
1675
1688
|
totalCouponOrders?: number | undefined;
|
|
1676
1689
|
totalRevenue?: number | undefined;
|
|
@@ -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,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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GAAG,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC/E,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC;AACvD,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACzD,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC3E,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -132,6 +132,7 @@ exports.GraphInputSchema = exports.BaseDateInputSchema.extend({
|
|
|
132
132
|
exports.CouponMetricsOutputSchema = zod_1.z.object({
|
|
133
133
|
activeCoupons: global_validation_1.ZodValidation.number('Active coupons').default(0),
|
|
134
134
|
totalCreated: global_validation_1.ZodValidation.number('Total created coupons').default(0),
|
|
135
|
+
totalRedeemedCoupons: global_validation_1.ZodValidation.number('Total redeemed coupons').default(0),
|
|
135
136
|
redemptionRate: global_validation_1.ZodValidation.number('Redemption rate').default(0),
|
|
136
137
|
totalCouponOrders: global_validation_1.ZodValidation.number('Total coupon orders').default(0),
|
|
137
138
|
totalRevenue: global_validation_1.ZodValidation.number('Total revenue from coupons').default(0),
|