@lyxa.ai/core 1.4.247 → 1.4.249

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.
Files changed (43) hide show
  1. package/dist/libraries/event/EventEnums.d.ts +1 -0
  2. package/dist/libraries/event/EventEnums.js +1 -0
  3. package/dist/libraries/event/EventEnums.js.map +1 -1
  4. package/dist/libraries/event/events/spend-to-get/return-spend-to-get-redemption-of-cancelled-order-event.d.ts +14 -0
  5. package/dist/libraries/event/events/spend-to-get/return-spend-to-get-redemption-of-cancelled-order-event.js +20 -0
  6. package/dist/libraries/event/events/spend-to-get/return-spend-to-get-redemption-of-cancelled-order-event.js.map +1 -0
  7. package/dist/libraries/event/index.js +25 -6
  8. package/dist/libraries/event/index.js.map +1 -1
  9. package/dist/libraries/mongo/models/embedded/marketing-cut.model.d.ts +10 -1
  10. package/dist/libraries/mongo/models/embedded/marketing-cut.model.js +35 -1
  11. package/dist/libraries/mongo/models/embedded/marketing-cut.model.js.map +1 -1
  12. package/dist/libraries/mongo/models/embedded/order-pricing.model.d.ts +2 -0
  13. package/dist/libraries/mongo/models/embedded/order-pricing.model.js +10 -0
  14. package/dist/libraries/mongo/models/embedded/order-pricing.model.js.map +1 -1
  15. package/dist/libraries/mongo/models/embedded/regular-order-finance.model.d.ts +2 -1
  16. package/dist/libraries/mongo/models/embedded/regular-order-finance.model.js +5 -0
  17. package/dist/libraries/mongo/models/embedded/regular-order-finance.model.js.map +1 -1
  18. package/dist/libraries/mongo/models/embedded/spend-to-get-tier.model.d.ts +8 -0
  19. package/dist/libraries/mongo/models/embedded/spend-to-get-tier.model.js +43 -0
  20. package/dist/libraries/mongo/models/embedded/spend-to-get-tier.model.js.map +1 -0
  21. package/dist/libraries/mongo/models/index.d.ts +6 -0
  22. package/dist/libraries/mongo/models/index.js +9 -3
  23. package/dist/libraries/mongo/models/index.js.map +1 -1
  24. package/dist/libraries/mongo/models/providers/spend-to-get-marketing.model.d.ts +11 -0
  25. package/dist/libraries/mongo/models/providers/spend-to-get-marketing.model.js +46 -0
  26. package/dist/libraries/mongo/models/providers/spend-to-get-marketing.model.js.map +1 -0
  27. package/dist/libraries/mongo/models/spend-to-get-history.model.d.ts +13 -0
  28. package/dist/libraries/mongo/models/spend-to-get-history.model.js +51 -0
  29. package/dist/libraries/mongo/models/spend-to-get-history.model.js.map +1 -0
  30. package/dist/libraries/trpc/middlewares/auth.d.ts +1 -1
  31. package/dist/libraries/trpc/middlewares/createRoleProtectedProcedure.d.ts +1 -1
  32. package/dist/libraries/trpc/middlewares/phone-verified.d.ts +1 -1
  33. package/dist/libraries/trpc/middlewares/publicUserDecoder.d.ts +1 -1
  34. package/dist/types/README.md +1 -1
  35. package/dist/types/package.json +1 -1
  36. package/dist/types/utilities/enum.d.ts +7 -1
  37. package/dist/types/utilities/enum.js +11 -4
  38. package/dist/types/utilities/enum.js.map +1 -1
  39. package/dist/types/utilities/validation/common-validation.d.ts +12 -12
  40. package/dist/utilities/enum.d.ts +7 -1
  41. package/dist/utilities/enum.js +11 -4
  42. package/dist/utilities/enum.js.map +1 -1
  43. package/package.json +1 -1
@@ -21,5 +21,6 @@ export declare enum PublishEventEnums {
21
21
  MARKETING_RETURN_PUNCH_COUPON_EVENT = "marketing_return_punch_coupon_event",
22
22
  SYNC_ALL_PRODUCTS_PARENT_SUB_CATEGORIES_EVENT = "sync_all_products_parent_sub_categories_event",
23
23
  RIDER_CASH_EVENT = "rider_cash_event",
24
+ MARKETING_RETURN_SPEND_TO_GET_REDEMPTION_EVENT = "marketing_return_spend_to_get_redemption_event",
24
25
  PAYOUT_SCHEDULE_EVENT = "payout_schedule_event"
25
26
  }
@@ -25,6 +25,7 @@ var PublishEventEnums;
25
25
  PublishEventEnums["MARKETING_RETURN_PUNCH_COUPON_EVENT"] = "marketing_return_punch_coupon_event";
26
26
  PublishEventEnums["SYNC_ALL_PRODUCTS_PARENT_SUB_CATEGORIES_EVENT"] = "sync_all_products_parent_sub_categories_event";
27
27
  PublishEventEnums["RIDER_CASH_EVENT"] = "rider_cash_event";
28
+ PublishEventEnums["MARKETING_RETURN_SPEND_TO_GET_REDEMPTION_EVENT"] = "marketing_return_spend_to_get_redemption_event";
28
29
  PublishEventEnums["PAYOUT_SCHEDULE_EVENT"] = "payout_schedule_event";
29
30
  })(PublishEventEnums || (exports.PublishEventEnums = PublishEventEnums = {}));
30
31
  //# sourceMappingURL=EventEnums.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EventEnums.js","sourceRoot":"/","sources":["libraries/event/EventEnums.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAwBX;AAxBD,WAAY,iBAAiB;IAC5B,4EAAuD,CAAA;IACvD,sEAAiD,CAAA;IACjD,4EAAuD,CAAA;IACvD,sEAAiD,CAAA;IACjD,wGAAmF,CAAA;IACnF,sHAAiG,CAAA;IACjG,oGAA+E,CAAA;IAC/E,sFAAiE,CAAA;IACjE,8FAAyE,CAAA;IACzE,sHAAiG,CAAA;IACjG,4GAAuF,CAAA;IACvF,kFAA6D,CAAA;IAC7D,0GAAqF,CAAA;IACrF,oGAA+E,CAAA;IAC/E,oHAA+F,CAAA;IAC/F,8HAAyG,CAAA;IACzG,8HAAyG,CAAA;IACzG,gEAA2C,CAAA;IAC3C,gFAA2D,CAAA;IAC3D,gGAA2E,CAAA;IAC3E,oHAA+F,CAAA;IAC/F,0DAAqC,CAAA;IACrC,oEAA+C,CAAA;AAChD,CAAC,EAxBW,iBAAiB,iCAAjB,iBAAiB,QAwB5B","sourcesContent":["export enum PublishEventEnums {\n\tADMIN_ACTIVITY_LOGS_EVENT = 'admin_activity_logs_event',\n\tMESSAGE_RECEIVED_EVENT = 'message_received_event',\n\tTICKET_NOTIFICATION_EVENT = 'ticket_notification_event',\n\tCART_ITEM_UPSERT_EVENT = 'cart_item_upsert_event',\n\tSHOP_ACTIVE_TIMINGS_BATCH_PROCESS_EVENT = 'shop_active_timings_batch_process_event',\n\tMONGO_STREAM_CHANGES_BATCH_PROCESS_SHOPS_EVENT = 'mongo_stream_changes_batch_process_shops_event',\n\tBULK_UPDATE_SHOPS_SEARCH_FIELDS_EVENT = 'bulk_update_shops_search_fields_event',\n\tSOCKET_PUSH_NOTIFICATION_EVENT = 'socket_push_notification_event',\n\tBULK_UPDATE_SHOP_ZONE_STATUS_EVENT = 'bulk_update_shop_zone_status_event',\n\tSYNC_ALL_PRODUCTS_PRODUCT_MARKETING_INFO_EVENT = 'sync_all_products_product_marketing_info_event',\n\tSYNC_ALL_SHOPS_AVG_PREPARATION_TIME_EVENT = 'sync_all_shops_avg_preperation_time_event',\n\tSYNC_SINGLE_SHOP_CACHE_EVENT = 'sync_single_shop_cache_event',\n\tSYNC_SINGLE_SHOP_ORDER_AGAIN_CACHE_EVENT = 'sync_single_shop_order_again_cache_event',\n\tSYNC_SINGLE_SHOP_SECTIONS_CACHE_EVENT = 'sync_single_shop_sections_cache_event',\n\tSYNC_ALL_CUSTOMIZED_SHOP_SECTIONS_CACHE_EVENT = 'sync_all_customized_shop_sections_cache_event',\n\tSYNC_ALL_USERS_PUNCH_MARKETING_HISTORY_CACHE_EVENT = 'sync_all_users_punch_marketing_history_cache_event',\n\tSYNC_USER_SHOP_PUNCH_MARKETING_HISTORY_CACHE_EVENT = 'sync_user_shop_punch_marketing_history_cache_event',\n\tRIDER_SCORE_EVENT = 'rider.score.calculate',\n\tRIDER_ORDER_COMPLETED_EVENT = 'rider_order_completed_event',\n\tMARKETING_RETURN_PUNCH_COUPON_EVENT = 'marketing_return_punch_coupon_event',\n\tSYNC_ALL_PRODUCTS_PARENT_SUB_CATEGORIES_EVENT = 'sync_all_products_parent_sub_categories_event',\n\tRIDER_CASH_EVENT = 'rider_cash_event',\n\tPAYOUT_SCHEDULE_EVENT = 'payout_schedule_event',\n}\n"]}
