@lyxa.ai/core 1.3.260 → 1.3.262

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 (63) hide show
  1. package/dist/libraries/event/events/punch-marketing/sync-user-shop-punch-marketing-history-event.d.ts +2 -2
  2. package/dist/libraries/event/events/sync-order-again-sections-for-shop-event.d.ts +2 -2
  3. package/dist/libraries/firebase/fcmService.js +7 -7
  4. package/dist/libraries/firebase/fcmService.js.map +1 -1
  5. package/dist/libraries/mongo/models/embedded/profit.model.js.map +1 -1
  6. package/dist/libraries/mongo/models/embedded/service-line-item.model.d.ts +23 -0
  7. package/dist/libraries/mongo/models/embedded/service-line-item.model.js +95 -0
  8. package/dist/libraries/mongo/models/embedded/service-line-item.model.js.map +1 -0
  9. package/dist/libraries/mongo/models/embedded/service-order-cance.model.d.ts +1 -1
  10. package/dist/libraries/mongo/models/embedded/service-order-cance.model.js +1 -5
  11. package/dist/libraries/mongo/models/embedded/service-order-cance.model.js.map +1 -1
  12. package/dist/libraries/mongo/models/embedded/service-order-finance.model.d.ts +6 -7
  13. package/dist/libraries/mongo/models/embedded/service-order-finance.model.js +17 -18
  14. package/dist/libraries/mongo/models/embedded/service-order-finance.model.js.map +1 -1
  15. package/dist/libraries/mongo/models/embedded/service-order-flag.model.d.ts +4 -4
  16. package/dist/libraries/mongo/models/embedded/service-order-flag.model.js +12 -7
  17. package/dist/libraries/mongo/models/embedded/service-order-flag.model.js.map +1 -1
  18. package/dist/libraries/mongo/models/embedded/service-order-pricing.model.d.ts +9 -5
  19. package/dist/libraries/mongo/models/embedded/service-order-pricing.model.js +30 -10
  20. package/dist/libraries/mongo/models/embedded/service-order-pricing.model.js.map +1 -1
  21. package/dist/libraries/mongo/models/embedded/status-timeline.model.d.ts +3 -3
  22. package/dist/libraries/mongo/models/embedded/status-timeline.model.js +2 -9
  23. package/dist/libraries/mongo/models/embedded/status-timeline.model.js.map +1 -1
  24. package/dist/libraries/mongo/models/index.d.ts +0 -3
  25. package/dist/libraries/mongo/models/index.js +1 -5
  26. package/dist/libraries/mongo/models/index.js.map +1 -1
  27. package/dist/libraries/mongo/models/service-addon.model.js +3 -3
  28. package/dist/libraries/mongo/models/service-addon.model.js.map +1 -1
  29. package/dist/libraries/mongo/models/service-cart.model.d.ts +6 -11
  30. package/dist/libraries/mongo/models/service-cart.model.js +15 -56
  31. package/dist/libraries/mongo/models/service-cart.model.js.map +1 -1
  32. package/dist/libraries/mongo/models/service-order.model.d.ts +33 -33
  33. package/dist/libraries/mongo/models/service-order.model.js +86 -89
  34. package/dist/libraries/mongo/models/service-order.model.js.map +1 -1
  35. package/dist/libraries/mongo/models/service-package.model.js +1 -1
  36. package/dist/libraries/mongo/models/service-package.model.js.map +1 -1
  37. package/dist/libraries/mongo/models/service-promotion.model.d.ts +7 -5
  38. package/dist/libraries/mongo/models/service-promotion.model.js +30 -24
  39. package/dist/libraries/mongo/models/service-promotion.model.js.map +1 -1
  40. package/dist/libraries/mongo/models/shared/duration.model.d.ts +10 -0
  41. package/dist/libraries/mongo/models/shared/duration.model.js +34 -2
  42. package/dist/libraries/mongo/models/shared/duration.model.js.map +1 -1
  43. package/dist/libraries/socket/events/order-actions.socket.event.d.ts +4 -4
  44. package/dist/types/README.md +1 -1
  45. package/dist/types/package.json +1 -1
  46. package/dist/types/utilities/enum.d.ts +5 -5
  47. package/dist/types/utilities/enum.js +6 -5
  48. package/dist/types/utilities/enum.js.map +1 -1
  49. package/dist/utilities/app-instance.js +1 -1
  50. package/dist/utilities/app-instance.js.map +1 -1
  51. package/dist/utilities/enum.d.ts +5 -5
  52. package/dist/utilities/enum.js +6 -5
  53. package/dist/utilities/enum.js.map +1 -1
  54. package/package.json +1 -1
  55. package/dist/libraries/mongo/models/embedded/service-timer.model.d.ts +0 -5
  56. package/dist/libraries/mongo/models/embedded/service-timer.model.js +0 -32
  57. package/dist/libraries/mongo/models/embedded/service-timer.model.js.map +0 -1
  58. package/dist/libraries/mongo/models/service-line-item.model.d.ts +0 -19
  59. package/dist/libraries/mongo/models/service-line-item.model.js +0 -89
  60. package/dist/libraries/mongo/models/service-line-item.model.js.map +0 -1
  61. package/dist/libraries/mongo/models/shared/promotion-duration.model.d.ts +0 -11
  62. package/dist/libraries/mongo/models/shared/promotion-duration.model.js +0 -46
  63. package/dist/libraries/mongo/models/shared/promotion-duration.model.js.map +0 -1
@@ -6,12 +6,12 @@ declare const SyncUserShopPunchMarketingHistoryInCacheValidationSchema: import("
6
6
  shopId: 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>]>;
7
7
  operation: import("zod").ZodNativeEnum<typeof ChangeStreamOperationTypes>;
8
8
  }, "strict", import("zod").ZodTypeAny, {
9
- userId: import("mongoose").Types.ObjectId;
10
9
  shopId: import("mongoose").Types.ObjectId;
10
+ userId: import("mongoose").Types.ObjectId;
11
11
  operation: ChangeStreamOperationTypes;
12
12
  }, {
13
- userId: string | import("mongoose").Types.ObjectId;
14
13
  shopId: string | import("mongoose").Types.ObjectId;
14
+ userId: string | import("mongoose").Types.ObjectId;
15
15
  operation: ChangeStreamOperationTypes;
16
16
  }>;
17
17
  export type SyncUserShopPunchMarketingHistoryInCacheValidationDTO = DTO<typeof SyncUserShopPunchMarketingHistoryInCacheValidationSchema>;
@@ -4,11 +4,11 @@ declare const SyncSingleShopValidationSchema: import("zod").ZodObject<{
4
4
  userId: 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
5
  shopId: 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>]>;
6
6
  }, "strict", import("zod").ZodTypeAny, {
7
- userId: import("mongoose").Types.ObjectId;
8
7
  shopId: import("mongoose").Types.ObjectId;
8
+ userId: import("mongoose").Types.ObjectId;
9
9
  }, {
10
- userId: string | import("mongoose").Types.ObjectId;
11
10
  shopId: string | import("mongoose").Types.ObjectId;
11
+ userId: string | import("mongoose").Types.ObjectId;
12
12
  }>;
13
13
  export type SyncSingleShopOrderAgainCacheDTO = DTO<typeof SyncSingleShopValidationSchema>;
