@lyxa.ai/core 1.0.122-test → 1.0.122

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 (57) hide show
  1. package/dist/libraries/event/EventEnums.d.ts +3 -0
  2. package/dist/libraries/event/EventEnums.js +8 -0
  3. package/dist/libraries/event/EventEnums.js.map +1 -0
  4. package/dist/libraries/event/events/admin-logs-event.d.ts +25 -0
  5. package/dist/libraries/event/events/admin-logs-event.js +23 -0
  6. package/dist/libraries/event/events/admin-logs-event.js.map +1 -0
  7. package/dist/libraries/mongo/models/activity-log.model.d.ts +2 -2
  8. package/dist/libraries/mongo/models/activity-log.model.js +2 -2
  9. package/dist/libraries/mongo/models/activity-log.model.js.map +1 -1
  10. package/dist/libraries/mongo/models/agent-performance.model.js +0 -1
  11. package/dist/libraries/mongo/models/agent-performance.model.js.map +1 -1
  12. package/dist/libraries/mongo/models/app-screen-setting.model.d.ts +9 -0
  13. package/dist/libraries/mongo/models/app-screen-setting.model.js +72 -0
  14. package/dist/libraries/mongo/models/app-screen-setting.model.js.map +1 -0
  15. package/dist/libraries/mongo/models/attribute.model.js +2 -2
  16. package/dist/libraries/mongo/models/attribute.model.js.map +1 -1
  17. package/dist/libraries/mongo/models/embedded/attribute-item.model.js +1 -1
  18. package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
  19. package/dist/libraries/mongo/models/embedded/price-breakdown.model.js +1 -1
  20. package/dist/libraries/mongo/models/embedded/price-breakdown.model.js.map +1 -1
  21. package/dist/libraries/mongo/models/embedded/product-nutrition.model.js +2 -2
  22. package/dist/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -1
  23. package/dist/libraries/mongo/models/embedded/replacement-order.model.d.ts +3 -3
  24. package/dist/libraries/mongo/models/embedded/replacement-order.model.js +6 -6
  25. package/dist/libraries/mongo/models/embedded/replacement-order.model.js.map +1 -1
  26. package/dist/libraries/mongo/models/filter-container.model.d.ts +1 -0
  27. package/dist/libraries/mongo/models/filter-container.model.js +5 -0
  28. package/dist/libraries/mongo/models/filter-container.model.js.map +1 -1
  29. package/dist/libraries/mongo/models/list-container.model.d.ts +1 -0
  30. package/dist/libraries/mongo/models/list-container.model.js +5 -0
  31. package/dist/libraries/mongo/models/list-container.model.js.map +1 -1
  32. package/dist/libraries/mongo/models/order-payment.model.d.ts +17 -0
  33. package/dist/libraries/mongo/models/order-payment.model.js +84 -0
  34. package/dist/libraries/mongo/models/order-payment.model.js.map +1 -0
  35. package/dist/libraries/mongo/models/product.model.d.ts +1 -2
  36. package/dist/libraries/mongo/models/product.model.js +10 -19
  37. package/dist/libraries/mongo/models/product.model.js.map +1 -1
  38. package/dist/libraries/mongo/models/providers/regular-order.model.d.ts +1 -0
  39. package/dist/libraries/mongo/models/providers/regular-order.model.js +5 -0
  40. package/dist/libraries/mongo/models/providers/regular-order.model.js.map +1 -1
  41. package/dist/libraries/mongo/models/ticket.model.js +0 -1
  42. package/dist/libraries/mongo/models/ticket.model.js.map +1 -1
  43. package/dist/libraries/trpc/middlewares/auth.js +0 -1
  44. package/dist/libraries/trpc/middlewares/auth.js.map +1 -1
  45. package/dist/utilities/common/logs-common-methods.d.ts +15 -0
  46. package/dist/utilities/common/logs-common-methods.js +33 -0
  47. package/dist/utilities/common/logs-common-methods.js.map +1 -0
  48. package/dist/utilities/enum.d.ts +57 -0
  49. package/dist/utilities/enum.js +60 -2
  50. package/dist/utilities/enum.js.map +1 -1
  51. package/dist/utilities/validation/common-validation.d.ts +13 -225
  52. package/dist/utilities/validation/common-validation.js +4 -3
  53. package/dist/utilities/validation/common-validation.js.map +1 -1
  54. package/package.json +1 -1
  55. package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.d.ts +0 -16
  56. package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js +0 -61
  57. package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ export declare enum PublishEventEnums {
2
+ ADMIN_ACTIVITY_LOGS_EVENT = "admin_activity_logs_event"
3
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PublishEventEnums = void 0;
4
+ var PublishEventEnums;
5
+ (function (PublishEventEnums) {
6
+ PublishEventEnums["ADMIN_ACTIVITY_LOGS_EVENT"] = "admin_activity_logs_event";
7
+ })(PublishEventEnums || (exports.PublishEventEnums = PublishEventEnums = {}));
8
+ //# sourceMappingURL=EventEnums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventEnums.js","sourceRoot":"/","sources":["libraries/event/EventEnums.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IACzB,4EAAuD,CAAA;AAC3D,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B","sourcesContent":["export enum PublishEventEnums {\n ADMIN_ACTIVITY_LOGS_EVENT = 'admin_activity_logs_event'\n}"]}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import { BaseEvent } from '../BaseEvent';
3
+ import { AdminLogsUpdatedFieldsType } from '../../../utilities/enum';
4
+ import { DTO } from '../../../utilities/validation/global-validation';
5
+ declare const ActivityLogValidationSchema: z.ZodObject<{
6
+ admin: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
7
+ updatedField: z.ZodNativeEnum<typeof AdminLogsUpdatedFieldsType>;
8
+ oldDocument: z.ZodAny;
9
+ newDocument: z.ZodAny;
10
+ }, "strict", z.ZodTypeAny, {
11
+ admin: import("mongoose").Types.ObjectId;
12
+ updatedField: AdminLogsUpdatedFieldsType;
13
+ oldDocument?: any;
14
+ newDocument?: any;
15
+ }, {
16
+ admin: string | import("mongoose").Types.ObjectId;
17
+ updatedField: AdminLogsUpdatedFieldsType;
18
+ oldDocument?: any;
19
+ newDocument?: any;
20
+ }>;
21
+ type CreateActivityLogDTO = DTO<typeof ActivityLogValidationSchema>;
22
+ export declare class AdminActivityLogsEvent extends BaseEvent<Record<string, unknown>> {
23
+ constructor(payload: CreateActivityLogDTO);
24
+ }
25
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminActivityLogsEvent = void 0;
4
+ const zod_1 = require("zod");
5
+ const BaseEvent_1 = require("../BaseEvent");
6
+ const EventEnums_1 = require("../EventEnums");
7
+ const enum_1 = require("../../../utilities/enum");
8
+ const global_validation_1 = require("../../../utilities/validation/global-validation");
9
+ const baseFields = {
10
+ admin: global_validation_1.ZodValidation.objectId('Admin'),
11
+ updatedField: global_validation_1.ZodValidation.enumType(enum_1.AdminLogsUpdatedFieldsType, 'Updated Field'),
12
+ oldDocument: zod_1.z.any(),
13
+ newDocument: zod_1.z.any(),
14
+ };
15
+ const schemaBuilder = (0, global_validation_1.createSchemaBuilder)(baseFields);
16
+ const { BaseSchema: ActivityLogValidationSchema, } = schemaBuilder.getAllSchemas({ createdAt: true });
17
+ class AdminActivityLogsEvent extends BaseEvent_1.BaseEvent {
18
+ constructor(payload) {
19
+ super(EventEnums_1.PublishEventEnums.ADMIN_ACTIVITY_LOGS_EVENT, payload);
20
+ }
21
+ }
22
+ exports.AdminActivityLogsEvent = AdminActivityLogsEvent;
23
+ //# sourceMappingURL=admin-logs-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-logs-event.js","sourceRoot":"/","sources":["libraries/event/events/admin-logs-event.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,4CAAyC;AACzC,8CAAkD;AAClD,kDAAqE;AACrE,uFAA0G;AAE1G,MAAM,UAAU,GAAG;IAClB,KAAK,EAAE,iCAAa,CAAC,QAAQ,CAAC,OAAO,CAAC;IACtC,YAAY,EAAE,iCAAa,CAAC,QAAQ,CAAC,iCAA0B,EAAE,eAAe,CAAC;IACjF,WAAW,EAAE,OAAC,CAAC,GAAG,EAAE;IACpB,WAAW,EAAE,OAAC,CAAC,GAAG,EAAE;CACpB,CAAC;AACF,MAAM,aAAa,GAAG,IAAA,uCAAmB,EAAC,UAAU,CAAC,CAAC;AACtD,MAAM,EACL,UAAU,EAAE,2BAA2B,GACvC,GAAG,aAAa,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAIrD,MAAa,sBAAuB,SAAQ,qBAAkC;IAC7E,YAAY,OAA6B;QACxC,KAAK,CAAC,8BAAiB,CAAC,yBAAyB,EAAE,OAAkC,CAAC,CAAC;IACxF,CAAC;CACD;AAJD,wDAIC","sourcesContent":["import { z } from 'zod';\nimport { BaseEvent } from '../BaseEvent';\nimport { PublishEventEnums } from '../EventEnums';\nimport { AdminLogsUpdatedFieldsType } from '../../../utilities/enum';\nimport { createSchemaBuilder, DTO, ZodValidation } from '../../../utilities/validation/global-validation';\n\nconst baseFields = {\n\tadmin: ZodValidation.objectId('Admin'),\n\tupdatedField: ZodValidation.enumType(AdminLogsUpdatedFieldsType, 'Updated Field'),\n\toldDocument: z.any(),\n\tnewDocument: z.any(),\n};\nconst schemaBuilder = createSchemaBuilder(baseFields);\nconst {\n\tBaseSchema: ActivityLogValidationSchema,\n} = schemaBuilder.getAllSchemas({ createdAt: true });\n\ntype CreateActivityLogDTO = DTO<typeof ActivityLogValidationSchema>;\n\nexport class AdminActivityLogsEvent extends BaseEvent<Record<string, unknown>> {\n\tconstructor(payload: CreateActivityLogDTO) {\n\t\tsuper(PublishEventEnums.ADMIN_ACTIVITY_LOGS_EVENT, payload as Record<string, unknown>);\n\t}\n}"]}
@@ -1,10 +1,10 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { UpdatedField } from '../../../utilities/enum';
4
3
  import { Admin } from './admin.model';
4
+ import { AdminLogsUpdatedFieldsType } from '../../../utilities/enum';
5
5
  export declare class ActivityLog extends TimeStamps {
6
6
  admin: Ref<Admin>;
7
- updatedField: UpdatedField;
7
+ updatedField: AdminLogsUpdatedFieldsType;
8
8
  oldDocument: any;
9
9
  newDocument: any;
10
10
  }
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ActivityLog = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
- const enum_1 = require("../../../utilities/enum");
16
15
  const admin_model_1 = require("./admin.model");
16
+ const enum_1 = require("../../../utilities/enum");
17
17
  let ActivityLog = class ActivityLog extends defaultClasses_1.TimeStamps {
18
18
  admin;
19
19
  updatedField;
@@ -26,7 +26,7 @@ __decorate([
26
26
  __metadata("design:type", Object)
27
27
  ], ActivityLog.prototype, "admin", void 0);
28
28
  __decorate([
29
- (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.UpdatedField }),
29
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.AdminLogsUpdatedFieldsType }),
30
30
  __metadata("design:type", String)
31
31
  ], ActivityLog.prototype, "updatedField", void 0);