1
+ {"version":3,"file":"EventEnums.js","sourceRoot":"/","sources":["libraries/event/EventEnums.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAyBX;AAzBD,WAAY,iBAAiB;IAC5B,4EAAuD,CAAA;IACvD,sEAAiD,CAAA;IACjD,4EAAuD,CAAA;IACvD,sEAAiD,CAAA;IACjD,wGAAmF,CAAA;IACnF,sHAAiG,CAAA;IACjG,oGAA+E,CAAA;IAC/E,sFAAiE,CAAA;IACjE,8FAAyE,CAAA;IACzE,sHAAiG,CAAA;IACjG,4GAAuF,CAAA;IACvF,kFAA6D,CAAA;IAC7D,0GAAqF,CAAA;IACrF,oGAA+E,CAAA;IAC/E,oHAA+F,CAAA;IAC/F,8HAAyG,CAAA;IACzG,8HAAyG,CAAA;IACzG,gEAA2C,CAAA;IAC3C,gFAA2D,CAAA;IAC3D,gGAA2E,CAAA;IAC3E,oHAA+F,CAAA;IAC/F,0DAAqC,CAAA;IACrC,sHAAiG,CAAA;IACjG,oEAA+C,CAAA;AAChD,CAAC,EAzBW,iBAAiB,iCAAjB,iBAAiB,QAyB5B","sourcesContent":["export enum PublishEventEnums {\n\tADMIN_ACTIVITY_LOGS_EVENT = 'admin_activity_logs_event',\n\tMESSAGE_RECEIVED_EVENT = 'message_received_event',\n\tTICKET_NOTIFICATION_EVENT = 'ticket_notification_event',\n\tCART_ITEM_UPSERT_EVENT = 'cart_item_upsert_event',\n\tSHOP_ACTIVE_TIMINGS_BATCH_PROCESS_EVENT = 'shop_active_timings_batch_process_event',\n\tMONGO_STREAM_CHANGES_BATCH_PROCESS_SHOPS_EVENT = 'mongo_stream_changes_batch_process_shops_event',\n\tBULK_UPDATE_SHOPS_SEARCH_FIELDS_EVENT = 'bulk_update_shops_search_fields_event',\n\tSOCKET_PUSH_NOTIFICATION_EVENT = 'socket_push_notification_event',\n\tBULK_UPDATE_SHOP_ZONE_STATUS_EVENT = 'bulk_update_shop_zone_status_event',\n\tSYNC_ALL_PRODUCTS_PRODUCT_MARKETING_INFO_EVENT = 'sync_all_products_product_marketing_info_event',\n\tSYNC_ALL_SHOPS_AVG_PREPARATION_TIME_EVENT = 'sync_all_shops_avg_preperation_time_event',\n\tSYNC_SINGLE_SHOP_CACHE_EVENT = 'sync_single_shop_cache_event',\n\tSYNC_SINGLE_SHOP_ORDER_AGAIN_CACHE_EVENT = 'sync_single_shop_order_again_cache_event',\n\tSYNC_SINGLE_SHOP_SECTIONS_CACHE_EVENT = 'sync_single_shop_sections_cache_event',\n\tSYNC_ALL_CUSTOMIZED_SHOP_SECTIONS_CACHE_EVENT = 'sync_all_customized_shop_sections_cache_event',\n\tSYNC_ALL_USERS_PUNCH_MARKETING_HISTORY_CACHE_EVENT = 'sync_all_users_punch_marketing_history_cache_event',\n\tSYNC_USER_SHOP_PUNCH_MARKETING_HISTORY_CACHE_EVENT = 'sync_user_shop_punch_marketing_history_cache_event',\n\tRIDER_SCORE_EVENT = 'rider.score.calculate',\n\tRIDER_ORDER_COMPLETED_EVENT = 'rider_order_completed_event',\n\tMARKETING_RETURN_PUNCH_COUPON_EVENT = 'marketing_return_punch_coupon_event',\n\tSYNC_ALL_PRODUCTS_PARENT_SUB_CATEGORIES_EVENT = 'sync_all_products_parent_sub_categories_event',\n\tRIDER_CASH_EVENT = 'rider_cash_event',\n\tMARKETING_RETURN_SPEND_TO_GET_REDEMPTION_EVENT = 'marketing_return_spend_to_get_redemption_event',\n\tPAYOUT_SCHEDULE_EVENT = 'payout_schedule_event',\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { BaseEvent } from '../../BaseEvent';
2
+ import { DTO } from '../../../../utilities/validation/global-validation';
3
+ declare const ReturnSpendToGetRedemptionOfCancelledOrderValidationSchema: import("zod").ZodObject<{
4
+ orderId: import("zod").ZodUnion<[import("zod").ZodEffects<import("zod").ZodEffects<import("zod").ZodString, string, string>, import("mongoose").Types.ObjectId, string>, import("zod").ZodType<import("mongoose").Types.ObjectId, import("zod").ZodTypeDef, import("mongoose").Types.ObjectId>]>;
5
+ }, "strict", import("zod").ZodTypeAny, {
6
+ orderId: import("mongoose").Types.ObjectId;
7
+ }, {
8
+ orderId: string | import("mongoose").Types.ObjectId;
9
+ }>;
10
+ export type ReturnSpendToGetRedemptionOfCancelledOrderValidationDTO = DTO<typeof ReturnSpendToGetRedemptionOfCancelledOrderValidationSchema>;
11
+ export declare class ReturnSpendToGetRedemptionOfCancelledOrderEvent extends BaseEvent<Record<string, unknown>> {
12
+ constructor(payload: ReturnSpendToGetRedemptionOfCancelledOrderValidationDTO);
13
+ }
14
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReturnSpendToGetRedemptionOfCancelledOrderEvent = void 0;
4
+ const BaseEvent_1 = require("../../BaseEvent");
5
+ const EventEnums_1 = require("../../EventEnums");
6
+ const global_validation_1 = require("../../../../utilities/validation/global-validation");
7
+ const baseFields = {
8
+ orderId: global_validation_1.ZodValidation.objectId(),
9
+ };
10
+ const schemaBuilder = (0, global_validation_1.createSchemaBuilder)(baseFields);
11
+ const { BaseSchema: ReturnSpendToGetRedemptionOfCancelledOrderValidationSchema } = schemaBuilder.getAllSchemas({
12
+ createdAt: true,
13
+ });
14
+ class ReturnSpendToGetRedemptionOfCancelledOrderEvent extends BaseEvent_1.BaseEvent {
15
+ constructor(payload) {
16
+ super(EventEnums_1.PublishEventEnums.MARKETING_RETURN_SPEND_TO_GET_REDEMPTION_EVENT, payload);
17
+ }
18
+ }
19
+ exports.ReturnSpendToGetRedemptionOfCancelledOrderEvent = ReturnSpendToGetRedemptionOfCancelledOrderEvent;
20
+ //# sourceMappingURL=return-spend-to-get-redemption-of-cancelled-order-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"return-spend-to-get-redemption-of-cancelled-order-event.js","sourceRoot":"/","sources":["libraries/event/events/spend-to-get/return-spend-to-get-redemption-of-cancelled-order-event.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAC5C,iDAAqD;AACrD,0FAA6G;AAE7G,MAAM,UAAU,GAAG;IAClB,OAAO,EAAE,iCAAa,CAAC,QAAQ,EAAE;CACjC,CAAC;AACF,MAAM,aAAa,GAAG,IAAA,uCAAmB,EAAC,UAAU,CAAC,CAAC;AACtD,MAAM,EAAE,UAAU,EAAE,0DAA0D,EAAE,GAAG,aAAa,CAAC,aAAa,CAAC;IAC9G,SAAS,EAAE,IAAI;CACf,CAAC,CAAC;AAMH,MAAa,+CAAgD,SAAQ,qBAAkC;IACtG,YAAY,OAAgE;QAC3E,KAAK,CAAC,8BAAiB,CAAC,8CAA8C,EAAE,OAAkC,CAAC,CAAC;IAC7G,CAAC;CACD;AAJD,0GAIC","sourcesContent":["import { BaseEvent } from '../../BaseEvent';\nimport { PublishEventEnums } from '../../EventEnums';\nimport { createSchemaBuilder, DTO, ZodValidation } from '../../../../utilities/validation/global-validation';\n\nconst baseFields = {\n\torderId: ZodValidation.objectId(),\n};\nconst schemaBuilder = createSchemaBuilder(baseFields);\nconst { BaseSchema: ReturnSpendToGetRedemptionOfCancelledOrderValidationSchema } = schemaBuilder.getAllSchemas({\n\tcreatedAt: true,\n});\n\nexport type ReturnSpendToGetRedemptionOfCancelledOrderValidationDTO = DTO<\n\ttypeof ReturnSpendToGetRedemptionOfCancelledOrderValidationSchema\n>;\n\nexport class ReturnSpendToGetRedemptionOfCancelledOrderEvent extends BaseEvent<Record<string, unknown>> {\n\tconstructor(payload: ReturnSpendToGetRedemptionOfCancelledOrderValidationDTO) {\n\t\tsuper(PublishEventEnums.MARKETING_RETURN_SPEND_TO_GET_REDEMPTION_EVENT, payload as Record<string, unknown>);\n\t}\n}\n"]}
@@ -45,7 +45,12 @@ async function createQueueChannel(eventId) {
45
45
  await wrapper.waitForConnect();
46
46
  return wrapper;
47
47
  }
48
- async function handleMsg(wrapper, msg, handler, label, requeue = true) {
48
+ const MAX_RETRIES = 3;
49
+ function getRetryCount(msg) {
50
+ const headers = msg.properties.headers ?? {};
51
+ return typeof headers['x-retry-count'] === 'number' ? headers['x-retry-count'] : 0;
52
+ }
53
+ async function handleMsg(wrapper, msg, handler, label) {
49
54
  try {
50
55
  const payload = JSON.parse(msg.content.toString());
51
56
  await handler(payload);
@@ -53,10 +58,24 @@ async function handleMsg(wrapper, msg, handler, label, requeue = true) {
53
58
  return true;
54
59
  }
55
60
  catch (err) {
56
- (0, index_1.getLibraries)()
57
- .getLoggerKit()
58
- .error(`Error handling [${label}]`, err, { tag: enum_1.LogTag.INFRA_QUEUE });
59
- wrapper.nack(msg, false, requeue);
61
+ const retryCount = getRetryCount(msg);
62
+ const logger = (0, index_1.getLibraries)().getLoggerKit();
63
+ if (retryCount < MAX_RETRIES) {
64
+ logger.error(`Error handling [${label}], retrying (${retryCount + 1}/${MAX_RETRIES})`, err, {
65
+ tag: enum_1.LogTag.INFRA_QUEUE,
66
+ });
67
+ wrapper.ack(msg);
68
+ await pubChannelWrapper.publish(EXCHANGE_NAME, msg.fields.routingKey, msg.content, {
69
+ ...AMQP_PUBLISH_OPTIONS,
70
+ headers: { ...(msg.properties.headers ?? {}), 'x-retry-count': retryCount + 1 },
71
+ });
72
+ }
73
+ else {
74
+ (0, index_1.getLibraries)()
75
+ .getLoggerKit()
76
+ .error(`Error handling [${label}]`, err, { tag: enum_1.LogTag.INFRA_QUEUE, data: { label, msg } });
77
+ wrapper.ack(msg);
78
+ }
60
79
  return false;
61
80
  }
62
81
  }
@@ -73,7 +92,7 @@ async function subscribeToQueue(queueName, routingKey, onMessage, options = {})
73
92
  },
74
93
  });
75
94
  await wrapper.waitForConnect();
76
- await wrapper.consume(queueName, msg => handleMsg(wrapper, msg, onMessage, queueName, requeue));
95
+ await wrapper.consume(queueName, msg => handleMsg(wrapper, msg, onMessage, queueName));
77
96
  console.log(`Subscribed to queue [${queueName}]`);
78
97
  }
79
98
  async function publish(routingKey, payload) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/event/index.ts"],"names":[],"mappings":";;;;;AAqBA,wDAcC;AAkCD,4CAuBC;AAED,0BAOC;AAED,oCAEC;AAED,4CAYC;AAED,8CAoCC;AAED,0DAKC;AAlKD,mEAA+D;AAC/D,uCAA2C;AAC3C,+CAA8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IAAA,oBAAY,GAAE;aAClB,YAAY,EAAE;aACd,KAAK,CAAC,mBAAmB,OAAO,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,aAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;AACF,CAAC;AAEM,KAAK,UAAU,uBAAuB;IAC5C,IAAI,iBAAiB;QAAE,MAAM,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACvD,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpE,IAAI,UAAU;QAAE,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAA,8BAAa,GAAE,GAAG,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import amqp from 'amqplib';\nimport { BaseEvent } from './BaseEvent';\nimport { getInstanceId } from '../../utilities/instance.utils';\nimport { getLibraries } from '../../index';\nimport { LogTag } from '../../utilities/enum';\n\nimport amqpManager, { Channel, ChannelWrapper } from 'amqp-connection-manager';\nimport { IAmqpConnectionManager } from 'amqp-connection-manager/dist/types/AmqpConnectionManager';\n\nlet connection: IAmqpConnectionManager;\nlet pubChannelWrapper: ChannelWrapper;\nconst pollChannels = new Map<string, ChannelWrapper>();\n\nconst EXCHANGE_NAME = 'lyxa.events';\n\ntype PublishOptions = Parameters<ChannelWrapper['publish']>[3];\nconst AMQP_PUBLISH_OPTIONS = {\n\tcontentType: 'application/json',\n\tpersistent: true,\n} as amqp.Options.Publish as unknown as PublishOptions;\n\nexport async function initRabbitMQConnection(rabbitUrl: string): Promise<void> {\n\tconnection = amqpManager.connect([rabbitUrl]);\n\tconnection.on('connect', () => console.log('RabbitMQ connected'));\n\tconnection.on('disconnect', err => console.error('RabbitMQ disconnected', err));\n\n\tpubChannelWrapper = connection.createChannel({\n\t\tconfirm: true,\n\t\tsetup: async (ch: Channel) => {\n\t\t\tawait ch.assertExchange(EXCHANGE_NAME, 'topic', { durable: true });\n\t\t},\n\t});\n\n\tawait pubChannelWrapper.waitForConnect();\n\tconsole.log(`EventBus initialized with instance ID: ${getInstanceId()}`);\n}\n\nasync function createQueueChannel(eventId: string): Promise<ChannelWrapper> {\n\tconst wrapper = connection.createChannel({\n\t\tsetup: async (ch: Channel) => {\n\t\t\tawait ch.assertQueue(eventId, { durable: true, exclusive: false, autoDelete: false });\n\t\t\tawait ch.bindQueue(eventId, EXCHANGE_NAME, eventId);\n\t\t},\n\t});\n\tawait wrapper.waitForConnect();\n\treturn wrapper;\n}\n\nasync function handleMsg(\n\twrapper: ChannelWrapper,\n\tmsg: amqp.Message,\n\thandler: (payload: any) => void | Promise<void>,\n\tlabel: string,\n\trequeue = true\n): Promise<boolean> {\n\ttry {\n\t\tconst payload = JSON.parse(msg.content.toString());\n\t\tawait handler(payload);\n\t\twrapper.ack(msg);\n\t\treturn true;\n\t} catch (err) {\n\t\tgetLibraries()\n\t\t\t.getLoggerKit()\n\t\t\t.error(`Error handling [${label}]`, err, { tag: LogTag.INFRA_QUEUE });\n\t\twrapper.nack(msg, false, requeue);\n\t\treturn false;\n\t}\n}\n\nexport async function subscribeToQueue(\n\tqueueName: string,\n\troutingKey: string,\n\tonMessage: (payload: unknown) => void | Promise<void>,\n\toptions: { requeue?: boolean; durable?: boolean } = {}\n): Promise<void> {\n\tif (!connection) {\n\t\tconsole.warn(`[RabbitMQ] subscribeToQueue called before connection initialized, skipping [${queueName}]`);\n\t\treturn;\n\t}\n\n\tconst { requeue = true, durable = true } = options;\n\n\tconst wrapper = connection.createChannel({\n\t\tsetup: async (ch: Channel) => {\n\t\t\tawait ch.assertQueue(queueName, { durable });\n\t\t\tawait ch.bindQueue(queueName, EXCHANGE_NAME, routingKey);\n\t\t},\n\t});\n\tawait wrapper.waitForConnect();\n\n\tawait wrapper.consume(queueName, msg => handleMsg(wrapper, msg, onMessage, queueName, requeue));\n\tconsole.log(`Subscribed to queue [${queueName}]`);\n}\n\nexport async function publish(routingKey: string, payload: object): Promise<void> {\n\tawait pubChannelWrapper.publish(\n\t\tEXCHANGE_NAME,\n\t\troutingKey,\n\t\tBuffer.from(JSON.stringify(payload)),\n\t\tAMQP_PUBLISH_OPTIONS\n\t);\n}\n\nexport async function publishEvent<TPayload extends object>(event: BaseEvent<TPayload>): Promise<void> {\n\tawait publish(event.eventId, event.payload);\n}\n\nexport async function subscribeToEvent(\n\teventId: string,\n\tonMessage: (payload: any) => Promise<void>\n): Promise<void> {\n\tif (!connection) {\n\t\tconsole.warn(`[RabbitMQ] subscribe called before connection initialized, skipping [${eventId}]`);\n\t\treturn;\n\t}\n\n\tconst wrapper = await createQueueChannel(eventId);\n\tawait wrapper.consume(eventId, msg => handleMsg(wrapper, msg, onMessage, eventId));\n\tconsole.log(`Subscribed to event [${eventId}]`);\n}\n\nexport async function pollEventMessages(\n\teventId: string,\n\tonMessage: (payloads: any[]) => Promise<void>,\n\tlimit?: number\n): Promise<void> {\n\tif (!connection) {\n\t\tconsole.warn(`[RabbitMQ] poll called before connection initialized, skipping [${eventId}]`);\n\t\treturn;\n\t}\n\n\tif (!pollChannels.has(eventId)) {\n\t\tpollChannels.set(eventId, await createQueueChannel(eventId));\n\t}\n\n\tconst wrapper = pollChannels.get(eventId)!;\n\tconst max = limit ?? Infinity;\n\tconst msgs: amqp.Message[] = [];\n\n\twhile (msgs.length < max) {\n\t\tconst msg = await wrapper.get(eventId, { noAck: false });\n\t\tif (!msg) break;\n\t\tmsgs.push(msg);\n\t}\n\n\tif (msgs.length === 0) return;\n\n\ttry {\n\t\tconst payloads = msgs.map(msg => JSON.parse(msg.content.toString()));\n\t\tawait onMessage(payloads);\n\t\tmsgs.forEach(msg => wrapper.ack(msg));\n\t} catch (err) {\n\t\tawait getLibraries()\n\t\t\t.getLoggerKit()\n\t\t\t.error(`Error handling [${eventId}]`, err, { tag: LogTag.INFRA_QUEUE });\n\t\tmsgs.forEach(msg => wrapper.nack(msg, false, true));\n\t}\n}\n\nexport async function closeRabbitMQConnection(): Promise<void> {\n\tif (pubChannelWrapper) await pubChannelWrapper.close();\n\tawait Promise.all([...pollChannels.values()].map(ch => ch.close()));\n\tif (connection) await connection.close();\n\tconsole.log(`EventBus closed for instance [${getInstanceId()}]`);\n}"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/event/index.ts"],"names":[],"mappings":";;;;;AAqBA,wDAcC;AA0DD,4CAuBC;AAED,0BAOC;AAED,oCAEC;AAED,4CAYC;AAED,8CAoCC;AAED,0DAKC;AA1LD,mEAA+D;AAC/D,uCAA2C;AAC3C,+CAA8C;AAE9C,sFAA+E;AAG/E,IAAI,UAAkC,CAAC;AACvC,IAAI,iBAAiC,CAAC;AACtC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEvD,MAAM,aAAa,GAAG,aAAa,CAAC;AAGpC,MAAM,oBAAoB,GAAG;IAC5B,WAAW,EAAE,kBAAkB;IAC/B,UAAU,EAAE,IAAI;CACqC,CAAC;AAEhD,KAAK,UAAU,sBAAsB,CAAC,SAAiB;IAC7D,UAAU,GAAG,iCAAW,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClE,UAAU,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC,CAAC;IAEhF,iBAAiB,GAAG,UAAU,CAAC,aAAa,CAAC;QAC5C,OAAO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G,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QACrE,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC1B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,MAAM,IAAA,oBAAY,GAAE;aAClB,YAAY,EAAE;aACd,KAAK,CAAC,mBAAmB,OAAO,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,aAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;AACF,CAAC;AAEM,KAAK,UAAU,uBAAuB;IAC5C,IAAI,iBAAiB;QAAE,MAAM,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACvD,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACpE,IAAI,UAAU;QAAE,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAA,8BAAa,GAAE,GAAG,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import amqp from 'amqplib';\nimport { BaseEvent } from './BaseEvent';\nimport { getInstanceId } from '../../utilities/instance.utils';\nimport { getLibraries } from '../../index';\nimport { LogTag } from '../../utilities/enum';\n\nimport amqpManager, { Channel, ChannelWrapper } from 'amqp-connection-manager';\nimport { IAmqpConnectionManager } from 'amqp-connection-manager/dist/types/AmqpConnectionManager';\n\nlet connection: IAmqpConnectionManager;\nlet pubChannelWrapper: ChannelWrapper;\nconst pollChannels = new Map<string, ChannelWrapper>();\n\nconst EXCHANGE_NAME = 'lyxa.events';\n\ntype PublishOptions = Parameters<ChannelWrapper['publish']>[3];\nconst AMQP_PUBLISH_OPTIONS = {\n\tcontentType: 'application/json',\n\tpersistent: true,\n} as amqp.Options.Publish as unknown as PublishOptions;\n\nexport async function initRabbitMQConnection(rabbitUrl: string): Promise<void> {\n\tconnection = amqpManager.connect([rabbitUrl]);\n\tconnection.on('connect', () => console.log('RabbitMQ connected'));\n\tconnection.on('disconnect', err => console.error('RabbitMQ disconnected', err));\n\n\tpubChannelWrapper = connection.createChannel({\n\t\tconfirm: true,\n\t\tsetup: async (ch: Channel) => {\n\t\t\tawait ch.assertExchange(EXCHANGE_NAME, 'topic', { durable: true });\n\t\t},\n\t});\n\n\tawait pubChannelWrapper.waitForConnect();\n\tconsole.log(`EventBus initialized with instance ID: ${getInstanceId()}`);\n}\n\nasync function createQueueChannel(eventId: string): Promise<ChannelWrapper> {\n\tconst wrapper = connection.createChannel({\n\t\tsetup: async (ch: Channel) => {\n\t\t\tawait ch.assertQueue(eventId, { durable: true, exclusive: false, autoDelete: false });\n\t\t\tawait ch.bindQueue(eventId, EXCHANGE_NAME, eventId);\n\t\t},\n\t});\n\tawait wrapper.waitForConnect();\n\treturn wrapper;\n}\n\nconst MAX_RETRIES = 3;\n\nfunction getRetryCount(msg: amqp.Message): number {\n\tconst headers = msg.properties.headers ?? {};\n\treturn typeof headers['x-retry-count'] === 'number' ? headers['x-retry-count'] : 0;\n}\n\nasync function handleMsg(\n\twrapper: ChannelWrapper,\n\tmsg: amqp.Message,\n\thandler: (payload: any) => void | Promise<void>,\n\tlabel: string\n): Promise<boolean> {\n\ttry {\n\t\tconst payload = JSON.parse(msg.content.toString());\n\t\tawait handler(payload);\n\t\twrapper.ack(msg);\n\t\treturn true;\n\t} catch (err) {\n\t\tconst retryCount = getRetryCount(msg);\n\t\tconst logger = getLibraries().getLoggerKit();\n\n\t\tif (retryCount < MAX_RETRIES) {\n\t\t\tlogger.error(`Error handling [${label}], retrying (${retryCount + 1}/${MAX_RETRIES})`, err, {\n\t\t\t\ttag: LogTag.INFRA_QUEUE,\n\t\t\t});\n\n\t\t\t// Ack the current delivery, then republish a copy with the incremented count.\n\t\t\t// Plain nack+requeue redelivers the same message with no way to track attempts,\n\t\t\t// so we manage the counter ourselves via headers.\n\t\t\twrapper.ack(msg);\n\t\t\tawait pubChannelWrapper.publish(EXCHANGE_NAME, msg.fields.routingKey, msg.content, {\n\t\t\t\t...AMQP_PUBLISH_OPTIONS,\n\t\t\t\theaders: { ...(msg.properties.headers ?? {}), 'x-retry-count': retryCount + 1 },\n\t\t\t} as PublishOptions);\n\t\t} else {\n\t\t\tgetLibraries()\n\t\t\t\t.getLoggerKit()\n\t\t\t\t.error(`Error handling [${label}]`, err, { tag: LogTag.INFRA_QUEUE, data: { label, msg} });\n\t\t\twrapper.ack(msg); // remove it from the queue permanently — no DLQ, just gone\n\t\t}\n\t\treturn false;\n\t}\n}\n\nexport async function subscribeToQueue(\n\tqueueName: string,\n\troutingKey: string,\n\tonMessage: (payload: unknown) => void | Promise<void>,\n\toptions: { requeue?: boolean; durable?: boolean } = {}\n): Promise<void> {\n\tif (!connection) {\n\t\tconsole.warn(`[RabbitMQ] subscribeToQueue called before connection initialized, skipping [${queueName}]`);\n\t\treturn;\n\t}\n\n\tconst { requeue = true, durable = true } = options;\n\n\tconst wrapper = connection.createChannel({\n\t\tsetup: async (ch: Channel) => {\n\t\t\tawait ch.assertQueue(queueName, { durable });\n\t\t\tawait ch.bindQueue(queueName, EXCHANGE_NAME, routingKey);\n\t\t},\n\t});\n\tawait wrapper.waitForConnect();\n\n\tawait wrapper.consume(queueName, msg => handleMsg(wrapper, msg, onMessage, queueName));\n\tconsole.log(`Subscribed to queue [${queueName}]`);\n}\n\nexport async function publish(routingKey: string, payload: object): Promise<void> {\n\tawait pubChannelWrapper.publish(\n\t\tEXCHANGE_NAME,\n\t\troutingKey,\n\t\tBuffer.from(JSON.stringify(payload)),\n\t\tAMQP_PUBLISH_OPTIONS\n\t);\n}\n\nexport async function publishEvent<TPayload extends object>(event: BaseEvent<TPayload>): Promise<void> {\n\tawait publish(event.eventId, event.payload);\n}\n\nexport async function subscribeToEvent(\n\teventId: string,\n\tonMessage: (payload: any) => Promise<void>\n): Promise<void> {\n\tif (!connection) {\n\t\tconsole.warn(`[RabbitMQ] subscribe called before connection initialized, skipping [${eventId}]`);\n\t\treturn;\n\t}\n\n\tconst wrapper = await createQueueChannel(eventId);\n\tawait wrapper.consume(eventId, msg => handleMsg(wrapper, msg, onMessage, eventId));\n\tconsole.log(`Subscribed to event [${eventId}]`);\n}\n\nexport async function pollEventMessages(\n\teventId: string,\n\tonMessage: (payloads: any[]) => Promise<void>,\n\tlimit?: number\n): Promise<void> {\n\tif (!connection) {\n\t\tconsole.warn(`[RabbitMQ] poll called before connection initialized, skipping [${eventId}]`);\n\t\treturn;\n\t}\n\n\tif (!pollChannels.has(eventId)) {\n\t\tpollChannels.set(eventId, await createQueueChannel(eventId));\n\t}\n\n\tconst wrapper = pollChannels.get(eventId)!;\n\tconst max = limit ?? Infinity;\n\tconst msgs: amqp.Message[] = [];\n\n\twhile (msgs.length < max) {\n\t\tconst msg = await wrapper.get(eventId, { noAck: false });\n\t\tif (!msg) break;\n\t\tmsgs.push(msg);\n\t}\n\n\tif (msgs.length === 0) return;\n\n\ttry {\n\t\tconst payloads = msgs.map(msg => JSON.parse(msg.content.toString()));\n\t\tawait onMessage(payloads);\n\t\tmsgs.forEach(msg => wrapper.ack(msg));\n\t} catch (err) {\n\t\tawait getLibraries()\n\t\t\t.getLoggerKit()\n\t\t\t.error(`Error handling [${eventId}]`, err, { tag: LogTag.INFRA_QUEUE });\n\t\tmsgs.forEach(msg => wrapper.nack(msg, false, true));\n\t}\n}\n\nexport async function closeRabbitMQConnection(): Promise<void> {\n\tif (pubChannelWrapper) await pubChannelWrapper.close();\n\tawait Promise.all([...pollChannels.values()].map(ch => ch.close()));\n\tif (connection) await connection.close();\n\tconsole.log(`EventBus closed for instance [${getInstanceId()}]`);\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { Coupon } from '../coupon.model';