14
14
  export declare class SyncSingleShopOrderAgainInCacheEvent extends BaseEvent<Record<string, unknown>> {
@@ -17,16 +17,16 @@ const typedi_1 = require("typedi");
17
17
  const enum_1 = require("../../utilities/enum");
18
18
  const NotificationVersionRules = {
19
19
  [enum_1.AuthEntityType.DELIVERY_BOY]: {
20
- [enum_1.AppPlatform.IOS]: '1.0.4',
21
- [enum_1.AppPlatform.ANDROID]: '1.2.1',
20
+ [enum_1.AppPlatform.IOS]: '2.0.3',
21
+ [enum_1.AppPlatform.ANDROID]: '2.0.4',
22
22
  },
23
23
  [enum_1.AuthEntityType.USER]: {
24
- [enum_1.AppPlatform.IOS]: '1.0.2',
25
- [enum_1.AppPlatform.ANDROID]: '1.1.3',
24
+ [enum_1.AppPlatform.IOS]: '2.0.3',
25
+ [enum_1.AppPlatform.ANDROID]: '2.0.3',
26
26
  },
27
27
  [enum_1.AuthEntityType.SELLER]: {
28
- [enum_1.AppPlatform.IOS]: '1.1.0',
29
- [enum_1.AppPlatform.ANDROID]: '1.0.9',
28
+ [enum_1.AppPlatform.IOS]: '2.0.3',
29
+ [enum_1.AppPlatform.ANDROID]: '2.0.3',
30
30
  },
31
31
  };
32
32
  exports.FCMServiceForUser = 'fcm.service.user';
@@ -68,7 +68,7 @@ let FCMService = class FCMService {
68
68
  const minVersion = NotificationVersionRules?.[entityType]?.[platform];
69
69
  if (!minVersion)
70
70
  return false;
71
- return this.compareVersions(version, minVersion) >= 0;
71
+ return this.compareVersions(version, minVersion) > 0;
72
72
  }
73
73
  buildMessage(payload, batchTokens) {
74
74
  const isInvisible = payload.invisible === true;
@@ -1 +1 @@
1
- {"version":3,"file":"fcmService.js","sourceRoot":"/","sources":["libraries/firebase/fcmService.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA2C;AAC3C,6BAAqC;AACrC,mCAAiC;AAEjC,+CAAmE;AAoBnE,MAAM,wBAAwB,GAAuE;IACpG,CAAC,qBAAc,CAAC,YAAY,CAAC,EAAE;QAC9B,CAAC,kBAAW,CAAC,GAAG,CAAC,EAAE,OAAO;QAC1B,CAAC,kBAAW,CAAC,OAAO,CAAC,EAAE,OAAO;KAC9B;IAED,CAAC,qBAAc,CAAC,IAAI,CAAC,EAAE;QACtB,CAAC,kBAAW,CAAC,GAAG,CAAC,EAAE,OAAO;QAC1B,CAAC,kBAAW,CAAC,OAAO,CAAC,EAAE,OAAO;KAC9B;IAED,CAAC,qBAAc,CAAC,MAAM,CAAC,EAAE;QACxB,CAAC,kBAAW,CAAC,GAAG,CAAC,EAAE,OAAO;QAC1B,CAAC,kBAAW,CAAC,OAAO,CAAC,EAAE,OAAO;KAC9B;CACD,CAAC;AAEW,QAAA,iBAAiB,GAAG,kBAAkB,CAAC;AACvC,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AACzC,QAAA,iBAAiB,GAAG,kBAAkB,CAAC;AAG7C,IAAM,UAAU,GAAhB,MAAM,UAAU;;IACd,SAAS,CAAuB;IAChC,MAAM,CAAU,SAAS,GAAG,GAAG,CAAC;IAExC,YAAY,GAAS;QACpB,MAAM,WAAW,GAAG,GAAG,IAAI,IAAA,gBAAY,GAAE,CAAC,kBAAkB,EAAE,CAAC,QAAQ,CAAC;QACxE,IAAI,CAAC,SAAS,GAAG,IAAA,0BAAS,EAAC,WAAW,CAAC,CAAC;IACzC,CAAC;IAKO,UAAU,CAAI,GAAQ,EAAE,IAAY;QAC3C,MA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,IAAA,gBAAO,GAAE;;GACG,UAAU,CAqOtB","sourcesContent":["import { messaging } from 'firebase-admin';\nimport { getLibraries } from '../..';\nimport { Service } from 'typedi';\nimport { App } from 'firebase-admin/app';\nimport { AppPlatform, AuthEntityType } from '../../utilities/enum';\n\nexport interface FCMNotificationPayload {\n\ttitle?: string;\n\tbody?: string;\n\tdata?: Record<string, string>;\n\tsound?: string;\n\tinvisible?: boolean;\n}\n\nexport interface NotificationTokenTarget {\n\ttoken: string;\n\tentityType: AuthEntityType;\n\tentityId: string;\n\tplatform?: AppPlatform;\n\tappVersion?: string;\n}\n\ntype NotifiableEntityType = AuthEntityType.USER | AuthEntityType.SELLER | AuthEntityType.DELIVERY_BOY;\n\nconst NotificationVersionRules: Record<NotifiableEntityType, Partial<Record<AppPlatform, string>>> = {\n\t[AuthEntityType.DELIVERY_BOY]: {\n\t\t[AppPlatform.IOS]: '1.0.4',\n\t\t[AppPlatform.ANDROID]: '1.2.1',\n\t},\n\n\t[AuthEntityType.USER]: {\n\t\t[AppPlatform.IOS]: '1.0.2',\n\t\t[AppPlatform.ANDROID]: '1.1.3',\n\t},\n\n\t[AuthEntityType.SELLER]: {\n\t\t[AppPlatform.IOS]: '1.1.0',\n\t\t[AppPlatform.ANDROID]: '1.0.9',\n\t},\n};\n\nexport const FCMServiceForUser = 'fcm.service.user';\nexport const FCMServiceForRider = 'fcm.service.rider';\nexport const FCMServiceForShop = 'fcm.service.shop';\n\n@Service()\nexport class FCMService {\n\tprivate messaging!: messaging.Messaging;\n\tprivate static readonly MAX_BATCH = 500;\n\n\tconstructor(app?: App) {\n\t\tconst firebaseApp = app ?? getLibraries().getFirebaseService().superApp;\n\t\tthis.messaging = messaging(firebaseApp);\n\t}\n\n\t/**\n\t * Split array into chunks of fixed size\n\t */\n\tprivate chunkArray<T>(arr: T[], size: number): T[][] {\n\t\tconst chunks: T[][] = [];\n\t\tfor (let i = 0; i < arr.length; i += size) {\n\t\t\tchunks.push(arr.slice(i, i + size));\n\t\t}\n\t\treturn chunks;\n\t}\n\n\tprivate compareVersions(v1: string, v2: string): number {\n\t\tconst a = v1.split('.').map(Number);\n\t\tconst b = v2.split('.').map(Number);\n\n\t\tfor (let i = 0; i < Math.max(a.length, b.length); i++) {\n\t\t\tconst diff = (a[i] || 0) - (b[i] || 0);\n\t\t\tif (diff !== 0) return diff;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\tprivate isNotifiableEntityType(type: AuthEntityType): type is NotifiableEntityType {\n\t\treturn (\n\t\t\ttype === AuthEntityType.USER || type === AuthEntityType.SELLER || type === AuthEntityType.DELIVERY_BOY\n\t\t);\n\t}\n\n\tprivate shouldUseNewStructure(\n\t\tentityType: AuthEntityType,\n\t\tplatform?: AppPlatform,\n\t\tversion?: string\n\t): boolean {\n\t\tif (!this.isNotifiableEntityType(entityType)) return false;\n\n\t\tif (!platform || !version) return false;\n\n\t\tconst minVersion = NotificationVersionRules?.[entityType]?.[platform];\n\n\t\tif (!minVersion) return false;\n\n\t\treturn this.compareVersions(version, minVersion) >= 0;\n\t}\n\n\t/**\n\t * Build multicast message safely\n\t */\n\tprivate buildMessage(payload: FCMNotificationPayload, batchTokens: string[]): messaging.MulticastMessage {\n\t\tconst isInvisible = payload.invisible === true;\n\t\tconst channelId = payload.sound ? 'order_alert' : 'default';\n\n\t\tconst message: messaging.MulticastMessage = {\n\t\t\tdata: { ...payload.data, channelId: isInvisible ? 'silent' : channelId },\n\t\t\tnotification: {\n\t\t\t\ttitle: payload.title,\n\t\t\t\tbody: payload.body,\n\t\t\t},\n\t\t\ttokens: batchTokens,\n\t\t\tandroid: {\n\t\t\t\tpriority: 'high',\n\t\t\t\tnotification: {\n\t\t\t\t\tchannelId: 'silent',\n\t\t\t\t},\n\t\t\t},\n\t\t\tapns: {\n\t\t\t\tpayload: {\n\t\t\t\t\taps: {\n\t\t\t\t\t\tsound: payload.sound || 'default',\n\t\t\t\t\t\tcontentAvailable: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\theaders: {\n\t\t\t\t\t'apns-push-type': 'background',\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\treturn message;\n\t}\n\n\t/**\n\t * Build multicast message safely for old apps\n\t */\n\tprivate buildOldMessage(\n\t\tpayload: FCMNotificationPayload,\n\t\tbatchTokens: string[]\n\t): messaging.MulticastMessage {\n\t\tconst isInvisible = payload.invisible === true;\n\n\t\tconst message: messaging.MulticastMessage = {\n\t\t\tdata: payload.data || {},\n\t\t\tnotification: {\n\t\t\t\ttitle: payload.title,\n\t\t\t\tbody: payload.body,\n\t\t\t},\n\t\t\ttokens: batchTokens,\n\t\t\tandroid: { priority: 'high' },\n\t\t\tapns: {\n\t\t\t\tpayload: {\n\t\t\t\t\taps: {\n\t\t\t\t\t\tsound: payload.sound || 'default',\n\t\t\t\t\t\tcontentAvailable: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tif (!isInvisible) {\n\t\t\tmessage.notification = {\n\t\t\t\ttitle: payload.title,\n\t\t\t\tbody: payload.body,\n\t\t\t};\n\n\t\t\tmessage.android = {\n\t\t\t\tpriority: 'high',\n\t\t\t\tnotification: {\n\t\t\t\t\tchannelId: payload.sound ? 'android_Push_Notification_Channel_1' : 'default',\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn message;\n\t}\n\n\t/**\n\t * Sends a push notification (visible or invisible) to multiple device tokens\n\t * @param payload - Notification title, body, and optional data\n\t * @param tokens - FCM device tokens\n\t * @returns Object containing success and invalid tokens\n\t */\n\tasync sendNotification(\n\t\tpayload: FCMNotificationPayload,\n\t\ttargets: NotificationTokenTarget[]\n\t): Promise<{ successTokens: string[]; failedTokens: string[] }> {\n\t\tif (!targets.length) {\n\t\t\treturn { successTokens: [], failedTokens: [] };\n\t\t}\n\n\t\tconst oldTokens: string[] = [];\n\t\tconst newTokens: string[] = [];\n\n\t\tfor (const t of targets) {\n\t\t\tconst useNew = this.shouldUseNewStructure(t.entityType, t.platform, t.appVersion);\n\n\t\t\tif (useNew) newTokens.push(t.token);\n\t\t\telse oldTokens.push(t.token);\n\t\t}\n\n\t\tconst sendGroup = async (\n\t\t\tgroupTokens: string[],\n\t\t\tgroupPayload: FCMNotificationPayload,\n\t\t\toldNotificationStructure: boolean = false\n\t\t) => {\n\t\t\tconst tokenChunks = this.chunkArray(groupTokens, FCMService.MAX_BATCH);\n\n\t\t\tconst success: string[] = [];\n\t\t\tconst failed: string[] = [];\n\n\t\t\tconst results = await Promise.all(\n\t\t\t\ttokenChunks.map(async chunk => {\n\t\t\t\t\tconst message = oldNotificationStructure\n\t\t\t\t\t\t? this.buildOldMessage(groupPayload, chunk)\n\t\t\t\t\t\t: this.buildMessage(groupPayload, chunk);\n\n\t\t\t\t\tconst response = await this.messaging.sendEachForMulticast(message);\n\n\t\t\t\t\tconst batchSuccess: string[] = [];\n\t\t\t\t\tconst batchFailed: string[] = [];\n\n\t\t\t\t\tresponse.responses.forEach((resp, idx) => {\n\t\t\t\t\t\tif (resp.success) {\n\t\t\t\t\t\t\tbatchSuccess.push(chunk[idx]);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst errorCode = resp.error?.code;\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\terrorCode === 'messaging/invalid-argument' ||\n\t\t\t\t\t\t\t\terrorCode === 'messaging/registration-token-not-registered'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tbatchFailed.push(chunk[idx]);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconsole.warn(`FCM Error for token ${chunk[idx]}:`, resp.error?.message);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn { batchSuccess, batchFailed };\n\t\t\t\t})\n\t\t\t);\n\n\t\t\tfor (const r of results) {\n\t\t\t\tsuccess.push(...r.batchSuccess);\n\t\t\t\tfailed.push(...r.batchFailed);\n\t\t\t}\n\n\t\t\treturn { success, failed };\n\t\t};\n\n\t\tlet successTokens: string[] = [];\n\t\tlet failedTokens: string[] = [];\n\n\t\t// send old payload\n\t\tif (oldTokens.length) {\n\t\t\tconst r = await sendGroup(oldTokens, payload, true);\n\n\t\t\tsuccessTokens.push(...r.success);\n\t\t\tfailedTokens.push(...r.failed);\n\t\t}\n\n\t\t// send new payload\n\t\tif (newTokens.length) {\n\t\t\tconst r = await sendGroup(newTokens, payload, false);\n\n\t\t\tsuccessTokens.push(...r.success);\n\t\t\tfailedTokens.push(...r.failed);\n\t\t}\n\n\t\treturn { successTokens, failedTokens };\n\t}\n}\n"]}
1
+ {"version":3,"file":"fcmService.js","sourceRoot":"/","sources":["libraries/firebase/fcmService.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAA2C;AAC3C,6BAAqC;AACrC,mCAAiC;AAEjC,+CAAmE;AAoBnE,MAAM,wBAAwB,GAAuE;IACpG,CAAC,qBAAc,CAAC,YAAY,CAAC,EAAE;QAC9B,CAAC,kBAAW,CAAC,GAAG,CAAC,EAAE,OAAO;QAC1B,CAAC,kBAAW,CAAC,OAAO,CAAC,EAAE,OAAO;KAC9B;IAED,CAAC,qBAAc,CAAC,IAAI,CAAC,EAAE;QACtB,CAAC,kBAAW,CAAC,GAAG,CAAC,EAAE,OAAO;QAC1B,CAAC,kBAAW,CAAC,OAAO,CAAC,EAAE,OAAO;KAC9B;IAED,CAAC,qBAAc,CAAC,MAAM,CAAC,EAAE;QACxB,CAAC,kBAAW,CAAC,GAAG,CAAC,EAAE,OAAO;QAC1B,CAAC,kBAAW,CAAC,OAAO,CAAC,EAAE,OAAO;KAC9B;CACD,CAAC;AAEW,QAAA,iBAAiB,GAAG,kBAAkB,CAAC;AACvC,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AACzC,QAAA,iBAAiB,GAAG,kBAAkB,CAAC;AAG7C,IAAM,UAAU,GAAhB,MAAM,UAAU;;IACd,SAAS,CAAuB;IAChC,MAAM,CAAU,SAAS,GAAG,GAAG,CAAC;IAExC,YAAY,GA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,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;YACjC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;IACxC,CAAC;;AApOW,gCAAU;qBAAV,UAAU;IADtB,IAAA,gBAAO,GAAE;;GACG,UAAU,CAqOtB","sourcesContent":["import { messaging } from 'firebase-admin';\nimport { getLibraries } from '../..';\nimport { Service } from 'typedi';\nimport { App } from 'firebase-admin/app';\nimport { AppPlatform, AuthEntityType } from '../../utilities/enum';\n\nexport interface FCMNotificationPayload {\n\ttitle?: string;\n\tbody?: string;\n\tdata?: Record<string, string>;\n\tsound?: string;\n\tinvisible?: boolean;\n}\n\nexport interface NotificationTokenTarget {\n\ttoken: string;\n\tentityType: AuthEntityType;\n\tentityId: string;\n\tplatform?: AppPlatform;\n\tappVersion?: string;\n}\n\ntype NotifiableEntityType = AuthEntityType.USER | AuthEntityType.SELLER | AuthEntityType.DELIVERY_BOY;\n\nconst NotificationVersionRules: Record<NotifiableEntityType, Partial<Record<AppPlatform, string>>> = {\n\t[AuthEntityType.DELIVERY_BOY]: {\n\t\t[AppPlatform.IOS]: '2.0.3',\n\t\t[AppPlatform.ANDROID]: '2.0.4',\n\t},\n\n\t[AuthEntityType.USER]: {\n\t\t[AppPlatform.IOS]: '2.0.3',\n\t\t[AppPlatform.ANDROID]: '2.0.3',\n\t},\n\n\t[AuthEntityType.SELLER]: {\n\t\t[AppPlatform.IOS]: '2.0.3',\n\t\t[AppPlatform.ANDROID]: '2.0.3',\n\t},\n};\n\nexport const FCMServiceForUser = 'fcm.service.user';\nexport const FCMServiceForRider = 'fcm.service.rider';\nexport const FCMServiceForShop = 'fcm.service.shop';\n\n@Service()\nexport class FCMService {\n\tprivate messaging!: messaging.Messaging;\n\tprivate static readonly MAX_BATCH = 500;\n\n\tconstructor(app?: App) {\n\t\tconst firebaseApp = app ?? getLibraries().getFirebaseService().superApp;\n\t\tthis.messaging = messaging(firebaseApp);\n\t}\n\n\t/**\n\t * Split array into chunks of fixed size\n\t */\n\tprivate chunkArray<T>(arr: T[], size: number): T[][] {\n\t\tconst chunks: T[][] = [];\n\t\tfor (let i = 0; i < arr.length; i += size) {\n\t\t\tchunks.push(arr.slice(i, i + size));\n\t\t}\n\t\treturn chunks;\n\t}\n\n\tprivate compareVersions(v1: string, v2: string): number {\n\t\tconst a = v1.split('.').map(Number);\n\t\tconst b = v2.split('.').map(Number);\n\n\t\tfor (let i = 0; i < Math.max(a.length, b.length); i++) {\n\t\t\tconst diff = (a[i] || 0) - (b[i] || 0);\n\t\t\tif (diff !== 0) return diff;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\tprivate isNotifiableEntityType(type: AuthEntityType): type is NotifiableEntityType {\n\t\treturn (\n\t\t\ttype === AuthEntityType.USER || type === AuthEntityType.SELLER || type === AuthEntityType.DELIVERY_BOY\n\t\t);\n\t}\n\n\tprivate shouldUseNewStructure(\n\t\tentityType: AuthEntityType,\n\t\tplatform?: AppPlatform,\n\t\tversion?: string\n\t): boolean {\n\t\tif (!this.isNotifiableEntityType(entityType)) return false;\n\n\t\tif (!platform || !version) return false;\n\n\t\tconst minVersion = NotificationVersionRules?.[entityType]?.[platform];\n\n\t\tif (!minVersion) return false;\n\n\t\treturn this.compareVersions(version, minVersion) > 0;\n\t}\n\n\t/**\n\t * Build multicast message safely\n\t */\n\tprivate buildMessage(payload: FCMNotificationPayload, batchTokens: string[]): messaging.MulticastMessage {\n\t\tconst isInvisible = payload.invisible === true;\n\t\tconst channelId = payload.sound ? 'order_alert' : 'default';\n\n\t\tconst message: messaging.MulticastMessage = {\n\t\t\tdata: { ...payload.data, channelId: isInvisible ? 'silent' : channelId },\n\t\t\tnotification: {\n\t\t\t\ttitle: payload.title,\n\t\t\t\tbody: payload.body,\n\t\t\t},\n\t\t\ttokens: batchTokens,\n\t\t\tandroid: {\n\t\t\t\tpriority: 'high',\n\t\t\t\tnotification: {\n\t\t\t\t\tchannelId: 'silent',\n\t\t\t\t},\n\t\t\t},\n\t\t\tapns: {\n\t\t\t\tpayload: {\n\t\t\t\t\taps: {\n\t\t\t\t\t\tsound: payload.sound || 'default',\n\t\t\t\t\t\tcontentAvailable: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\theaders: {\n\t\t\t\t\t'apns-push-type': 'background',\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\treturn message;\n\t}\n\n\t/**\n\t * Build multicast message safely for old apps\n\t */\n\tprivate buildOldMessage(\n\t\tpayload: FCMNotificationPayload,\n\t\tbatchTokens: string[]\n\t): messaging.MulticastMessage {\n\t\tconst isInvisible = payload.invisible === true;\n\n\t\tconst message: messaging.MulticastMessage = {\n\t\t\tdata: payload.data || {},\n\t\t\tnotification: {\n\t\t\t\ttitle: payload.title,\n\t\t\t\tbody: payload.body,\n\t\t\t},\n\t\t\ttokens: batchTokens,\n\t\t\tandroid: { priority: 'high' },\n\t\t\tapns: {\n\t\t\t\tpayload: {\n\t\t\t\t\taps: {\n\t\t\t\t\t\tsound: payload.sound || 'default',\n\t\t\t\t\t\tcontentAvailable: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tif (!isInvisible) {\n\t\t\tmessage.notification = {\n\t\t\t\ttitle: payload.title,\n\t\t\t\tbody: payload.body,\n\t\t\t};\n\n\t\t\tmessage.android = {\n\t\t\t\tpriority: 'high',\n\t\t\t\tnotification: {\n\t\t\t\t\tchannelId: payload.sound ? 'android_Push_Notification_Channel_1' : 'default',\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn message;\n\t}\n\n\t/**\n\t * Sends a push notification (visible or invisible) to multiple device tokens\n\t * @param payload - Notification title, body, and optional data\n\t * @param tokens - FCM device tokens\n\t * @returns Object containing success and invalid tokens\n\t */\n\tasync sendNotification(\n\t\tpayload: FCMNotificationPayload,\n\t\ttargets: NotificationTokenTarget[]\n\t): Promise<{ successTokens: string[]; failedTokens: string[] }> {\n\t\tif (!targets.length) {\n\t\t\treturn { successTokens: [], failedTokens: [] };\n\t\t}\n\n\t\tconst oldTokens: string[] = [];\n\t\tconst newTokens: string[] = [];\n\n\t\tfor (const t of targets) {\n\t\t\tconst useNew = this.shouldUseNewStructure(t.entityType, t.platform, t.appVersion);\n\n\t\t\tif (useNew) newTokens.push(t.token);\n\t\t\telse oldTokens.push(t.token);\n\t\t}\n\n\t\tconst sendGroup = async (\n\t\t\tgroupTokens: string[],\n\t\t\tgroupPayload: FCMNotificationPayload,\n\t\t\toldNotificationStructure: boolean = false\n\t\t) => {\n\t\t\tconst tokenChunks = this.chunkArray(groupTokens, FCMService.MAX_BATCH);\n\n\t\t\tconst success: string[] = [];\n\t\t\tconst failed: string[] = [];\n\n\t\t\tconst results = await Promise.all(\n\t\t\t\ttokenChunks.map(async chunk => {\n\t\t\t\t\tconst message = oldNotificationStructure\n\t\t\t\t\t\t? this.buildOldMessage(groupPayload, chunk)\n\t\t\t\t\t\t: this.buildMessage(groupPayload, chunk);\n\n\t\t\t\t\tconst response = await this.messaging.sendEachForMulticast(message);\n\n\t\t\t\t\tconst batchSuccess: string[] = [];\n\t\t\t\t\tconst batchFailed: string[] = [];\n\n\t\t\t\t\tresponse.responses.forEach((resp, idx) => {\n\t\t\t\t\t\tif (resp.success) {\n\t\t\t\t\t\t\tbatchSuccess.push(chunk[idx]);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst errorCode = resp.error?.code;\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\terrorCode === 'messaging/invalid-argument' ||\n\t\t\t\t\t\t\t\terrorCode === 'messaging/registration-token-not-registered'\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tbatchFailed.push(chunk[idx]);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconsole.warn(`FCM Error for token ${chunk[idx]}:`, resp.error?.message);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn { batchSuccess, batchFailed };\n\t\t\t\t})\n\t\t\t);\n\n\t\t\tfor (const r of results) {\n\t\t\t\tsuccess.push(...r.batchSuccess);\n\t\t\t\tfailed.push(...r.batchFailed);\n\t\t\t}\n\n\t\t\treturn { success, failed };\n\t\t};\n\n\t\tlet successTokens: string[] = [];\n\t\tlet failedTokens: string[] = [];\n\n\t\t// send old payload\n\t\tif (oldTokens.length) {\n\t\t\tconst r = await sendGroup(oldTokens, payload, true);\n\n\t\t\tsuccessTokens.push(...r.success);\n\t\t\tfailedTokens.push(...r.failed);\n\t\t}\n\n\t\t// send new payload\n\t\tif (newTokens.length) {\n\t\t\tconst r = await sendGroup(newTokens, payload, false);\n\n\t\t\tsuccessTokens.push(...r.success);\n\t\t\tfailedTokens.push(...r.failed);\n\t\t}\n\n\t\treturn { successTokens, failedTokens };\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"profit.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/profit.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,kBAAkB;IAEvB,kBAAkB,CAAU;IAG5B,2BAA2B,CAAU;IAGrC,WAAW,CAAU;IAGrB,oBAAoB,CAAU;CACrC;AAZD,gDAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8DACA;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uEACS;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACP;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gEACE;AAGtC,MAAa,kBAAmB,SAAQ,kBAAkB;IAElD,cAAc,CAAU;IAGxB,uBAAuB,CAAU;CACxC;AAND,gDAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0DACJ;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mEACK;AAGzC,MAAa,WAAY,SAAQ,kBAAkB;IAE3C,cAAc,CAAU;IAGxB,uBAAuB,CAAU;CACxC;AAND,kCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mDACJ;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4DACK;AAGzC,MAAa,kBAAkB;IAEvB,MAAM,CAAQ;IAEd,eAAe,CAAQ;CAC9B;AALD,gDAKC;AAHO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kDACd;AAEd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;2DACL","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class CourierOrderProfit {\n\t@prop({ type: Number, default: 0 })\n\tpublic profitFromDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryProfitFromDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic totalProfit?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryTotalProfit?: number;\n}\n\nexport class RegularOrderProfit extends CourierOrderProfit {\n\t@prop({ type: Number, default: 0 })\n\tpublic profitFromItem?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryProfitFromItem?: number;\n}\n\nexport class RiderProfit extends CourierOrderProfit {\n\t@prop({ type: Number, default: 0 })\n\tpublic profitFromTips?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryProfitFromTips?: number;\n}\n\nexport class ServiceOrderProfit {\n\t@prop({ type: Number, default: 0 })\n\tpublic profit: number\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryProfit: number\n}"]}
1
+ {"version":3,"file":"profit.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/profit.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,kBAAkB;IAEvB,kBAAkB,CAAU;IAG5B,2BAA2B,CAAU;IAGrC,WAAW,CAAU;IAGrB,oBAAoB,CAAU;CACrC;AAZD,gDAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8DACA;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uEACS;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACP;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gEACE;AAGtC,MAAa,kBAAmB,SAAQ,kBAAkB;IAElD,cAAc,CAAU;IAGxB,uBAAuB,CAAU;CACxC;AAND,gDAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;0DACJ;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mEACK;AAGzC,MAAa,WAAY,SAAQ,kBAAkB;IAE3C,cAAc,CAAU;IAGxB,uBAAuB,CAAU;CACxC;AAND,kCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mDACJ;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;4DACK;AAGzC,MAAa,kBAAkB;IAEvB,MAAM,CAAS;IAGf,eAAe,CAAS;CAC/B;AAND,gDAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kDACb;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;2DACJ","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class CourierOrderProfit {\n\t@prop({ type: Number, default: 0 })\n\tpublic profitFromDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryProfitFromDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic totalProfit?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryTotalProfit?: number;\n}\n\nexport class RegularOrderProfit extends CourierOrderProfit {\n\t@prop({ type: Number, default: 0 })\n\tpublic profitFromItem?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryProfitFromItem?: number;\n}\n\nexport class RiderProfit extends CourierOrderProfit {\n\t@prop({ type: Number, default: 0 })\n\tpublic profitFromTips?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryProfitFromTips?: number;\n}\n\nexport class ServiceOrderProfit {\n\t@prop({ type: Number, default: 0 })\n\tpublic profit: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryProfit: number;\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import { Ref } from '@typegoose/typegoose';
2
+ import { ServicePackage } from '../service-package.model';
3
+ import { ServiceAddon } from '../service-addon.model';
4
+ export declare class ServicePackageSnap {
5
+ name: string;
6
+ price: number;
7
+ image?: string;
8
+ description?: string;
9
+ }
10
+ export declare class LineItemAddon {
11
+ addon: Ref<ServiceAddon>;
12
+ name: string;
13
+ image?: string;
14
+ price: number;
15
+ description?: string;
16
+ quantity?: number;
17
+ }
18
+ export declare class ServiceLineItem {
19
+ servicePackage?: Ref<ServicePackage>;
20
+ servicePackageSnap?: ServicePackageSnap;
21
+ addons?: LineItemAddon[];
22
+ quantity?: number;
23
+ }
@@ -0,0 +1,95 @@
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.ServiceLineItem = exports.LineItemAddon = exports.ServicePackageSnap = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ const service_package_model_1 = require("../service-package.model");
15
+ const service_addon_model_1 = require("../service-addon.model");
16
+ class ServicePackageSnap {
17
+ name;
18
+ price;
19
+ image;
20
+ description;
21
+ }
22
+ exports.ServicePackageSnap = ServicePackageSnap;
23
+ __decorate([
24
+ (0, typegoose_1.prop)({ required: true, type: String }),
25
+ __metadata("design:type", String)
26
+ ], ServicePackageSnap.prototype, "name", void 0);
27
+ __decorate([
28
+ (0, typegoose_1.prop)({ required: true, type: Number }),
29
+ __metadata("design:type", Number)
30
+ ], ServicePackageSnap.prototype, "price", void 0);
31
+ __decorate([
32
+ (0, typegoose_1.prop)({ type: String }),
33
+ __metadata("design:type", String)
34
+ ], ServicePackageSnap.prototype, "image", void 0);
35
+ __decorate([
36
+ (0, typegoose_1.prop)({ type: String }),
37
+ __metadata("design:type", String)
38
+ ], ServicePackageSnap.prototype, "description", void 0);
39
+ class LineItemAddon {
40
+ addon;
41
+ name;
42
+ image;
43
+ price;
44
+ description;
45
+ quantity;
46
+ }
47
+ exports.LineItemAddon = LineItemAddon;
48
+ __decorate([
49
+ (0, typegoose_1.prop)({ required: true, ref: () => service_addon_model_1.ServiceAddon }),
50
+ __metadata("design:type", Object)
51
+ ], LineItemAddon.prototype, "addon", void 0);
52
+ __decorate([
53
+ (0, typegoose_1.prop)({ required: true, type: String }),
54
+ __metadata("design:type", String)
55
+ ], LineItemAddon.prototype, "name", void 0);
56
+ __decorate([
57
+ (0, typegoose_1.prop)({ type: String }),
58
+ __metadata("design:type", String)
59
+ ], LineItemAddon.prototype, "image", void 0);
60
+ __decorate([
61
+ (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
62
+ __metadata("design:type", Number)
63
+ ], LineItemAddon.prototype, "price", void 0);
64
+ __decorate([
65
+ (0, typegoose_1.prop)({ type: String }),
66
+ __metadata("design:type", String)
67
+ ], LineItemAddon.prototype, "description", void 0);
68
+ __decorate([
69
+ (0, typegoose_1.prop)({ min: 1, default: 1 }),
70
+ __metadata("design:type", Number)
71
+ ], LineItemAddon.prototype, "quantity", void 0);
72
+ class ServiceLineItem {
73
+ servicePackage;
74
+ servicePackageSnap;
75
+ addons;
76
+ quantity;
77
+ }
78
+ exports.ServiceLineItem = ServiceLineItem;
79
+ __decorate([
80
+ (0, typegoose_1.prop)({ ref: () => service_package_model_1.ServicePackage }),
81
+ __metadata("design:type", Object)
82
+ ], ServiceLineItem.prototype, "servicePackage", void 0);
83
+ __decorate([
84
+ (0, typegoose_1.prop)({ type: ServicePackageSnap, _id: false }),
85
+ __metadata("design:type", ServicePackageSnap)
86
+ ], ServiceLineItem.prototype, "servicePackageSnap", void 0);
87
+ __decorate([
88
+ (0, typegoose_1.prop)({ type: () => [LineItemAddon], default: [], _id: false }),
89
+ __metadata("design:type", Array)
90
+ ], ServiceLineItem.prototype, "addons", void 0);
91
+ __decorate([
92
+ (0, typegoose_1.prop)({ min: 1, default: 1 }),
93
+ __metadata("design:type", Number)
94
+ ], ServiceLineItem.prototype, "quantity", void 0);
95
+ //# sourceMappingURL=service-line-item.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,oEAA0D;AAC1D,gEAAsD;AAEtD,MAAa,kBAAkB;IAEvB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,KAAK,CAAU;IAGf,WAAW,CAAU;CAC5B;AAZD,gDAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDACK;AAG7B,MAAa,aAAa;IAElB,KAAK,CAAqB;IAG1B,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,QAAQ,CAAU;CACzB;AAlBD,sCAkBC;AAhBO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,kCAAY,EAAE,CAAC;;4CACjB;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CACzB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDACK;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+CACJ;AAG1B,MAAa,eAAe;IAEpB,cAAc,CAAuB;IAGrC,kBAAkB,CAAsB;IAGxC,MAAM,CAAmB;IAGzB,QAAQ,CAAU;CACzB;AAZD,0CAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,sCAAc,EAAE,CAAC;;uDACQ;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;8BACnB,kBAAkB;2DAAC;AAGxC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;;+CAC/B;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;iDACJ","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { ServicePackage } from '../service-package.model';\nimport { ServiceAddon } from '../service-addon.model';\n\nexport class ServicePackageSnap {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: Number })\n\tpublic price!: number;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String })\n\tpublic description?: string;\n}\n\nexport class LineItemAddon {\n\t@prop({ required: true, ref: () => ServiceAddon })\n\tpublic addon!: Ref<ServiceAddon>;\n\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n\n\t@prop({ type: String })\n\tpublic description?: string;\n\n\t@prop({ min: 1, default: 1 })\n\tpublic quantity?: number;\n}\n\nexport class ServiceLineItem {\n\t@prop({ ref: () => ServicePackage })\n\tpublic servicePackage?: Ref<ServicePackage>;\n\n\t@prop({ type: ServicePackageSnap, _id: false })\n\tpublic servicePackageSnap?: ServicePackageSnap;\n\n\t@prop({ type: () => [LineItemAddon], default: [], _id: false })\n\tpublic addons?: LineItemAddon[];\n\n\t@prop({ min: 1, default: 1 })\n\tpublic quantity?: number;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { ServiceOrderCanceledBy } from "../../../../utilities/enum";
1
+ import { ServiceOrderCanceledBy } from '../../../../utilities/enum';
2
2
  export declare class ServiceOrderCancel {
3
3
  canceledBy: ServiceOrderCanceledBy;
4
4
  cancelReason?: string;
@@ -18,11 +18,7 @@ class ServiceOrderCancel {
18
18
  }
19
19
  exports.ServiceOrderCancel = ServiceOrderCancel;
20
20
  __decorate([
21
- (0, typegoose_1.prop)({
22
- type: String,
23
- enum: enum_1.ServiceOrderCanceledBy,
24
- required: true
25
- }),
21
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ServiceOrderCanceledBy }),
26
22
  __metadata("design:type", String)
27
23
  ], ServiceOrderCancel.prototype, "canceledBy", void 0);
28
24
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"service-order-cance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-cance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAoE;AAEpE,MAAa,kBAAkB;IAM3B,UAAU,CAA0B;IAGpC,YAAY,CAAU;CACzB;AAVD,gDAUC;AAJG;IALC,IAAA,gBAAI,EAAC;QACF,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,6BAAsB;QAC5B,QAAQ,EAAE,IAAI;KACjB,CAAC;;sDACkC;AAGpC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDACD","sourcesContent":["import { prop } from \"@typegoose/typegoose\";\nimport { ServiceOrderCanceledBy } from \"../../../../utilities/enum\";\n\nexport class ServiceOrderCancel {\n @prop({\n type: String,\n enum: ServiceOrderCanceledBy,\n required: true\n })\n canceledBy!: ServiceOrderCanceledBy;\n\n @prop({ type: String })\n cancelReason?: string;\n}"]}
1
+ {"version":3,"file":"service-order-cance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-cance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAoE;AAEpE,MAAa,kBAAkB;IAEvB,UAAU,CAA0B;IAGpC,YAAY,CAAU;CAC7B;AAND,gDAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6BAAsB,EAAE,CAAC;;sDAC1B;AAGpC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDACM","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { ServiceOrderCanceledBy } from '../../../../utilities/enum';\n\nexport class ServiceOrderCancel {\n\t@prop({ required: true, type: String, enum: ServiceOrderCanceledBy })\n\tpublic canceledBy!: ServiceOrderCanceledBy;\n\n\t@prop({ type: String })\n\tpublic cancelReason?: string;\n}\n"]}
@@ -1,17 +1,16 @@
1
1
  import { Vat } from '../embedded/vat.model';
2
- import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
2
  import { ServiceOrderPricing } from './service-order-pricing.model';
4
3
  import { PaymentMethod } from '../../../../utilities/enum';
5
4
  import { PaymentInformation } from './payment-infromation.model';
6
5
  import { ServiceOrderProfit } from './profit.model';
7
6
  import { ServicePromotionCut } from './marketing-cut.model';
8
- export declare class ServiceOrderFinance extends TimeStamps {
9
- pricing: ServiceOrderPricing;
10
- companyProfit: ServiceOrderProfit;
11
- vendorProfit: ServiceOrderProfit;
12
- discount?: ServicePromotionCut;
7
+ export declare class ServiceOrderFinance {
13
8
  exchangeRate?: number;
14
- paymentMethod?: PaymentMethod;
9
+ paymentMethod: PaymentMethod;
15
10
  paymentInformation?: PaymentInformation;
11
+ pricing: ServiceOrderPricing;
12
+ companyProfit?: ServiceOrderProfit;
13
+ vendorProfit?: ServiceOrderProfit;
14
+ discount?: ServicePromotionCut;
16
15
  vat?: Vat;
17
16
  }
@@ -12,25 +12,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ServiceOrderFinance = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const vat_model_1 = require("../embedded/vat.model");
15
- const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
16
15
  const service_order_pricing_model_1 = require("./service-order-pricing.model");
17
16
  const enum_1 = require("../../../../utilities/enum");
18
17
  const payment_infromation_model_1 = require("./payment-infromation.model");
19
18
  const profit_model_1 = require("./profit.model");
20
19
  const marketing_cut_model_1 = require("./marketing-cut.model");
21
- class ServiceOrderFinance extends defaultClasses_1.TimeStamps {
20
+ class ServiceOrderFinance {
21
+ exchangeRate;
22
+ paymentMethod;
23
+ paymentInformation;
22
24
  pricing;
23
25
  companyProfit;
24
26
  vendorProfit;
25
27
  discount;
26
- exchangeRate;
27
- paymentMethod;
28
- paymentInformation;
29
28
  vat;
30
29
  }
31
30
  exports.ServiceOrderFinance = ServiceOrderFinance;
32
31
  __decorate([
33
- (0, typegoose_1.prop)({ required: true, type: () => service_order_pricing_model_1.ServiceOrderPricing }),
32
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
33
+ __metadata("design:type", Number)
34
+ ], ServiceOrderFinance.prototype, "exchangeRate", void 0);
35
+ __decorate([
36
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.PaymentMethod }),
37
+ __metadata("design:type", String)
38
+ ], ServiceOrderFinance.prototype, "paymentMethod", void 0);
39
+ __decorate([
40
+ (0, typegoose_1.prop)({ type: () => payment_infromation_model_1.PaymentInformation, _id: false }),
41
+ __metadata("design:type", payment_infromation_model_1.PaymentInformation)
42
+ ], ServiceOrderFinance.prototype, "paymentInformation", void 0);
43
+ __decorate([
44
+ (0, typegoose_1.prop)({ required: true, type: () => service_order_pricing_model_1.ServiceOrderPricing, _id: false }),
34
45
  __metadata("design:type", service_order_pricing_model_1.ServiceOrderPricing)
35
46
  ], ServiceOrderFinance.prototype, "pricing", void 0);
36
47
  __decorate([
@@ -45,18 +56,6 @@ __decorate([
45
56
  (0, typegoose_1.prop)({ type: () => marketing_cut_model_1.ServicePromotionCut }),
46
57
  __metadata("design:type", marketing_cut_model_1.ServicePromotionCut)
47
58
  ], ServiceOrderFinance.prototype, "discount", void 0);
48
- __decorate([
49
- (0, typegoose_1.prop)({ type: Number, default: 1 }),
50
- __metadata("design:type", Number)
51
- ], ServiceOrderFinance.prototype, "exchangeRate", void 0);
52
- __decorate([
53
- (0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentMethod, default: enum_1.PaymentMethod.CASH }),
54
- __metadata("design:type", String)
55
- ], ServiceOrderFinance.prototype, "paymentMethod", void 0);
56
- __decorate([
57
- (0, typegoose_1.prop)({ type: () => payment_infromation_model_1.PaymentInformation, _id: false }),
58
- __metadata("design:type", payment_infromation_model_1.PaymentInformation)
59
- ], ServiceOrderFinance.prototype, "paymentInformation", void 0);
60
59
  __decorate([
61
60
  (0, typegoose_1.prop)({ type: () => vat_model_1.Vat }),
62
61
  __metadata("design:type", vat_model_1.Vat)
@@ -1 +1 @@
1
- {"version":3,"file":"service-order-finance.model.js","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AC;8BACzB,8CAAkB;+DAAC;AAGxC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,eAAG,EAAE,CAAC;8BACb,eAAG;gDAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { Vat } from '../embedded/vat.model';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceOrderPricing } from './service-order-pricing.model';\nimport { PaymentMethod } from '../../../../utilities/enum';\nimport { PaymentInformation } from './payment-infromation.model';\nimport { ServiceOrderProfit } from './profit.model';\nimport { ServicePromotionCut } from './marketing-cut.model';\n\nexport class ServiceOrderFinance extends TimeStamps {\n\t@prop({ required: true, type: () => ServiceOrderPricing })\n\tpublic pricing: ServiceOrderPricing;\n\n\t@prop({ type: () => ServiceOrderProfit })\n\tpublic companyProfit: ServiceOrderProfit;\n\n\t@prop({ type: () => ServiceOrderProfit })\n\tpublic vendorProfit: ServiceOrderProfit;\n\n\t@prop({ type: () => ServicePromotionCut })\n\tpublic discount?: ServicePromotionCut;\n\n\t@prop({ type: Number, default: 1 })\n\tpublic exchangeRate?: number;\n\n\t@prop({ type: String, enum: PaymentMethod, default: PaymentMethod.CASH })\n\tpublic paymentMethod?: PaymentMethod;\n\n\t@prop({ type: () => PaymentInformation, _id: false })\n\tpublic paymentInformation?: PaymentInformation;\n\n\t@prop({ type: () => Vat })\n\tpublic vat?: Vat;\n}\n"]}
1
+ {"version":3,"file":"service-order-finance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-finance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAA4C;AAC5C,+EAAoE;AACpE,qDAA2D;AAC3D,2EAAiE;AACjE,iDAAoD;AACpD,+DAA4D;AAE5D,MAAa,mBAAmB;IAExB,YAAY,CAAU;IAGtB,aAAa,CAAiB;IAG9B,kBAAkB,CAAsB;IAGxC,OAAO,CAAuB;IAG9B,aAAa,CAAsB;IAGnC,YAAY,CAAsB;IAGlC,QAAQ,CAAuB;IAG/B,GAAG,CAAO;CACjB;AAxBD,kDAwBC;AAtBO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACN;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,CAAC;;0DACvB;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,8CAAkB,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;8BACzB,8CAAkB;+DAAC;AAGxC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,iDAAmB,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;8BACrD,iDAAmB;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;8BACnB,iCAAkB;yDAAC;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,yCAAmB,EAAE,CAAC;8BACxB,yCAAmB;qDAAC;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,eAAG,EAAE,CAAC;8BACb,eAAG;gDAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { Vat } from '../embedded/vat.model';\nimport { ServiceOrderPricing } from './service-order-pricing.model';\nimport { PaymentMethod } from '../../../../utilities/enum';\nimport { PaymentInformation } from './payment-infromation.model';\nimport { ServiceOrderProfit } from './profit.model';\nimport { ServicePromotionCut } from './marketing-cut.model';\n\nexport class ServiceOrderFinance {\n\t@prop({ type: Number, default: 0 })\n\tpublic exchangeRate?: number;\n\n\t@prop({ required: true, type: String, enum: PaymentMethod })\n\tpublic paymentMethod!: PaymentMethod;\n\n\t@prop({ type: () => PaymentInformation, _id: false })\n\tpublic paymentInformation?: PaymentInformation;\n\n\t@prop({ required: true, type: () => ServiceOrderPricing, _id: false })\n\tpublic pricing!: ServiceOrderPricing;\n\n\t@prop({ type: () => ServiceOrderProfit })\n\tpublic companyProfit?: ServiceOrderProfit;\n\n\t@prop({ type: () => ServiceOrderProfit })\n\tpublic vendorProfit?: ServiceOrderProfit;\n\n\t@prop({ type: () => ServicePromotionCut })\n\tpublic discount?: ServicePromotionCut;\n\n\t@prop({ type: () => Vat })\n\tpublic vat?: Vat;\n}\n"]}
@@ -1,8 +1,8 @@
1
- import { Ref } from "@typegoose/typegoose";
2
- import { Vendor } from "../vendor.model";
1
+ import { ServiceOrderActionType } from '../../../../utilities/enum';
3
2
  export declare class ServiceOrderFlag {
4
3
  reason: string;
5
- flaggedBy: Ref<Vendor>;
4
+ actionType: ServiceOrderActionType;
6
5
  flaggedAt: Date;
7
- isResolved: boolean;
6
+ isResolved?: boolean;
7
+ resolvedAt?: Date;
8
8
  }
@@ -11,12 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ServiceOrderFlag = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
- const vendor_model_1 = require("../vendor.model");
14
+ const enum_1 = require("../../../../utilities/enum");
15
15
  class ServiceOrderFlag {
16
16
  reason;
17
- flaggedBy;
17
+ actionType;
18
18
  flaggedAt;
19
19
  isResolved;
20
+ resolvedAt;
20
21
  }
21
22
  exports.ServiceOrderFlag = ServiceOrderFlag;
22
23
  __decorate([
@@ -24,15 +25,19 @@ __decorate([
24
25
  __metadata("design:type", String)
25
26
  ], ServiceOrderFlag.prototype, "reason", void 0);
26
27
  __decorate([
27
- (0, typegoose_1.prop)({ ref: () => vendor_model_1.Vendor, required: true }),
28
- __metadata("design:type", Object)
29
- ], ServiceOrderFlag.prototype, "flaggedBy", void 0);
28
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ServiceOrderActionType }),
29
+ __metadata("design:type", String)
30
+ ], ServiceOrderFlag.prototype, "actionType", void 0);
30
31
  __decorate([
31
- (0, typegoose_1.prop)({ default: Date.now }),
32
+ (0, typegoose_1.prop)({ type: Date, default: Date.now }),
32
33
  __metadata("design:type", Date)
33
34
  ], ServiceOrderFlag.prototype, "flaggedAt", void 0);
34
35
  __decorate([
35
- (0, typegoose_1.prop)({ default: false }),
36
+ (0, typegoose_1.prop)({ type: Boolean, default: false }),
36
37
  __metadata("design:type", Boolean)
37
38
  ], ServiceOrderFlag.prototype, "isResolved", void 0);
39
+ __decorate([
40
+ (0, typegoose_1.prop)({ type: Date }),
41
+ __metadata("design:type", Date)
42
+ ], ServiceOrderFlag.prototype, "resolvedAt", void 0);
38
43
  //# sourceMappingURL=service-order-flag.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-order-flag.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-flag.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,kDAAyC;AAEzC,MAAa,gBAAgB;IAElB,MAAM,CAAU;IAGhB,SAAS,CAAc;IAGvB,SAAS,CAAQ;IAGjB,UAAU,CAAW;CAC/B;AAZD,4CAYC;AAVU;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACF;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACd;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;8BACT,IAAI;mDAAC;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;oDACG","sourcesContent":["import { prop, Ref } from \"@typegoose/typegoose\";\nimport { Vendor } from \"../vendor.model\";\n\nexport class ServiceOrderFlag {\n @prop({ required: true })\n public reason!: string;\n\n @prop({ ref: () => Vendor, required: true })\n public flaggedBy!: Ref<Vendor>\n\n @prop({ default: Date.now })\n public flaggedAt!: Date;\n\n @prop({ default: false })\n public isResolved!: boolean;\n}"]}
1
+ {"version":3,"file":"service-order-flag.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-flag.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAoE;AAEpE,MAAa,gBAAgB;IAErB,MAAM,CAAU;IAGhB,UAAU,CAA0B;IAGpC,SAAS,CAAQ;IAGjB,UAAU,CAAW;IAGrB,UAAU,CAAQ;CACzB;AAfD,4CAeC;AAbO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACF;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6BAAsB,EAAE,CAAC;;oDAC1B;AAGpC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;8BACrB,IAAI;mDAAC;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;oDACZ;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACD,IAAI;oDAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { ServiceOrderActionType } from '../../../../utilities/enum';\n\nexport class ServiceOrderFlag {\n\t@prop({ required: true })\n\tpublic reason!: string;\n\n\t@prop({ required: true, type: String, enum: ServiceOrderActionType })\n\tpublic actionType!: ServiceOrderActionType;\n\n\t@prop({ type: Date, default: Date.now })\n\tpublic flaggedAt!: Date;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isResolved?: boolean;\n\n\t@prop({ type: Date })\n\tpublic resolvedAt?: Date;\n}\n"]}
@@ -1,13 +1,17 @@
1
1
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
2
2
  export declare class ServiceOrderPricing extends TimeStamps {
3
- subtotal: number;
3
+ subtotal?: number;
4
4
  secondarySubtotal?: number;
5
- total: number;
6
- secondaryTotal?: number;
7
- paidAmount?: number;
8
- secondaryPaidAmount?: number;
9
5
  discount?: number;
10
6
  secondaryDiscount?: number;
11
7
  materialCost?: number;
12
8
  secondaryMaterialCost?: number;
9
+ total?: number;
10
+ secondaryTotal?: number;
11
+ wallet?: number;
12
+ secondaryWallet?: number;
13
+ reserveWallet?: number;
14
+ secondaryReserveWallet?: number;
15
+ paidAmount?: number;
16
+ secondaryPaidAmount?: number;
13
17
  }
@@ -15,14 +15,18 @@ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
15
  class ServiceOrderPricing extends defaultClasses_1.TimeStamps {
16
16
  subtotal;
17
17
  secondarySubtotal;
18
- total;
19
- secondaryTotal;
20
- paidAmount;
21
- secondaryPaidAmount;
22
18
  discount;
23
19
  secondaryDiscount;
24
20
  materialCost;
25
21
  secondaryMaterialCost;
22
+ total;
23
+ secondaryTotal;
24
+ wallet;
25
+ secondaryWallet;
26
+ reserveWallet;
27
+ secondaryReserveWallet;
28
+ paidAmount;
29
+ secondaryPaidAmount;
26
30
  }
27
31
  exports.ServiceOrderPricing = ServiceOrderPricing;
28
32
  __decorate([
@@ -33,6 +37,22 @@ __decorate([
33
37
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
34
38
  __metadata("design:type", Number)
35
39
  ], ServiceOrderPricing.prototype, "secondarySubtotal", void 0);
40
+ __decorate([
41
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
42
+ __metadata("design:type", Number)
43
+ ], ServiceOrderPricing.prototype, "discount", void 0);
44
+ __decorate([
45
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
46
+ __metadata("design:type", Number)
47
+ ], ServiceOrderPricing.prototype, "secondaryDiscount", void 0);
48
+ __decorate([
49
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
50
+ __metadata("design:type", Number)
51
+ ], ServiceOrderPricing.prototype, "materialCost", void 0);
52
+ __decorate([
53
+ (0, typegoose_1.prop)({ type: Number, default: 0 }),
54
+ __metadata("design:type", Number)
55
+ ], ServiceOrderPricing.prototype, "secondaryMaterialCost", void 0);
36
56
  __decorate([
37
57
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
38
58
  __metadata("design:type", Number)
@@ -44,25 +64,25 @@ __decorate([
44
64
  __decorate([
45
65
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
46
66
  __metadata("design:type", Number)
47
- ], ServiceOrderPricing.prototype, "paidAmount", void 0);
67
+ ], ServiceOrderPricing.prototype, "wallet", void 0);
48
68
  __decorate([
49
69
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
50
70
  __metadata("design:type", Number)
51
- ], ServiceOrderPricing.prototype, "secondaryPaidAmount", void 0);
71
+ ], ServiceOrderPricing.prototype, "secondaryWallet", void 0);
52
72
  __decorate([
53
73
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
54
74
  __metadata("design:type", Number)
55
- ], ServiceOrderPricing.prototype, "discount", void 0);
75
+ ], ServiceOrderPricing.prototype, "reserveWallet", void 0);
56
76
  __decorate([
57
77
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
58
78
  __metadata("design:type", Number)
59
- ], ServiceOrderPricing.prototype, "secondaryDiscount", void 0);
79
+ ], ServiceOrderPricing.prototype, "secondaryReserveWallet", void 0);
60
80
  __decorate([
61
81
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
62
82
  __metadata("design:type", Number)
63
- ], ServiceOrderPricing.prototype, "materialCost", void 0);
83
+ ], ServiceOrderPricing.prototype, "paidAmount", void 0);
64
84
  __decorate([
65
85
  (0, typegoose_1.prop)({ type: Number, default: 0 }),
66
86
  __metadata("design:type", Number)
67
- ], ServiceOrderPricing.prototype, "secondaryMaterialCost", void 0);
87
+ ], ServiceOrderPricing.prototype, "secondaryPaidAmount", void 0);
68
88
  //# sourceMappingURL=service-order-pricing.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-order-pricing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-pricing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,4EAAqE;AAGrE,MAAa,mBAAoB,SAAQ,2BAAU;IAE/C,QAAQ,CAAS;IAGjB,iBAAiB,CAAU;IAG3B,KAAK,CAAS;IAGd,cAAc,CAAU;IAGxB,UAAU,CAAU;IAGpB,mBAAmB,CAAU;IAG7B,QAAQ,CAAU;IAGlB,iBAAiB,CAAU;IAG3B,YAAY,CAAU;IAGtB,qBAAqB,CAAU;CAElC;AA/BD,kDA+BC;AA7BG;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDAClB;AAGjB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8DACR;AAG3B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kDACrB;AAGd;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;2DACX;AAGxB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACf;AAGpB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gEACN;AAG7B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDACjB;AAGlB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8DACR;AAG3B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yDACb;AAGtB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;kEACJ","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\n\n\nexport class ServiceOrderPricing extends TimeStamps {\n @prop({ type: Number, default: 0 })\n subtotal: number;\n\n @prop({ type: Number, default: 0 })\n secondarySubtotal?: number;\n\n @prop({ type: Number, default: 0 })\n total: number;\n\n @prop({ type: Number, default: 0 })\n secondaryTotal?: number;\n\n @prop({ type: Number, default: 0 })\n paidAmount?: number;\n\n @prop({ type: Number, default: 0 })\n secondaryPaidAmount?: number;\n\n @prop({ type: Number, default: 0 })\n discount?: number;\n\n @prop({ type: Number, default: 0 })\n secondaryDiscount?: number;\n\n @prop({ type: Number, default: 0 })\n materialCost?: number;\n\n @prop({ type: Number, default: 0 })\n secondaryMaterialCost?: number;\n\n}\n"]}