32
32
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"activity-log.model.js","sourceRoot":"/","sources":["libraries/mongo/models/activity-log.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmF;AACnF,4EAAqE;AACrE,kDAAuD;AACvD,+CAAsC;AAQ/B,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,2BAAU;IAEnC,KAAK,CAAc;IAGnB,YAAY,CAAgB;IAG5B,WAAW,CAAO;IAGlB,WAAW,CAAO;CACzB,CAAA;AAZY,kCAAW;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;0CACjB;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAY,EAAE,CAAC;;iDACxB;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;;gDACnC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;;gDACnC;sBAXb,WAAW;IANvB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE;QAC7C,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;GACW,WAAW,CAYvB","sourcesContent":["import { modelOptions, prop, Severity, mongoose, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { UpdatedField } from '../../../utilities/enum';\nimport { Admin } from './admin.model';\n\n@modelOptions({\n\tschemaOptions: { collection: 'activityLogs' },\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\nexport class ActivityLog extends TimeStamps {\n\t@prop({ required: true, ref: () => Admin })\n\tpublic admin!: Ref<Admin>;\n\n\t@prop({ required: true, type: String, enum: UpdatedField })\n\tpublic updatedField!: UpdatedField;\n\n\t@prop({ required: true, type: mongoose.Schema.Types.Mixed })\n\tpublic oldDocument!: any;\n\n\t@prop({ required: true, type: mongoose.Schema.Types.Mixed })\n\tpublic newDocument!: any;\n}\n"]}
1
+ {"version":3,"file":"activity-log.model.js","sourceRoot":"/","sources":["libraries/mongo/models/activity-log.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmF;AACnF,4EAAqE;AACrE,+CAAsC;AACtC,kDAAqE;AAQ9D,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,2BAAU;IAEnC,KAAK,CAAc;IAGnB,YAAY,CAA8B;IAG1C,WAAW,CAAO;IAGlB,WAAW,CAAO;CACzB,CAAA;AAZY,kCAAW;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;0CACjB;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iCAA0B,EAAE,CAAC;;iDACxB;AAG1C;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;;gDACnC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;;gDACnC;sBAXb,WAAW;IANvB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE;QAC7C,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;GACW,WAAW,CAYvB","sourcesContent":["import { modelOptions, prop, Severity, mongoose, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Admin } from './admin.model';\nimport { AdminLogsUpdatedFieldsType } from '../../../utilities/enum';\n\n@modelOptions({\n\tschemaOptions: { collection: 'activityLogs' },\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\nexport class ActivityLog extends TimeStamps {\n\t@prop({ required: true, ref: () => Admin })\n\tpublic admin!: Ref<Admin>;\n\n\t@prop({ required: true, type: String, enum: AdminLogsUpdatedFieldsType })\n\tpublic updatedField!: AdminLogsUpdatedFieldsType;\n\n\t@prop({ required: true, type: mongoose.Schema.Types.Mixed })\n\tpublic oldDocument!: any;\n\n\t@prop({ required: true, type: mongoose.Schema.Types.Mixed })\n\tpublic newDocument!: any;\n}\n"]}
@@ -62,7 +62,6 @@ exports.AgentPerformance = AgentPerformance = __decorate([
62
62
  collection: 'agent-performance',
63
63
  },
64
64
  }),