3
- import { CouponType, ValueType } from '../../../../utilities/enum';
3
+ import { Marketing } from '../marketing.model';
4
+ import { CouponType, SpendToGetRewardType, ValueType } from '../../../../utilities/enum';
4
5
  export declare class CompanyCut {
5
6
  companyCut?: number;
6
7
  secondaryCompanyCut?: number;
@@ -16,6 +17,14 @@ export declare class CouponDetails extends MarketingCut {
16
17
  valueType?: ValueType;
17
18
  value?: number;
18
19
  }
20
+ export declare class SpendToGetDetails extends MarketingCut {
21
+ marketing?: Ref<Marketing>;
22
+ tierMinSpend?: number;
23
+ rewardType?: SpendToGetRewardType;
24
+ rewardValue?: number;
25
+ maxDiscountCap?: number;
26
+ isMaxDiscountCapEnabled?: boolean;
27
+ }
19
28
  export declare class ServicePromotionCut extends CompanyCut {
20
29
  vendorCut?: number;
21
30
  secondaryVendorCut?: number;
@@ -9,9 +9,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ServiceCouponDetails = exports.ServiceDiscountCut = exports.ServicePromotionCut = exports.CouponDetails = exports.MarketingCut = exports.CompanyCut = void 0;
12
+ exports.ServiceCouponDetails = exports.ServiceDiscountCut = exports.ServicePromotionCut = exports.SpendToGetDetails = exports.CouponDetails = exports.MarketingCut = exports.CompanyCut = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const coupon_model_1 = require("../coupon.model");
15
+ const marketing_model_1 = require("../marketing.model");
15
16
  const enum_1 = require("../../../../utilities/enum");
16
17
  class CompanyCut {
17
18
  companyCut;
@@ -67,6 +68,39 @@ __decorate([
67
68
  (0, typegoose_1.prop)({ type: Number }),
68
69
  __metadata("design:type", Number)
69
70
  ], CouponDetails.prototype, "value", void 0);
71
+ class SpendToGetDetails extends MarketingCut {
72
+ marketing;
73
+ tierMinSpend;
74
+ rewardType;
75
+ rewardValue;
76
+ maxDiscountCap;
77
+ isMaxDiscountCapEnabled;
78
+ }
79
+ exports.SpendToGetDetails = SpendToGetDetails;
80
+ __decorate([
81
+ (0, typegoose_1.prop)({ ref: () => marketing_model_1.Marketing }),
82
+ __metadata("design:type", Object)
83
+ ], SpendToGetDetails.prototype, "marketing", void 0);
84
+ __decorate([
85
+ (0, typegoose_1.prop)({ type: Number }),
86
+ __metadata("design:type", Number)
87
+ ], SpendToGetDetails.prototype, "tierMinSpend", void 0);
88
+ __decorate([
89
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.SpendToGetRewardType }),
90
+ __metadata("design:type", String)
91
+ ], SpendToGetDetails.prototype, "rewardType", void 0);
92
+ __decorate([
93
+ (0, typegoose_1.prop)({ type: Number }),
94
+ __metadata("design:type", Number)
95
+ ], SpendToGetDetails.prototype, "rewardValue", void 0);
96
+ __decorate([
97
+ (0, typegoose_1.prop)({ type: Number }),
98
+ __metadata("design:type", Number)
99
+ ], SpendToGetDetails.prototype, "maxDiscountCap", void 0);
100
+ __decorate([
101
+ (0, typegoose_1.prop)({ type: Boolean, default: false }),
102
+ __metadata("design:type", Boolean)
103
+ ], SpendToGetDetails.prototype, "isMaxDiscountCapEnabled", void 0);
70
104
  class ServicePromotionCut extends CompanyCut {
71
105
  vendorCut;
72
106
  secondaryVendorCut;
@@ -1 +1 @@
1
- {"version":3,"file":"marketing-cut.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/marketing-cut.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,kDAAyC;AACzC,qDAAmE;AAEnE,MAAa,UAAU;IAEf,UAAU,CAAU;IAGpB,mBAAmB,CAAU;CACpC;AAND,gCAMC;AAJ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ADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;uDACX;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;uEACG;AAGpC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DACU","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { Coupon } from '../coupon.model';\nimport { CouponType, ValueType } from '../../../../utilities/enum';\n\nexport class CompanyCut {\n\t@prop({ type: Number, default: 0 })\n\tpublic companyCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryCompanyCut?: number;\n}\nexport class MarketingCut extends CompanyCut {\n\t@prop({ type: Number, default: 0 })\n\tpublic shopCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryShopCut?: number;\n}\n\nexport class CouponDetails extends MarketingCut {\n\t@prop({ ref: () => Coupon })\n\tpublic coupon?: Ref<Coupon>;\n\n\t@prop({ type: String, enum: CouponType })\n\tpublic couponType?: CouponType;\n\n\t@prop({ uppercase: true, trim: true, type: String })\n\tpublic code?: string;\n\n\t@prop({ type: String, enum: ValueType })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number })\n\tpublic value?: number;\n}\n\nexport class ServicePromotionCut extends CompanyCut {\n\t@prop({ type: Number, default: 0 })\n\tpublic vendorCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryVendorCut?: number;\n}\n\nexport class ServiceDiscountCut extends ServicePromotionCut {\n\t// It is also including company and vendor cut\n\t@prop({ type: Number, default: 0 })\n\tpublic slotDiscountCompanyCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondarySlotDiscountCompanyCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic slotDiscountVendorCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondarySlotDiscountVendorCut?: number;\n}\n\nexport class ServiceCouponDetails extends ServicePromotionCut {\n\t@prop({ ref: () => Coupon })\n\tpublic coupon?: Ref<Coupon>;\n\n\t@prop({ type: String, enum: CouponType })\n\tpublic couponType?: CouponType;\n\n\t@prop({ uppercase: true, trim: true, type: String })\n\tpublic code?: string;\n\n\t@prop({ type: String, enum: ValueType })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number })\n\tpublic value?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isMaxDiscountLimitEnabled?: boolean;\n\n\t@prop({ type: Number })\n\tpublic maxDiscountLimit?: number;\n}\n"]}
1
+ {"version":3,"file":"marketing-cut.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/marketing-cut.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,kDAAyC;AACzC,wDAA+C;AAC/C,qDAAyF;AAEzF,MAAa,UAAU;IAEf,UAAU,CAAU;IAGpB,mBAAmB,CAAU;CACpC;AAND,gCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8CACR;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACC;AAErC,MAAa,YAAa,SAAQ,UAAU;IAEpC,OAAO,CAAU;IAGjB,gBAAgB,CAAU;CACjC;AAND,oCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;6CACX;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;sDACF;AAGlC,MAAa,aAAc,SAAQ,YAAY;IAEv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M,EAAE,IAAI,EAAE,iBAAU,EAAE,CAAC;;wDACV;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAC/B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;uDACX;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;uEACG;AAGpC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8DACU","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { Coupon } from '../coupon.model';\nimport { Marketing } from '../marketing.model';\nimport { CouponType, SpendToGetRewardType, ValueType } from '../../../../utilities/enum';\n\nexport class CompanyCut {\n\t@prop({ type: Number, default: 0 })\n\tpublic companyCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryCompanyCut?: number;\n}\nexport class MarketingCut extends CompanyCut {\n\t@prop({ type: Number, default: 0 })\n\tpublic shopCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryShopCut?: number;\n}\n\nexport class CouponDetails extends MarketingCut {\n\t@prop({ ref: () => Coupon })\n\tpublic coupon?: Ref<Coupon>;\n\n\t@prop({ type: String, enum: CouponType })\n\tpublic couponType?: CouponType;\n\n\t@prop({ uppercase: true, trim: true, type: String })\n\tpublic code?: string;\n\n\t@prop({ type: String, enum: ValueType })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number })\n\tpublic value?: number;\n}\n\nexport class SpendToGetDetails extends MarketingCut {\n\t@prop({ ref: () => Marketing })\n\tpublic marketing?: Ref<Marketing>;\n\n\t@prop({ type: Number })\n\tpublic tierMinSpend?: number;\n\n\t@prop({ type: String, enum: SpendToGetRewardType })\n\tpublic rewardType?: SpendToGetRewardType;\n\n\t@prop({ type: Number })\n\tpublic rewardValue?: number;\n\n\t@prop({ type: Number })\n\tpublic maxDiscountCap?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isMaxDiscountCapEnabled?: boolean;\n}\n\nexport class ServicePromotionCut extends CompanyCut {\n\t@prop({ type: Number, default: 0 })\n\tpublic vendorCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryVendorCut?: number;\n}\n\nexport class ServiceDiscountCut extends ServicePromotionCut {\n\t// It is also including company and vendor cut\n\t@prop({ type: Number, default: 0 })\n\tpublic slotDiscountCompanyCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondarySlotDiscountCompanyCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic slotDiscountVendorCut?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondarySlotDiscountVendorCut?: number;\n}\n\nexport class ServiceCouponDetails extends ServicePromotionCut {\n\t@prop({ ref: () => Coupon })\n\tpublic coupon?: Ref<Coupon>;\n\n\t@prop({ type: String, enum: CouponType })\n\tpublic couponType?: CouponType;\n\n\t@prop({ uppercase: true, trim: true, type: String })\n\tpublic code?: string;\n\n\t@prop({ type: String, enum: ValueType })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number })\n\tpublic value?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isMaxDiscountLimitEnabled?: boolean;\n\n\t@prop({ type: Number })\n\tpublic maxDiscountLimit?: number;\n}\n"]}
@@ -29,4 +29,6 @@ export declare class RegularOrderPricing extends OrderPricing {
29
29
  secondaryPunchMarketingDiscount?: number;
30
30
  b1g1Discount?: number;
31
31
  secondaryB1g1Discount?: number;
32
+ spendToGetDiscount?: number;
33
+ secondarySpendToGetDiscount?: number;
32
34
  }