1
+ {"version":3,"file":"service-order-pricing.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-pricing.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,4EAAqE;AAErE,MAAa,mBAAoB,SAAQ,2BAAU;IAE3C,QAAQ,CAAU;IAGlB,iBAAiB,CAAU;IAG3B,QAAQ,CAAU;IAGlB,iBAAiB,CAAU;IAG3B,YAAY,CAAU;IAGtB,qBAAqB,CAAU;IAG/B,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,CAAC,EAAE,CAAC;;0DACL;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mEACI;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;uDACR;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gEACC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\n\nexport class ServiceOrderPricing extends TimeStamps {\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 discount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryDiscount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic materialCost?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryMaterialCost?: 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"]}
@@ -1,6 +1,6 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { Admin } from '../admin.model';
3
- import { RequestFrom } from '../../../../utilities/enum';
3
+ import { CourierOrderStatus, RequestFrom, ServiceOrderStatus } from '../../../../utilities/enum';
4
4
  import { User } from '../user.model';
5
5
  declare class StatusTimeline {
6
6
  timestamp?: Date;
@@ -14,9 +14,9 @@ export declare class RegularOrderStatusTimeline extends StatusTimeline {
14
14
  user?: Ref<User>;
15
15
  }
16
16
  export declare class CourierOrderStatusTimeline extends StatusTimeline {
17
- status?: string;
17
+ status?: CourierOrderStatus;
18
18
  }
19
19
  export declare class ServiceOrderStatusTimeline extends StatusTimeline {
20
- status?: string;
20
+ status?: ServiceOrderStatus;
21
21
  }
22
22
  export {};