65
- (0, typegoose_1.index)({ admin: 1 }, { unique: true }),
66
65
  (0, typegoose_1.index)({ totalScore: -1 })
67
66
  ], AgentPerformance);
68
67
  //# sourceMappingURL=agent-performance.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-performance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/agent-performance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4EAAqE;AACrE,+CAAsC;AACtC,oDAAsE;AAS/D,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,2BAAU;IAExC,KAAK,CAAc;IAGnB,mBAAmB,GAAW,CAAC,CAAC;IAGhC,oBAAoB,GAAW,CAAC,CAAC;IAGjC,oBAAoB,GAAW,CAAC,CAAC;IAGjC,wBAAwB,GAAW,CAAC,CAAC;IAGrC,wBAAwB,GAAW,CAAC,CAAC;IAGrC,UAAU,GAAW,CAAC,CAAC;IAGvB,gBAAgB,CAAQ;CAC/B,CAAA;AAxBY,4CAAgB;AAErB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;+CAC/B;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;6DACJ;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8DACH;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8DACH;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;kEACC;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;kEACC;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;;oDACvB;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACK,IAAI;0DAAC;2BAvBnB,gBAAgB;IAP5B,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,mBAAmB;SAC/B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACrC,IAAA,iBAAK,EAAC,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC;GACb,gBAAgB,CAwB5B","sourcesContent":["import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Admin } from './admin.model';\nimport { prop, Ref, modelOptions, index } from '@typegoose/typegoose';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'agent-performance',\n\t},\n})\n@index({ admin: 1 }, { unique: true })\n@index({ totalScore: -1 })\nexport class AgentPerformance extends TimeStamps {\n\t@prop({ ref: () => Admin, required: true, unique: true })\n\tpublic admin!: Ref<Admin>;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsOngoing: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsResolved: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsAccepted: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsResolvedTime: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsAcceptedTime: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0, max: 100 })\n\tpublic totalScore: number = 0;\n\n\t@prop({ type: Date })\n\tpublic lastCalculatedAt?: Date;\n}\n"]}