@@ -116,6 +116,8 @@ class RegularOrderPricing extends OrderPricing {
116
116
  secondaryPunchMarketingDiscount;
117
117
  b1g1Discount;
118
118
  secondaryB1g1Discount;
119
+ spendToGetDiscount;
120
+ secondarySpendToGetDiscount;
119
121
  }
120
122
  exports.RegularOrderPricing = RegularOrderPricing;
121
123
  __decorate([
@@ -150,4 +152,12 @@ __decorate([
150
152
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
151
153
  __metadata("design:type", Number)
152
154
  ], RegularOrderPricing.prototype, "secondaryB1g1Discount", void 0);
155
+ __decorate([
156
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
157
+ __metadata("design:type", Number)
158
+ ], RegularOrderPricing.prototype, "spendToGetDiscount", void 0);
159
+ __decorate([
160
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
161
+ __metadata("design:type", Number)
162
+ ], RegularOrderPricing.prototype, "secondarySpendToGetDiscount", void 0);
153
163
  //# sourceMappingURL=order-pricing.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"order-pricing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/order-pricing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,YAAY;IAEjB,QAAQ,CAAU;IAGlB,iBAAiB,CAAU;IAG3B,WAAW,CAAU;IAGrB,oBAAoB,CAAU;IAG9B,SAAS,CAAU;IAGnB,kBAAkB,CAAU;IAG5B,kBAAkB,CAAU;IAG5B,2BAA2B,CAAU;IAGrC,KAAK,CAAU;IAGf,cAAc,CAAU;IAGxB,MAAM,CAAU;IAGhB,eAAe,CAAU;IAGzB,aAAa,CAAU;IAGvB,sBAAsB,CAAU;IAGhC,UAAU,CAAU;IAGpB,mBAAmB,CAAU;CACpC;AAhDD,oCAgDC;AA9CO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8CACV;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,E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I,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4EACa;AAGzC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACN;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kEACG","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class OrderPricing {\n\t@prop({ type: Number, default: 0 })\n\tpublic subtotal?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondarySubtotal?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic deliveryFee?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryDeliveryFee?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic riderTips?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRiderTips?: number;\n\n\t@prop({ type: Number, default: 0 }) // negative wallet deduction\n\tpublic outstandingBalance?: number;\n\n\t@prop({ type: Number, default: 0 }) // negative wallet deduction\n\tpublic secondaryOutstandingBalance?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic total?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryTotal?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic wallet?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryWallet?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic reserveWallet?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReserveWallet?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic paidAmount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryPaidAmount?: number;\n}\n\nexport class CourierOrderPricing extends OrderPricing {\n\t// below field are only available for purchase and delivery order\n\t@prop({ type: Number, default: 0 })\n\tpublic initialItemTotal?: number; // This is initial subTotal,\n\t// updated item price in subTotal is stored in subTotal field after rider put amount\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryInitialItemTotal?: number;\n}\n\nexport class RegularOrderPricing extends OrderPricing {\n\t@prop({ type: Number, default: 0 })\n\tpublic discount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic couponDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryCouponDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic punchMarketingDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryPunchMarketingDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic b1g1Discount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryB1g1Discount?: number;\n}\n"]}
1
+ {"version":3,"file":"order-pricing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/order-pricing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,YAAY;IAEjB,QAAQ,CAAU;IAGlB,iBAAiB,CAAU;IAG3B,WAAW,CAAU;IAGrB,oBAAoB,CAAU;IAG9B,SAAS,CAAU;IAGnB,kBAAkB,CAAU;IAG5B,kBAAkB,CAAU;IAG5B,2BAA2B,CAAU;IAGrC,KAAK,CAAU;IAGf,cAAc,CAAU;IAGxB,MAAM,CAAU;IAGhB,eAAe,CAAU;IAGzB,aAAa,CAAU;IAGvB,sBAAsB,CAAU;IAGhC,UAAU,CAAU;IAGpB,mBAAmB,CAAU;CACpC;AAhDD,oCAgDC;AA9CO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8CACV;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACD;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,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AE,CAAC,EAAE,CAAC;;4EACa;AAGzC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACN;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kEACG;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+DACA;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;wEACS","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class OrderPricing {\n\t@prop({ type: Number, default: 0 })\n\tpublic subtotal?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondarySubtotal?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic deliveryFee?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryDeliveryFee?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic riderTips?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryRiderTips?: number;\n\n\t@prop({ type: Number, default: 0 }) // negative wallet deduction\n\tpublic outstandingBalance?: number;\n\n\t@prop({ type: Number, default: 0 }) // negative wallet deduction\n\tpublic secondaryOutstandingBalance?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic total?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryTotal?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic wallet?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryWallet?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic reserveWallet?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryReserveWallet?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic paidAmount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryPaidAmount?: number;\n}\n\nexport class CourierOrderPricing extends OrderPricing {\n\t// below field are only available for purchase and delivery order\n\t@prop({ type: Number, default: 0 })\n\tpublic initialItemTotal?: number; // This is initial subTotal,\n\t// updated item price in subTotal is stored in subTotal field after rider put amount\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryInitialItemTotal?: number;\n}\n\nexport class RegularOrderPricing extends OrderPricing {\n\t@prop({ type: Number, default: 0 })\n\tpublic discount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic couponDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryCouponDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic punchMarketingDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryPunchMarketingDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic b1g1Discount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryB1g1Discount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic spendToGetDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondarySpendToGetDiscount?: number;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { OrderFinance } from './order-finance.model';
2
2
  import { RegularOrderProfit } from '../embedded/profit.model';
3
3
  import { Vat } from '../embedded/vat.model';
4
- import { CouponDetails, MarketingCut } from '../embedded/marketing-cut.model';
4
+ import { CouponDetails, MarketingCut, SpendToGetDetails } from '../embedded/marketing-cut.model';
5
5
  import { RegularOrderPricing } from './order-pricing.model';
6
6
  import { Cashback } from './cashback-amounts.model';
7
7
  export declare class RegularOrderFinance extends OrderFinance {
@@ -13,5 +13,6 @@ export declare class RegularOrderFinance extends OrderFinance {
13
13
  buy1get1?: MarketingCut;
14
14
  coupon?: CouponDetails;
15
15
  freeDelivery?: MarketingCut;
16
+ spendToGet?: SpendToGetDetails;
16
17
  cashBackAmounts?: Cashback;
17
18
  }
@@ -26,6 +26,7 @@ class RegularOrderFinance extends order_finance_model_1.OrderFinance {
26
26
  buy1get1;
27
27
  coupon;
28
28
  freeDelivery;
29
+ spendToGet;
29
30
  cashBackAmounts;
30
31
  }
31
32
  exports.RegularOrderFinance = RegularOrderFinance;
@@ -61,6 +62,10 @@ __decorate([
61
62
  (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.MarketingCut }),
62
63
  __metadata("design:type", marketing_cut_model_1.MarketingCut)
63
64
  ], RegularOrderFinance.prototype, "freeDelivery", void 0);
65
+ __decorate([
66
+ (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.SpendToGetDetails }),
67
+ __metadata("design:type", marketing_cut_model_1.SpendToGetDetails)
68
+ ], RegularOrderFinance.prototype, "spendToGet", void 0);
64
69
  __decorate([
65
70
  (0, typegoose_1.prop)({ type: () => cashback_amounts_model_1.Cashback }),
66
71
  __metadata("design:type", cashback_amounts_model_1.Cashback)
@@ -1 +1 @@
1
- {"version":3,"file":"regular-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/regular-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,+DAAqD;AACrD,2DAA8D;AAC9D,qDAA4C;AAC5C,yEAA8E;AAC9E,+DAA4D;AAC5D,qEAAoD;AAEpD,MAAa,mBAAoB,SAAQ,kCAAY;IAE7C,OAAO,CAAuB;IAG9B,aAAa,CAAsB;IAGnC,UAAU,CAAsB;IAGhC,GAAG,CAAO;IAGV,QAAQ,CAAgB;IAGxB,QAAQ,CAAgB;IAGxB,MAAM,CAAiB;IAGvB,YAAY,CAAgB;IAG5B,eAAe,CAAY;CAClC;AA3BD,kDA2BC;AAzBO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,yCAAmB,EAAE,CAAC;8BACzC,yCAAmB;oDAAC;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAkB,EAAE,CAAC;8BAClB,iCAAkB;0DAAC;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAkB,EAAE,CAAC;8BACrB,iCAAkB;uDAAC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,eAAG,EAAE,CAAC;8BACb,eAAG;gDAAC;AAGV;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACjB,kCAAY;qDAAC;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACjB,kCAAY;qDAAC;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,mCAAa,EAAE,CAAC;8BACpB,mCAAa;mDAAC;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACb,kCAAY;yDAAC;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAQ,EAAE,CAAC;8BACN,iCAAQ;4DAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { OrderFinance } from './order-finance.model';\nimport { RegularOrderProfit } from '../embedded/profit.model';\nimport { Vat } from '../embedded/vat.model';\nimport { CouponDetails, MarketingCut } from '../embedded/marketing-cut.model';\nimport { RegularOrderPricing } from './order-pricing.model';\nimport { Cashback } from './cashback-amounts.model';\n\nexport class RegularOrderFinance extends OrderFinance {\n\t@prop({ required: true, type: () => RegularOrderPricing })\n\tpublic pricing!: RegularOrderPricing;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic companyProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic shopProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => Vat })\n\tpublic vat?: Vat;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic discount?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic buy1get1?: MarketingCut;\n\n\t@prop({ type: () => CouponDetails })\n\tpublic coupon?: CouponDetails;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic freeDelivery?: MarketingCut;\n\n\t@prop({ type: () => Cashback })\n\tpublic cashBackAmounts?: Cashback;\n}\n"]}
1
+ {"version":3,"file":"regular-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/regular-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,+DAAqD;AACrD,2DAA8D;AAC9D,qDAA4C;AAC5C,yEAAiG;AACjG,+DAA4D;AAC5D,qEAAoD;AAEpD,MAAa,mBAAoB,SAAQ,kCAAY;IAE7C,OAAO,CAAuB;IAG9B,aAAa,CAAsB;IAGnC,UAAU,CAAsB;IAGhC,GAAG,CAAO;IAGV,QAAQ,CAAgB;IAGxB,QAAQ,CAAgB;IAGxB,MAAM,CAAiB;IAGvB,YAAY,CAAgB;IAG5B,UAAU,CAAqB;IAG/B,eAAe,CAAY;CAClC;AA9BD,kDA8BC;AA5BO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,yCAAmB,EAAE,CAAC;8BACzC,yCAAmB;oDAAC;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAkB,EAAE,CAAC;8BAClB,iCAAkB;0DAAC;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAkB,EAAE,CAAC;8BACrB,iCAAkB;uDAAC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,eAAG,EAAE,CAAC;8BACb,eAAG;gDAAC;AAGV;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACjB,kCAAY;qDAAC;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACjB,kCAAY;qDAAC;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,mCAAa,EAAE,CAAC;8BACpB,mCAAa;mDAAC;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;8BACb,kCAAY;yDAAC;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,uCAAiB,EAAE,CAAC;8BACpB,uCAAiB;uDAAC;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iCAAQ,EAAE,CAAC;8BACN,iCAAQ;4DAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { OrderFinance } from './order-finance.model';\nimport { RegularOrderProfit } from '../embedded/profit.model';\nimport { Vat } from '../embedded/vat.model';\nimport { CouponDetails, MarketingCut, SpendToGetDetails } from '../embedded/marketing-cut.model';\nimport { RegularOrderPricing } from './order-pricing.model';\nimport { Cashback } from './cashback-amounts.model';\n\nexport class RegularOrderFinance extends OrderFinance {\n\t@prop({ required: true, type: () => RegularOrderPricing })\n\tpublic pricing!: RegularOrderPricing;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic companyProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => RegularOrderProfit })\n\tpublic shopProfit?: RegularOrderProfit;\n\n\t@prop({ type: () => Vat })\n\tpublic vat?: Vat;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic discount?: MarketingCut;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic buy1get1?: MarketingCut;\n\n\t@prop({ type: () => CouponDetails })\n\tpublic coupon?: CouponDetails;\n\n\t@prop({ type: () => MarketingCut })\n\tpublic freeDelivery?: MarketingCut;\n\n\t@prop({ type: () => SpendToGetDetails })\n\tpublic spendToGet?: SpendToGetDetails;\n\n\t@prop({ type: () => Cashback })\n\tpublic cashBackAmounts?: Cashback;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { SpendToGetRewardType } from '../../../../utilities/enum';
2
+ export declare class SpendToGetTier {
3
+ minSpend: number;
4
+ rewardType: SpendToGetRewardType;
5
+ rewardValue?: number;
6
+ maxDiscountCap?: number;
7
+ isMaxDiscountCapEnabled?: boolean;
8
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SpendToGetTier = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ const enum_1 = require("../../../../utilities/enum");
15
+ class SpendToGetTier {
16
+ minSpend;
17
+ rewardType;
18
+ rewardValue;
19
+ maxDiscountCap;
20
+ isMaxDiscountCapEnabled;
21
+ }
22
+ exports.SpendToGetTier = SpendToGetTier;
23
+ __decorate([
24
+ (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
25
+ __metadata("design:type", Number)
26
+ ], SpendToGetTier.prototype, "minSpend", void 0);
27
+ __decorate([
28
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.SpendToGetRewardType }),
29
+ __metadata("design:type", String)
30
+ ], SpendToGetTier.prototype, "rewardType", void 0);
31
+ __decorate([
32
+ (0, typegoose_1.prop)({ type: Number }),
33
+ __metadata("design:type", Number)
34
+ ], SpendToGetTier.prototype, "rewardValue", void 0);
35
+ __decorate([
36
+ (0, typegoose_1.prop)({ type: Number }),
37
+ __metadata("design:type", Number)
38
+ ], SpendToGetTier.prototype, "maxDiscountCap", void 0);
39
+ __decorate([
40
+ (0, typegoose_1.prop)({ type: Boolean, default: false }),
41
+ __metadata("design:type", Boolean)
42
+ ], SpendToGetTier.prototype, "isMaxDiscountCapEnabled", void 0);
43
+ //# sourceMappingURL=spend-to-get-tier.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spend-to-get-tier.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/spend-to-get-tier.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAkE;AAElE,MAAa,cAAc;IAEnB,QAAQ,CAAU;IAGlB,UAAU,CAAwB;IAGlC,WAAW,CAAU;IAGrB,cAAc,CAAU;IAGxB,uBAAuB,CAAW;CACzC;AAfD,wCAeC;AAbO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;gDACtB;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,2BAAoB,EAAE,CAAC;;kDAC1B;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACK;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDACQ;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;+DACC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { SpendToGetRewardType } from '../../../../utilities/enum';\n\nexport class SpendToGetTier {\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic minSpend!: number;\n\n\t@prop({ required: true, type: String, enum: SpendToGetRewardType })\n\tpublic rewardType!: SpendToGetRewardType;\n\n\t@prop({ type: Number })\n\tpublic rewardValue?: number;\n\n\t@prop({ type: Number })\n\tpublic maxDiscountCap?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isMaxDiscountCapEnabled?: boolean;\n}\n"]}
@@ -29,6 +29,7 @@ import { Parent } from './parent.model';
29
29
  import { ProductMarketing } from './product-marketing.model';
30
30
  import { Product } from './product.model';
31
31
  import { PunchMarketingHistory } from './punch-marketing-history.model';
32
+ import { SpendToGetHistory } from './spend-to-get-history.model';
32
33
  import { RatingSetting } from './rating-setting.model';
33
34
  import { ReferralSetting } from './referral-setting.model';
34
35
  import { RequestArea } from './request-area.model';
@@ -51,6 +52,7 @@ import { GlobalCoupon } from './providers/global-coupon.model';
51
52
  import { IndividualStoreCoupon } from './providers/individual-store-coupon.model';
52
53
  import { IndividualUserCoupon } from './providers/individual-user-coupon.model';
53
54
  import { PunchMarketing } from './providers/punch-marketing.model';
55
+ import { SpendToGetMarketing } from './providers/spend-to-get-marketing.model';
54
56
  import { ReferralCodeCoupon } from './providers/referral-code-coupon.model';
55
57
  import { ReferralRewardCoupon } from './providers/referral-reward-coupon.model';
56
58
  import { Notification } from './notification.model';
@@ -222,12 +224,14 @@ export declare const DiscountMarketingModel: ReturnModelType<typeof DiscountMark
222
224
  export declare const FeaturedMarketingModel: ReturnModelType<typeof FeaturedMarketing>;
223
225
  export declare const FreeDeliveryMarketingModel: ReturnModelType<typeof FreeDeliveryMarketing>;
224
226
  export declare const PunchMarketingModel: ReturnModelType<typeof PunchMarketing>;
227
+ export declare const SpendToGetMarketingModel: ReturnModelType<typeof SpendToGetMarketing>;
225
228
  export * from './marketing.model';
226
229
  export * from './providers/buy1-get1-marketing.model';
227
230
  export * from './providers/discount-marketing.model';
228
231
  export * from './providers/featured-marketing.model';
229
232
  export * from './providers/free-delivery-marketing.model';
230
233
  export * from './providers/punch-marketing.model';
234
+ export * from './providers/spend-to-get-marketing.model';
231
235
  export declare const MealPlanModel: ReturnModelType<typeof MealPlan>;
232
236
  export * from './meal-plan.model';
233
237
  export declare const NotificationModel: ReturnModelType<typeof Notification>;
@@ -262,6 +266,8 @@ export declare const ProductUploadModel: ReturnModelType<typeof ProductUpload>;
262
266
  export * from './product-upload.model';
263
267
  export declare const PunchMarketingHistoryModel: ReturnModelType<typeof PunchMarketingHistory>;
264
268
  export * from './punch-marketing-history.model';
269
+ export declare const SpendToGetHistoryModel: ReturnModelType<typeof SpendToGetHistory>;
270
+ export * from './spend-to-get-history.model';
265
271
  export declare const RatingSettingModel: ReturnModelType<typeof RatingSetting>;
266
272
  export * from './rating-setting.model';
267
273
  export declare const ReferralSettingModel: ReturnModelType<typeof ReferralSetting>;
@@ -14,9 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.RegularOrderModel = exports.OrderModel = exports.NutritionModel = exports.NotificationModel = exports.MealPlanModel = exports.PunchMarketingModel = exports.FreeDeliveryMarketingModel = exports.FeaturedMarketingModel = exports.DiscountMarketingModel = exports.Buy1Get1MarketingModel = exports.MarketingModel = exports.ListContainerModel = exports.LineItemModel = exports.GalleryUploadModel = exports.GalleryModel = exports.FlagModel = exports.FinanceSettlementModel = exports.FilterContainerModel = exports.FeaturedSettingModel = exports.FavouriteModel = exports.DishModel = exports.LimitedTimeOfferParticipantModel = exports.LimitedTimeOfferConfigModel = exports.LimitedTimeOfferCampaignSessionModel = exports.LimitedTimeOfferCampaignModel = exports.DealSettingModel = exports.ReferralRewardCouponModel = exports.ReferralCodeCouponModel = exports.IndividualUserCouponModel = exports.IndividualStoreCouponModel = exports.ShopsCategoriesCouponModel = exports.GlobalCouponModel = exports.CustomCouponModel = exports.BaseCouponModel = exports.CouponModel = exports.CounterModel = exports.CategoryModel = exports.CartParticipantModel = exports.CartModel = exports.UserActionModel = exports.ServiceControlModel = exports.AppAppearanceModel = exports.BrandModel = exports.BOBFinanceModel = exports.BannerModel = exports.AttributeModel = exports.UserAppSectionSettingModel = exports.AdminModel = exports.AdminAccessControlModel = exports.ActivityLogModel = void 0;
18
- exports.ServicePackageModel = exports.ServiceAddonModel = exports.ServiceCategoryModel = exports.VendorAccessControlModel = exports.VendorModel = exports.VendorParentModel = exports.ServiceModel = exports.ChatroomModel = exports.AgentPerformanceModel = exports.MessageModel = exports.TicketModel = exports.RewardModel = exports.CancellationReasonModel = exports.SupportReasonModel = exports.TermsAndConditionsModel = exports.DefaultChatModel = exports.DeliveryChargesModel = exports.ZoneModel = exports.UserModel = exports.TagModel = exports.SubscriptionModel = exports.ShopModel = exports.ShopSectionModel = exports.ShopMealPlanModel = exports.ShopCategoryModel = exports.ShopAccessControlModel = exports.SettingModel = exports.RiderModel = exports.RiderTrackingModel = exports.RiderTimeoutModel = exports.ServicePackageReviewModel = exports.VendorReviewModel = exports.RiderReviewModel = exports.ShopReviewModel = exports.ReviewModel = exports.RequestAreaModel = exports.ReferralSettingModel = exports.RatingSettingModel = exports.PunchMarketingHistoryModel = exports.ProductUploadModel = exports.ProductModel = exports.ProductStockTrackerModel = exports.ProductMarketingModel = exports.VendorPayoutModel = exports.RiderPayoutModel = exports.ShopPayoutModel = exports.PayoutModel = exports.ParentModel = exports.ShopCourierOrderModel = exports.CourierOrderModel = void 0;
19
- exports.ProductBrandModel = exports.TournamentParticipantModel = exports.TournamentModel = exports.BookingCancellationReschedulingRuleModel = exports.IntegrationConfigurationModel = exports.ServiceFlagModel = exports.PaymentConfigurationModel = exports.AppInstanceModel = exports.ZoneExtraTimeModel = exports.LoggerModel = exports.ServicePromotionModel = exports.TicketActionModel = exports.ProfessionalBlockedTimeModel = exports.ServiceBookingModel = exports.ServiceCartModel = exports.ProfessionalModel = void 0;
17
+ exports.OrderModel = exports.NutritionModel = exports.NotificationModel = exports.MealPlanModel = exports.SpendToGetMarketingModel = exports.PunchMarketingModel = exports.FreeDeliveryMarketingModel = exports.FeaturedMarketingModel = exports.DiscountMarketingModel = exports.Buy1Get1MarketingModel = exports.MarketingModel = exports.ListContainerModel = exports.LineItemModel = exports.GalleryUploadModel = exports.GalleryModel = exports.FlagModel = exports.FinanceSettlementModel = exports.FilterContainerModel = exports.FeaturedSettingModel = exports.FavouriteModel = exports.DishModel = exports.LimitedTimeOfferParticipantModel = exports.LimitedTimeOfferConfigModel = exports.LimitedTimeOfferCampaignSessionModel = exports.LimitedTimeOfferCampaignModel = exports.DealSettingModel = exports.ReferralRewardCouponModel = exports.ReferralCodeCouponModel = exports.IndividualUserCouponModel = exports.IndividualStoreCouponModel = exports.ShopsCategoriesCouponModel = exports.GlobalCouponModel = exports.CustomCouponModel = exports.BaseCouponModel = exports.CouponModel = exports.CounterModel = exports.CategoryModel = exports.CartParticipantModel = exports.CartModel = exports.UserActionModel = exports.ServiceControlModel = exports.AppAppearanceModel = exports.BrandModel = exports.BOBFinanceModel = exports.BannerModel = exports.AttributeModel = exports.UserAppSectionSettingModel = exports.AdminModel = exports.AdminAccessControlModel = exports.ActivityLogModel = void 0;
18
+ exports.ServiceCategoryModel = exports.VendorAccessControlModel = exports.VendorModel = exports.VendorParentModel = exports.ServiceModel = exports.ChatroomModel = exports.AgentPerformanceModel = exports.MessageModel = exports.TicketModel = exports.RewardModel = exports.CancellationReasonModel = exports.SupportReasonModel = exports.TermsAndConditionsModel = exports.DefaultChatModel = exports.DeliveryChargesModel = exports.ZoneModel = exports.UserModel = exports.TagModel = exports.SubscriptionModel = exports.ShopModel = exports.ShopSectionModel = exports.ShopMealPlanModel = exports.ShopCategoryModel = exports.ShopAccessControlModel = exports.SettingModel = exports.RiderModel = exports.RiderTrackingModel = exports.RiderTimeoutModel = exports.ServicePackageReviewModel = exports.VendorReviewModel = exports.RiderReviewModel = exports.ShopReviewModel = exports.ReviewModel = exports.RequestAreaModel = exports.ReferralSettingModel = exports.RatingSettingModel = exports.SpendToGetHistoryModel = exports.PunchMarketingHistoryModel = exports.ProductUploadModel = exports.ProductModel = exports.ProductStockTrackerModel = exports.ProductMarketingModel = exports.VendorPayoutModel = exports.RiderPayoutModel = exports.ShopPayoutModel = exports.PayoutModel = exports.ParentModel = exports.ShopCourierOrderModel = exports.CourierOrderModel = exports.RegularOrderModel = void 0;
19
+ exports.ProductBrandModel = exports.TournamentParticipantModel = exports.TournamentModel = exports.BookingCancellationReschedulingRuleModel = exports.IntegrationConfigurationModel = exports.ServiceFlagModel = exports.PaymentConfigurationModel = exports.AppInstanceModel = exports.ZoneExtraTimeModel = exports.LoggerModel = exports.ServicePromotionModel = exports.TicketActionModel = exports.ProfessionalBlockedTimeModel = exports.ServiceBookingModel = exports.ServiceCartModel = exports.ProfessionalModel = exports.ServicePackageModel = exports.ServiceAddonModel = void 0;
20
20
  exports.getCoreAuthIdentityModel = getCoreAuthIdentityModel;
21
21
  exports.getCoreEmailAuthIdentityModel = getCoreEmailAuthIdentityModel;
22
22
  exports.getCorePhoneAuthIdentityModel = getCorePhoneAuthIdentityModel;
@@ -58,6 +58,7 @@ const parent_model_1 = require("./parent.model");
58
58
  const product_marketing_model_1 = require("./product-marketing.model");
59
59
  const product_model_1 = require("./product.model");
60
60
  const punch_marketing_history_model_1 = require("./punch-marketing-history.model");
61
+ const spend_to_get_history_model_1 = require("./spend-to-get-history.model");
61
62
  const rating_setting_model_1 = require("./rating-setting.model");
62
63
  const referral_setting_model_1 = require("./referral-setting.model");
63
64
  const request_area_model_1 = require("./request-area.model");
@@ -81,6 +82,7 @@ const global_coupon_model_1 = require("./providers/global-coupon.model");
81
82
  const individual_store_coupon_model_1 = require("./providers/individual-store-coupon.model");
82
83
  const individual_user_coupon_model_1 = require("./providers/individual-user-coupon.model");
83
84
  const punch_marketing_model_1 = require("./providers/punch-marketing.model");
85
+ const spend_to_get_marketing_model_1 = require("./providers/spend-to-get-marketing.model");
84
86
  const referral_code_coupon_model_1 = require("./providers/referral-code-coupon.model");
85
87
  const referral_reward_coupon_model_1 = require("./providers/referral-reward-coupon.model");
86
88
  const notification_model_1 = require("./notification.model");
@@ -305,12 +307,14 @@ exports.DiscountMarketingModel = (0, typegoose_1.getDiscriminatorModelForClass)(
305
307
  exports.FeaturedMarketingModel = (0, typegoose_1.getDiscriminatorModelForClass)(exports.MarketingModel, featured_marketing_model_1.FeaturedMarketing, enum_1.MarketingType.FEATURED);
306
308
  exports.FreeDeliveryMarketingModel = (0, typegoose_1.getDiscriminatorModelForClass)(exports.MarketingModel, free_delivery_marketing_model_1.FreeDeliveryMarketing, enum_1.MarketingType.FREE_DELIVERY);
307
309
  exports.PunchMarketingModel = (0, typegoose_1.getDiscriminatorModelForClass)(exports.MarketingModel, punch_marketing_model_1.PunchMarketing, enum_1.MarketingType.PUNCH_MARKETING);
310
+ exports.SpendToGetMarketingModel = (0, typegoose_1.getDiscriminatorModelForClass)(exports.MarketingModel, spend_to_get_marketing_model_1.SpendToGetMarketing, enum_1.MarketingType.SPEND_TO_GET);
308
311
  __exportStar(require("./marketing.model"), exports);
309
312
  __exportStar(require("./providers/buy1-get1-marketing.model"), exports);
310
313
  __exportStar(require("./providers/discount-marketing.model"), exports);
311
314
  __exportStar(require("./providers/featured-marketing.model"), exports);
312
315
  __exportStar(require("./providers/free-delivery-marketing.model"), exports);
313
316
  __exportStar(require("./providers/punch-marketing.model"), exports);
317
+ __exportStar(require("./providers/spend-to-get-marketing.model"), exports);
314
318
  exports.MealPlanModel = (0, typegoose_1.getModelForClass)(meal_plan_model_1.MealPlan);
315
319
  __exportStar(require("./meal-plan.model"), exports);
316
320
  exports.NotificationModel = (0, typegoose_1.getModelForClass)(notification_model_1.Notification);
@@ -349,6 +353,8 @@ exports.ProductUploadModel = (0, typegoose_1.getModelForClass)(product_upload_mo
349
353
  __exportStar(require("./product-upload.model"), exports);
350
354
  exports.PunchMarketingHistoryModel = (0, typegoose_1.getModelForClass)(punch_marketing_history_model_1.PunchMarketingHistory);
351
355
  __exportStar(require("./punch-marketing-history.model"), exports);
356
+ exports.SpendToGetHistoryModel = (0, typegoose_1.getModelForClass)(spend_to_get_history_model_1.SpendToGetHistory);
357
+ __exportStar(require("./spend-to-get-history.model"), exports);
352
358
  exports.RatingSettingModel = (0, typegoose_1.getModelForClass)(rating_setting_model_1.RatingSetting);
353
359
  __exportStar(require("./rating-setting.model"), exports);
354
360
  exports.ReferralSettingModel = (0, typegoose_1.getModelForClass)(referral_setting_model_1.ReferralSetting);