1
+ {"version":3,"file":"agent-performance.model.js","sourceRoot":"/","sources":["libraries/mongo/models/agent-performance.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4EAAqE;AACrE,+CAAsC;AACtC,oDAAsE;AAQ/D,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,2BAAU;IAExC,KAAK,CAAc;IAGnB,mBAAmB,GAAW,CAAC,CAAC;IAGhC,oBAAoB,GAAW,CAAC,CAAC;IAGjC,oBAAoB,GAAW,CAAC,CAAC;IAGjC,wBAAwB,GAAW,CAAC,CAAC;IAGrC,wBAAwB,GAAW,CAAC,CAAC;IAGrC,UAAU,GAAW,CAAC,CAAC;IAGvB,gBAAgB,CAAQ;CAC/B,CAAA;AAxBY,4CAAgB;AAErB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;+CAC/B;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;6DACJ;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8DACH;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8DACH;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;kEACC;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;kEACC;AAGrC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;;oDACvB;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACK,IAAI;0DAAC;2BAvBnB,gBAAgB;IAN5B,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,mBAAmB;SAC/B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC;GACb,gBAAgB,CAwB5B","sourcesContent":["import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Admin } from './admin.model';\nimport { prop, Ref, modelOptions, index } from '@typegoose/typegoose';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'agent-performance',\n\t},\n})\n@index({ totalScore: -1 })\nexport class AgentPerformance extends TimeStamps {\n\t@prop({ ref: () => Admin, required: true, unique: true })\n\tpublic admin!: Ref<Admin>;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsOngoing: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsResolved: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsAccepted: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsResolvedTime: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tpublic totalTicketsAcceptedTime: number = 0;\n\n\t@prop({ type: Number, default: 0, min: 0, max: 100 })\n\tpublic totalScore: number = 0;\n\n\t@prop({ type: Date })\n\tpublic lastCalculatedAt?: Date;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
2
+ import { ItemType, SectionType, Status } from '../../../utilities/enum';
3
+ export declare class AppScreenSetting extends TimeStamps {
4
+ itemType: ItemType;
5
+ section: SectionType;
6
+ alias: string;
7
+ status?: Status;
8
+ sortingOrder?: number;
9
+ }
@@ -0,0 +1,72 @@
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.AppScreenSetting = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
+ const enum_1 = require("../../../utilities/enum");
16
+ const _1 = require(".");
17
+ let AppScreenSetting = class AppScreenSetting extends defaultClasses_1.TimeStamps {
18
+ itemType;
19
+ section;
20
+ alias;
21
+ status;
22
+ sortingOrder;
23
+ };
24
+ exports.AppScreenSetting = AppScreenSetting;
25
+ __decorate([
26
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ItemType }),
27
+ __metadata("design:type", String)
28
+ ], AppScreenSetting.prototype, "itemType", void 0);
29
+ __decorate([
30
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.SectionType }),
31
+ __metadata("design:type", String)
32
+ ], AppScreenSetting.prototype, "section", void 0);
33
+ __decorate([
34
+ (0, typegoose_1.prop)({ required: true, type: String }),
35
+ __metadata("design:type", String)
36
+ ], AppScreenSetting.prototype, "alias", void 0);
37
+ __decorate([
38
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.Status, default: enum_1.Status.ACTIVE }),
39
+ __metadata("design:type", String)
40
+ ], AppScreenSetting.prototype, "status", void 0);
41
+ __decorate([
42
+ (0, typegoose_1.prop)({ type: Number }),
43
+ __metadata("design:type", Number)
44
+ ], AppScreenSetting.prototype, "sortingOrder", void 0);
45
+ exports.AppScreenSetting = AppScreenSetting = __decorate([
46
+ (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'appScreenSettings' } }),
47
+ (0, typegoose_1.pre)('save', async function (next) {
48
+ if (this.isNew || typeof this.sortingOrder === 'undefined') {
49
+ try {
50
+ const maxSortingOrder = await _1.AppScreenSettingModel.aggregate([
51
+ {
52
+ $match: {
53
+ deletedAt: null,
54
+ },
55
+ },
56
+ {
57
+ $group: {
58
+ _id: null,
59
+ maxSortingOrder: { $max: '$sortingOrder' },
60
+ },
61
+ },
62
+ ]).exec();
63
+ this.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;
64
+ }
65
+ catch (error) {
66
+ return next(error);
67
+ }
68
+ }
69
+ next();
70
+ })
71
+ ], AppScreenSetting);
72
+ //# sourceMappingURL=app-screen-setting.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-screen-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/app-screen-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,4EAAqE;AACrE,kDAAw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AE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,gBAAgB,CAe5B","sourcesContent":["import { modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, SectionType, Status } from '../../../utilities/enum';\nimport { AppScreenSettingModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'appScreenSettings' } })\n@pre<AppScreenSetting>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder that aren't deleted\n\t\t\tconst maxSortingOrder = await AppScreenSettingModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class AppScreenSetting extends TimeStamps {\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ required: true, type: String, enum: SectionType })\n\tpublic section!: SectionType;\n\n\t@prop({ required: true, type: String })\n\tpublic alias!: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
@@ -37,7 +37,7 @@ __decorate([
37
37
  __metadata("design:type", Boolean)
38
38
  ], Attribute.prototype, "isMultiSelect", void 0);
39
39
  __decorate([
40
- (0, typegoose_1.prop)({ type: Number, min: 0, default: 0 }),
40
+ (0, typegoose_1.prop)({ type: Number, min: 0, max: 999999999, default: 0 }),
41
41
  __metadata("design:type", Number)
42
42
  ], Attribute.prototype, "maxSelectableItems", void 0);
43
43
  __decorate([
@@ -45,7 +45,7 @@ __decorate([
45
45
  __metadata("design:type", Boolean)
46
46
  ], Attribute.prototype, "isRequired", void 0);
47
47
  __decorate([
48
- (0, typegoose_1.prop)({ type: Number, min: 0, default: 0 }),
48
+ (0, typegoose_1.prop)({ type: Number, min: 0, max: 999999999, default: 0 }),
49
49
  __metadata("design:type", Number)
50
50
  ], Attribute.prototype, "minRequiredItems", void 0);
51
51
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"attribute.model.js","sourceRoot":"/","sources":["libraries/mongo/models/attribute.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,0EAAgE;AAChE,6CAAoC;AAI7B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,2BAAU;IAEjC,IAAI,CAAa;IAGjB,IAAI,CAAU;IAGd,aAAa,CAAW;IAGxB,kBAAkB,CAAU;IAG5B,UAAU,CAAW;IAGrB,gBAAgB,CAAU;IAG1B,KAAK,CAAmB;CAC/B,CAAA;AArBY,8BAAS;AAEd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;uCAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;uCAC7C;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;gDACT;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDACR;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;6CACZ;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mDACV;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,oCAAa,CAAC,EAAE,CAAC;;wCACjB;oBApBnB,SAAS;IAFrB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,CAAC;IAC7D,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;GAC/E,SAAS,CAqBrB","sourcesContent":["import { Index, modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { AttributeItem } from './embedded/attribute-item.model';\nimport { Shop } from './shop.model';\n\n@modelOptions({ schemaOptions: { collection: 'attributes' } })\n@Index({ shop: 1, name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\nexport class Attribute extends TimeStamps {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isMultiSelect?: boolean;\n\n\t@prop({ type: Number, min: 0, default: 0 }) // 0 means, it is disable\n\tpublic maxSelectableItems?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRequired?: boolean;\n\n\t@prop({ type: Number, min: 0, default: 0 }) // 0 means, it is disable\n\tpublic minRequiredItems?: number;\n\n\t@prop({ required: true, type: [AttributeItem] })\n\tpublic items!: AttributeItem[];\n}\n"]}
1
+ {"version":3,"file":"attribute.model.js","sourceRoot":"/","sources":["libraries/mongo/models/attribute.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,0EAAgE;AAChE,6CAAoC;AAI7B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,2BAAU;IAEjC,IAAI,CAAa;IAGjB,IAAI,CAAU;IAGd,aAAa,CAAW;IAGxB,kBAAkB,CAAU;IAG5B,UAAU,CAAW;IAGrB,gBAAgB,CAAU;IAG1B,KAAK,CAAmB;CAC/B,CAAA;AArBY,8BAAS;AAEd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;uCAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;uCAC7C;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;gDACT;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDACxB;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;6CACZ;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;mDAC1B;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,oCAAa,CAAC,EAAE,CAAC;;wCACjB;oBApBnB,SAAS;IAFrB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,CAAC;IAC7D,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;GAC/E,SAAS,CAqBrB","sourcesContent":["import { Index, modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { AttributeItem } from './embedded/attribute-item.model';\nimport { Shop } from './shop.model';\n\n@modelOptions({ schemaOptions: { collection: 'attributes' } })\n@Index({ shop: 1, name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\nexport class Attribute extends TimeStamps {\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isMultiSelect?: boolean;\n\n\t@prop({ type: Number, min: 0, max: 999999999, default: 0 }) // 0 means, it is disable\n\tpublic maxSelectableItems?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRequired?: boolean;\n\n\t@prop({ type: Number, min: 0, max: 999999999, default: 0 }) // 0 means, it is disable\n\tpublic minRequiredItems?: number;\n\n\t@prop({ required: true, type: [AttributeItem] })\n\tpublic items!: AttributeItem[];\n}\n"]}
@@ -22,7 +22,7 @@ __decorate([
22
22
  __metadata("design:type", String)
23
23
  ], AttributeItem.prototype, "name", void 0);
24
24
  __decorate([
25
- (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
25
+ (0, typegoose_1.prop)({ required: true, type: Number, min: 0, max: 999999999 }),
26
26
  __metadata("design:type", Number)
27
27
  ], AttributeItem.prototype, "price", void 0);
28
28
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"attribute-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,aAAa;IAElB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,SAAS,CAAW;CAC3B;AATD,sCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;2CAC7C;AAGd;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,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDACZ","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class AttributeItem {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n\n\t@prop({ type: Boolean, default: true })\n\tpublic isVisible?: boolean;\n}\n"]}
1
+ {"version":3,"file":"attribute-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,aAAa;IAElB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,SAAS,CAAW;CAC3B;AATD,sCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;2CAC7C;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;;4CACzC;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDACZ","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class AttributeItem {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: Number, min: 0, max: 999999999 })\n\tpublic price!: number;\n\n\t@prop({ type: Boolean, default: true })\n\tpublic isVisible?: boolean;\n}\n"]}
@@ -22,7 +22,7 @@ __decorate([
22
22
  __metadata("design:type", String)
23
23
  ], PriceBreakdown.prototype, "unit", void 0);
24
24
  __decorate([
25
- (0, typegoose_1.prop)({ type: Number, min: 0 }),
25
+ (0, typegoose_1.prop)({ type: Number, min: 0, max: 999999999 }),
26
26
  __metadata("design:type", Number)
27
27
  ], PriceBreakdown.prototype, "unitValue", void 0);
28
28
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"price-breakdown.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/price-breakdown.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,cAAc;IAEnB,IAAI,CAAU;IAGd,SAAS,CAAU;IAGnB,KAAK,CAAU;CACtB;AATD,wCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACF;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;iDACL;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;;6CACxC","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class PriceBreakdown {\n\t@prop({ type: String })\n\tpublic unit?: string;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic unitValue?: number;\n\n\t@prop({ required: true, type: Number, min: 0, max: 99999999 })\n\tpublic price!: number;\n}\n"]}
1
+ {"version":3,"file":"price-breakdown.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/price-breakdown.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,cAAc;IAEnB,IAAI,CAAU;IAGd,SAAS,CAAU;IAGnB,KAAK,CAAU;CACtB;AATD,wCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACF;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;;iDACrB;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;;6CACxC","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class PriceBreakdown {\n\t@prop({ type: String })\n\tpublic unit?: string;\n\n\t@prop({ type: Number, min: 0, max: 999999999 })\n\tpublic unitValue?: number;\n\n\t@prop({ required: true, type: Number, min: 0, max: 99999999 })\n\tpublic price!: number;\n}\n"]}
@@ -18,7 +18,7 @@ class ProductNutrition {
18
18
  }
19
19
  exports.ProductNutrition = ProductNutrition;
20
20
  __decorate([
21
- (0, typegoose_1.prop)({ required: true, type: String }),
21
+ (0, typegoose_1.prop)({ required: true, type: String, trim: true, maxlength: 20 }),
22
22
  __metadata("design:type", String)
23
23
  ], ProductNutrition.prototype, "name", void 0);
24
24
  __decorate([
@@ -26,7 +26,7 @@ __decorate([
26
26
  __metadata("design:type", String)
27
27
  ], ProductNutrition.prototype, "unit", void 0);
28
28
  __decorate([
29
- (0, typegoose_1.prop)({ required: true, type: Number }),
29
+ (0, typegoose_1.prop)({ required: true, type: Number, min: 0, max: 999999999 }),
30
30
  __metadata("design:type", Number)
31
31
  ], ProductNutrition.prototype, "unitValue", void 0);
32
32
  //# sourceMappingURL=product-nutrition.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-nutrition.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/product-nutrition.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,gBAAgB;IAE5B,IAAI,CAAS;IAGb,IAAI,CAAS;IAGb,SAAS,CAAS;CAClB;AATD,4CASC;AAPA;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAC1B;AAGb;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAC1B;AAGb;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACrB","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class ProductNutrition {\n\t@prop({ required: true, type: String })\n\tname: string;\n\n\t@prop({ required: true, type: String })\n\tunit: string;\n\n\t@prop({ required: true, type: Number })\n\tunitValue: number;\n}\n"]}
1
+ {"version":3,"file":"product-nutrition.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/product-nutrition.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,gBAAgB;IAE5B,IAAI,CAAS;IAGb,IAAI,CAAS;IAGb,SAAS,CAAS;CAClB;AATD,4CASC;AAPA;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;8CACrD;AAGb;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAC1B;AAGb;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;;mDAC7C","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class ProductNutrition {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tname: string;\n\n\t@prop({ required: true, type: String })\n\tunit: string;\n\n\t@prop({ required: true, type: Number, min: 0, max: 999999999 })\n\tunitValue: number;\n}\n"]}
@@ -5,12 +5,12 @@ export declare class ReplacementOrder {
5
5
  type?: ReplacementType;
6
6
  deliveryFee: number;
7
7
  secondaryDeliveryFee: number;
8
- replacementByShopForItems: number;
9
- secondaryReplacementByShopForItems: number;
8
+ replacementByShopForDelivery: number;
9
+ secondaryReplacementByShopForDelivery: number;
10
10
  replacementByCompanyForItems: number;
11
11
  secondaryReplacementByCompanyForItems: number;
12
12
  replacementByCompanyForDelivery: number;
13
- secondaryReplacementCompanyForDelivery: number;
13
+ secondaryReplacementByCompanyForDelivery: number;
14
14
  totalAmount: number;
15
15
  secondaryTotalAmount: number;
16
16
  }
@@ -18,12 +18,12 @@ class ReplacementOrder {
18
18
  type;
19
19
  deliveryFee;
20
20
  secondaryDeliveryFee;
21
- replacementByShopForItems;
22
- secondaryReplacementByShopForItems;
21
+ replacementByShopForDelivery;
22
+ secondaryReplacementByShopForDelivery;
23
23
  replacementByCompanyForItems;
24
24
  secondaryReplacementByCompanyForItems;
25
25
  replacementByCompanyForDelivery;
26
- secondaryReplacementCompanyForDelivery;
26
+ secondaryReplacementByCompanyForDelivery;
27
27
  totalAmount;
28
28
  secondaryTotalAmount;
29
29
  }
@@ -55,11 +55,11 @@ __decorate([
55
55
  __decorate([
56
56
  (0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
57
57
  __metadata("design:type", Number)
58
- ], ReplacementOrder.prototype, "replacementByShopForItems", void 0);
58
+ ], ReplacementOrder.prototype, "replacementByShopForDelivery", void 0);
59
59
  __decorate([
60
60
  (0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
61
61
  __metadata("design:type", Number)
62
- ], ReplacementOrder.prototype, "secondaryReplacementByShopForItems", void 0);
62
+ ], ReplacementOrder.prototype, "secondaryReplacementByShopForDelivery", void 0);
63
63
  __decorate([
64
64
  (0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
65
65
  __metadata("design:type", Number)
@@ -75,7 +75,7 @@ __decorate([
75
75
  __decorate([
76
76
  (0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
77
77
  __metadata("design:type", Number)
78
- ], ReplacementOrder.prototype, "secondaryReplacementCompanyForDelivery", void 0);
78
+ ], ReplacementOrder.prototype, "secondaryReplacementByCompanyForDelivery", void 0);
79
79
  __decorate([
80
80
  (0, typegoose_1.prop)({ type: Number, required: true, default: 0 }),
81
81
  __metadata("design:type", Number)
@@ -1 +1 @@
1
- {"version":3,"file":"replacement-order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/replacement-order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAyF;AA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AAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;sEACb;AAGtC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+EACJ;AAG/C;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;yEACV;AAGzC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gFACH;AAGhD;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDAC9B;AAGrB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;8DACrB","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { LogUser, ReplacementReason, ReplacementType } from '../../../../utilities/enum';\n\nexport class ReplacementOrder {\n\t@prop({\n\t\ttype: [String],\n\t\tenum: LogUser,\n\t\tdefault: [],\n\t})\n\tlogUsers!: LogUser[];\n\n\t@prop({ required: true, type: String, enum: ReplacementReason })\n\treason: ReplacementReason;\n\n\t@prop({ required: true, type: String, enum: ReplacementType })\n\ttype?: ReplacementType;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tdeliveryFee!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryDeliveryFee!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\treplacementByShopForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryReplacementByShopForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\treplacementByCompanyForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryReplacementByCompanyForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\treplacementByCompanyForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryReplacementCompanyForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\ttotalAmount!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryTotalAmount!: number;\n}\n"]}
1
+ {"version":3,"file":"replacement-order.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/replacement-order.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAyF;AAEzF,MAAa,gBAAgB;IAM5B,QAAQ,CAAa;IAGrB,MAAM,CAAoB;IAG1B,IAAI,CAAmB;IAGvB,WAAW,CAAU;IAGrB,oBAAoB,CAAU;IAG9B,4BAA4B,CAAU;IAGtC,qCAAqC,CAAU;IAG/C,4BAA4B,CAAU;IAGtC,qCAAqC,CAAU;IAG/C,+BAA+B,CAAU;IAGzC,wCAAwC,CAAU;IAGlD,WAAW,CAAU;IAGrB,oBAAoB,CAAU;CAC9B;AA3CD,4CA2CC;AArCA;IALC,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,cAAO;QACb,OAAO,EAAE,EAAE;KACX,CAAC;;kDACmB;AAGrB;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAiB,EAAE,CAAC;;gDACtC;AAG1B;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAe,EAAE,CAAC;;8CACvC;AAGvB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ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Reason, ReplacementType } from '../../../../utilities/enum';\n\nexport class ReplacementOrder {\n\t@prop({\n\t\ttype: [String],\n\t\tenum: LogUser,\n\t\tdefault: [],\n\t})\n\tlogUsers!: LogUser[];\n\n\t@prop({ required: true, type: String, enum: ReplacementReason })\n\treason: ReplacementReason;\n\n\t@prop({ required: true, type: String, enum: ReplacementType })\n\ttype?: ReplacementType;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tdeliveryFee!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryDeliveryFee!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\treplacementByShopForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryReplacementByShopForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\treplacementByCompanyForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryReplacementByCompanyForItems!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\treplacementByCompanyForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryReplacementByCompanyForDelivery!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\ttotalAmount!: number;\n\n\t@prop({ type: Number, required: true, default: 0 })\n\tsecondaryTotalAmount!: number;\n}\n"]}
@@ -6,4 +6,5 @@ export declare class FilterContainer extends TimeStamps {
6
6
  itemType?: UserAppSectionItemType;
7
7
  status?: Status;
8
8
  sortingOrder?: number;
9
+ isVisible: boolean;
9
10
  }
@@ -20,6 +20,7 @@ let FilterContainer = class FilterContainer extends defaultClasses_1.TimeStamps
20
20
  itemType;
21
21
  status;
22
22
  sortingOrder;
23
+ isVisible;
23
24
  };
24
25
  exports.FilterContainer = FilterContainer;
25
26
  __decorate([
@@ -42,6 +43,10 @@ __decorate([
42
43
  (0, typegoose_1.prop)({ type: Number }),
43
44
  __metadata("design:type", Number)
44
45
  ], FilterContainer.prototype, "sortingOrder", void 0);
46
+ __decorate([
47
+ (0, typegoose_1.prop)({ type: Boolean, default: true }),
48
+ __metadata("design:type", Boolean)
49
+ ], FilterContainer.prototype, "isVisible", void 0);
45
50
  exports.FilterContainer = FilterContainer = __decorate([
46
51
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'filterContainers' } }),
47
52
  (0, typegoose_1.Index)({ itemType: 1, deletedAt: 1 }),
@@ -1 +1 @@
1
- {"version":3,"file":"filter-container.model.js","sourceRoot":"/","sources":["libraries/mongo/models/filter-container.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAmF;AACnF,wBAAyC;AAgClC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAU;IAGd,KAAK,CAAY;IAGjB,QAAQ,CAA0B;IAGlC,MAAM,CAAU;IAGhB,YAAY,CAAU;CAC7B,CAAA;AAfY,0CAAe;AAEpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;;8CACjB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;iDACE;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;+CACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACM;0BAdjB,eAAe;IA9B3B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE,EAAE,CAAC;IACnE,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACpC,IAAA,eAAG,EAAkB,MAAM,EAAE,KAAK,WAAW,IAAI;QAEjD,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,uBAAoB,CAAC,SAAS,CAA8B;oBACzF;wBACC,MAAM,EAAE;4BACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,SAAS,EAAE,IAAI;yBACf;qBACD;oBACD;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,eAAe,CAe3B","sourcesContent":["import { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, Status, UserAppSectionItemType } from '../../../utilities/enum';\nimport { FilterContainerModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'filterContainers' } })\n@Index({ itemType: 1, deletedAt: 1 })\n@pre<FilterContainer>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for filterContainers with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await FilterContainerModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class FilterContainer extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: [String] })\n\tpublic deals!: string[]; // e.g., \"5\", \"10\", \"20\", \"30\", \"double_menu\"\n\n\t@prop({ type: String, enum: ItemType })\n\tpublic itemType?: UserAppSectionItemType;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
1
+ {"version":3,"file":"filter-container.model.js","sourceRoot":"/","sources":["libraries/mongo/models/filter-container.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAmF;AACnF,wBAAyC;AAgClC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAU;IAGd,KAAK,CAAY;IAGjB,QAAQ,CAA0B;IAGlC,MAAM,CAAU;IAGhB,YAAY,CAAU;IAGtB,SAAS,CAAU;CAC1B,CAAA;AAlBY,0CAAe;AAEpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,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C,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,eAAe,CAkB3B","sourcesContent":["import { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, Status, UserAppSectionItemType } from '../../../utilities/enum';\nimport { FilterContainerModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'filterContainers' } })\n@Index({ itemType: 1, deletedAt: 1 })\n@pre<FilterContainer>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for filterContainers with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await FilterContainerModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class FilterContainer extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: [String] })\n\tpublic deals!: string[]; // e.g., \"5\", \"10\", \"20\", \"30\", \"double_menu\"\n\n\t@prop({ type: String, enum: ItemType })\n\tpublic itemType?: UserAppSectionItemType;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t@prop({ type: Boolean, default: true })\n\tpublic isVisible!: boolean\n}\n"]}
@@ -13,4 +13,5 @@ export declare class ListContainer extends TimeStamps {
13
13
  itemType?: UserAppSectionItemType;
14
14
  status?: Status;
15
15
  sortingOrder?: number;
16
+ isVisible: boolean;
16
17
  }
@@ -26,6 +26,7 @@ let ListContainer = class ListContainer extends defaultClasses_1.TimeStamps {
26
26
  itemType;
27
27
  status;
28
28
  sortingOrder;
29
+ isVisible;
29
30
  };
30
31
  exports.ListContainer = ListContainer;
31
32
  __decorate([
@@ -64,6 +65,10 @@ __decorate([
64
65
  (0, typegoose_1.prop)({ type: Number }),
65
66
  __metadata("design:type", Number)
66
67
  ], ListContainer.prototype, "sortingOrder", void 0);
68
+ __decorate([
69
+ (0, typegoose_1.prop)({ type: Boolean, default: true }),
70
+ __metadata("design:type", Boolean)
71
+ ], ListContainer.prototype, "isVisible", void 0);
67
72
  exports.ListContainer = ListContainer = __decorate([
68
73
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'listContainers' } }),
69
74
  (0, typegoose_1.Index)({ itemType: 1, deletedAt: 1 }),
@@ -1 +1 @@
1
- {"version":3,"file":"list-container.model.js","sourceRoot":"/","sources":["libraries/mongo/models/list-container.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAmF;AACnF,6CAAoC;AACpC,2CAAkC;AAClC,wBAAuC;AAgChC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,2BAAU;IAErC,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,MAAM,CAAU;IAGhB,KAAK,CAAY;IAGjB,IAAI,CAAc;IAGlB,KAAK,CAAe;IAGpB,QAAQ,CAA0B;IAGlC,MAAM,CAAU;IAGhB,YAAY,CAAU;C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/C,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,qBAAkB,CAAC,SAAS,CAA8B;oBACvF;wBACC,MAAM,EAAE;4BACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,SAAS,EAAE,IAAI;yBACf;qBACD;oBACD;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,aAAa,CA2BzB","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, Status, UserAppSectionItemType } from '../../../utilities/enum';\nimport { Shop } from './shop.model';\nimport { Tag } from './tag.model';\nimport { ListContainerModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'listContainers' } })\n@Index({ itemType: 1, deletedAt: 1 })\n@pre<ListContainer>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for listContainers with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ListContainerModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class ListContainer extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic image!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic banner!: string;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic deals?: string[];\n\n\t@prop({ ref: () => Tag, default: [] })\n\tpublic tags?: Ref<Tag>[];\n\n\t@prop({ ref: () => Shop, default: [] })\n\tpublic shops?: Ref<Shop>[];\n\n\t@prop({ type: String, enum: UserAppSectionItemType })\n\tpublic itemType?: UserAppSectionItemType;\n\n\t@prop({ enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
1
+ {"version":3,"file":"list-container.model.js","sourceRoot":"/","sources":["libraries/mongo/models/list-container.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAmF;AACnF,6CAAoC;AACpC,2CAAkC;AAClC,wBAAuC;AAgChC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,2BAAU;IAErC,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,MAAM,CAAU;IAGhB,KAAK,CAAY;IAGjB,IAAI,CAAc;IAGlB,KAAK,CAAe;IAGpB,QAAQ,CAA0B;IAGlC,MAAM,CAAU;IAGhB,YAAY,CAAU;IAGtB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AAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACpC,IAAA,eAAG,EAAgB,MAAM,EAAE,KAAK,WAAW,IAAI;QAE/C,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,qBAAkB,CAAC,SAAS,CAA8B;oBACvF;wBACC,MAAM,EAAE;4BACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,SAAS,EAAE,IAAI;yBACf;qBACD;oBACD;wBACC,MAAM,EAAE;4BACP,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;yBAC1C;qBACD;iBACD,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,aAAa,CA8BzB","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, Status, UserAppSectionItemType } from '../../../utilities/enum';\nimport { Shop } from './shop.model';\nimport { Tag } from './tag.model';\nimport { ListContainerModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'listContainers' } })\n@Index({ itemType: 1, deletedAt: 1 })\n@pre<ListContainer>('save', async function (next) {\n\t// Only set sortingOrder if it's a new document or sortingOrder is not set\n\tif (this.isNew || typeof this.sortingOrder === 'undefined') {\n\t\ttry {\n\t\t\t// Find the maximum sortingOrder for listContainers with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ListContainerModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\titemType: this.itemType,\n\t\t\t\t\t\tdeletedAt: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t$group: {\n\t\t\t\t\t\t_id: null,\n\t\t\t\t\t\tmaxSortingOrder: { $max: '$sortingOrder' },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]).exec();\n\n\t\t\t// Set the new sortingOrder to max + 1 (or 0 if no items found)\n\t\t\tthis.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n\t\t} catch (error) {\n\t\t\treturn next(error as Error);\n\t\t}\n\t}\n\tnext();\n})\nexport class ListContainer extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic image!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic banner!: string;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic deals?: string[];\n\n\t@prop({ ref: () => Tag, default: [] })\n\tpublic tags?: Ref<Tag>[];\n\n\t@prop({ ref: () => Shop, default: [] })\n\tpublic shops?: Ref<Shop>[];\n\n\t@prop({ type: String, enum: UserAppSectionItemType })\n\tpublic itemType?: UserAppSectionItemType;\n\n\t@prop({ enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t@prop({type: Boolean,default: true})\n\tpublic isVisible!: boolean\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { Ref } from '@typegoose/typegoose';
2
+ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
+ import { Order } from './order.model';
4
+ import { PaymentMethod, PaymentStatus } from '../../../utilities/enum';
5
+ import { PaymentInformation } from './embedded/payment-infromation.model';
6
+ import { PaymentAttempt } from './embedded/payment-attempt.model';
7
+ export declare class OrderPayment extends TimeStamps {
8
+ order: Ref<Order>;
9
+ paymentMethod?: PaymentMethod;
10
+ paymentInformation?: PaymentInformation;
11
+ status?: PaymentStatus;
12
+ receiptUrl?: string;
13
+ attempts?: PaymentAttempt[];
14
+ currency: string;
15
+ amount: number;
16
+ secondaryAmount?: number;
17
+ }
@@ -0,0 +1,84 @@
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.OrderPayment = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
+ const order_model_1 = require("./order.model");
16
+ const enum_1 = require("../../../utilities/enum");
17
+ const payment_infromation_model_1 = require("./embedded/payment-infromation.model");
18
+ const payment_attempt_model_1 = require("./embedded/payment-attempt.model");
19
+ let OrderPayment = class OrderPayment extends defaultClasses_1.TimeStamps {
20
+ order;
21
+ paymentMethod;
22
+ paymentInformation;
23
+ status;
24
+ receiptUrl;
25
+ attempts;
26
+ currency;
27
+ amount;
28
+ secondaryAmount;
29
+ };
30
+ exports.OrderPayment = OrderPayment;
31
+ __decorate([
32
+ (0, typegoose_1.prop)({ required: true, ref: () => order_model_1.Order, index: true, unique: true }),
33
+ __metadata("design:type", Object)
34
+ ], OrderPayment.prototype, "order", void 0);
35
+ __decorate([
36
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentMethod, default: enum_1.PaymentMethod.CASH }),
37
+ __metadata("design:type", String)
38
+ ], OrderPayment.prototype, "paymentMethod", void 0);
39
+ __decorate([
40
+ (0, typegoose_1.prop)({ type: () => payment_infromation_model_1.PaymentInformation }),
41
+ __metadata("design:type", payment_infromation_model_1.PaymentInformation)
42
+ ], OrderPayment.prototype, "paymentInformation", void 0);
43
+ __decorate([
44
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentStatus, default: enum_1.PaymentStatus.PENDING }),
45
+ __metadata("design:type", String)
46
+ ], OrderPayment.prototype, "status", void 0);
47
+ __decorate([
48
+ (0, typegoose_1.prop)(),
49
+ __metadata("design:type", String)
50
+ ], OrderPayment.prototype, "receiptUrl", void 0);
51
+ __decorate([
52
+ (0, typegoose_1.prop)({ type: [payment_attempt_model_1.PaymentAttempt], default: [] }),
53
+ __metadata("design:type", Array)
54
+ ], OrderPayment.prototype, "attempts", void 0);
55
+ __decorate([
56
+ (0, typegoose_1.prop)({ type: String }),
57
+ __metadata("design:type", String)
58
+ ], OrderPayment.prototype, "currency", void 0);
59
+ __decorate([
60
+ (0, typegoose_1.prop)({ required: true, type: Number }),
61
+ __metadata("design:type", Number)
62
+ ], OrderPayment.prototype, "amount", void 0);
63
+ __decorate([
64
+ (0, typegoose_1.prop)({ type: Number }),
65
+ __metadata("design:type", Number)
66
+ ], OrderPayment.prototype, "secondaryAmount", void 0);
67
+ exports.OrderPayment = OrderPayment = __decorate([
68
+ (0, typegoose_1.modelOptions)({
69
+ schemaOptions: {
70
+ timestamps: true,
71
+ collection: 'orderPayments',
72
+ toJSON: { virtuals: true },
73
+ toObject: { virtuals: true },
74
+ },
75
+ options: {
76
+ allowMixed: typegoose_1.Severity.ALLOW,
77
+ },
78
+ }),
79
+ (0, typegoose_1.index)({ order: 1 }),
80
+ (0, typegoose_1.index)({ status: 1 }),
81
+ (0, typegoose_1.index)({ paymentMethod: 1 }),
82
+ (0, typegoose_1.index)({ createdAt: -1 })
83
+ ], OrderPayment);
84
+ //# sourceMappingURL=order-payment.model.js.map