@lyxa.ai/core 1.0.122-test → 1.0.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/libraries/event/EventEnums.d.ts +3 -0
- package/dist/libraries/event/EventEnums.js +8 -0
- package/dist/libraries/event/EventEnums.js.map +1 -0
- package/dist/libraries/event/events/admin-logs-event.d.ts +25 -0
- package/dist/libraries/event/events/admin-logs-event.js +23 -0
- package/dist/libraries/event/events/admin-logs-event.js.map +1 -0
- package/dist/libraries/mongo/models/activity-log.model.d.ts +2 -2
- package/dist/libraries/mongo/models/activity-log.model.js +2 -2
- package/dist/libraries/mongo/models/activity-log.model.js.map +1 -1
- package/dist/libraries/mongo/models/agent-performance.model.js +0 -1
- package/dist/libraries/mongo/models/agent-performance.model.js.map +1 -1
- package/dist/libraries/mongo/models/attribute.model.js +2 -2
- package/dist/libraries/mongo/models/attribute.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js +1 -1
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/product-nutrition.model.js +2 -2
- package/dist/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/replacement-order.model.d.ts +3 -3
- package/dist/libraries/mongo/models/embedded/replacement-order.model.js +6 -6
- package/dist/libraries/mongo/models/embedded/replacement-order.model.js.map +1 -1
- package/dist/libraries/mongo/models/filter-container.model.d.ts +1 -0
- package/dist/libraries/mongo/models/filter-container.model.js +5 -0
- package/dist/libraries/mongo/models/filter-container.model.js.map +1 -1
- package/dist/libraries/mongo/models/list-container.model.d.ts +1 -0
- package/dist/libraries/mongo/models/list-container.model.js +5 -0
- package/dist/libraries/mongo/models/list-container.model.js.map +1 -1
- package/dist/libraries/mongo/models/product.model.d.ts +1 -2
- package/dist/libraries/mongo/models/product.model.js +10 -19
- package/dist/libraries/mongo/models/product.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/regular-order.model.d.ts +1 -0
- package/dist/libraries/mongo/models/providers/regular-order.model.js +5 -0
- package/dist/libraries/mongo/models/providers/regular-order.model.js.map +1 -1
- package/dist/libraries/mongo/models/ticket.model.js +0 -1
- package/dist/libraries/mongo/models/ticket.model.js.map +1 -1
- package/dist/libraries/trpc/middlewares/auth.js +3 -1
- package/dist/libraries/trpc/middlewares/auth.js.map +1 -1
- package/dist/utilities/common/logs-common-methods.d.ts +15 -0
- package/dist/utilities/common/logs-common-methods.js +33 -0
- package/dist/utilities/common/logs-common-methods.js.map +1 -0
- package/dist/utilities/enum.d.ts +57 -0
- package/dist/utilities/enum.js +60 -2
- package/dist/utilities/enum.js.map +1 -1
- package/dist/utilities/validation/common-validation.d.ts +6 -218
- package/dist/utilities/validation/common-validation.js +4 -3
- package/dist/utilities/validation/common-validation.js.map +1 -1
- package/package.json +1 -1
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.d.ts +0 -16
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js +0 -61
- package/dist/libraries/mongo/models/embedded/loyaltyPoint.model.js.map +0 -1
- package/dist/libraries/mongo/models/order-finance.model.d.ts +0 -22
- package/dist/libraries/mongo/models/order-finance.model.js +0 -83
- package/dist/libraries/mongo/models/order-finance.model.js.map +0 -1
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.d.ts +0 -7
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.js +0 -26
- package/dist/libraries/mongo/models/providers/courier-order-finance.model.js.map +0 -1
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.d.ts +0 -25
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.js +0 -95
- package/dist/libraries/mongo/models/providers/regular-order-finance.model.js.map +0 -1
|
@@ -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:
|
|
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.
|
|
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
|
|
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;
|
|
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,o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A,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"]}
|
|
@@ -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;;
|
|
1
|
+
{"version":3,"file":"attribute.model.js","sourceRoot":"/","sources":["libraries/mongo/models/attribute.model.ts"],"names":[],"mappings":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,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;;
|
|
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;;
|
|
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;;
|
|
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
|
-
|
|
9
|
-
|
|
8
|
+
replacementByShopForDelivery: number;
|
|
9
|
+
secondaryReplacementByShopForDelivery: number;
|
|
10
10
|
replacementByCompanyForItems: number;
|
|
11
11
|
secondaryReplacementByCompanyForItems: number;
|
|
12
12
|
replacementByCompanyForDelivery: number;
|
|
13
|
-
|
|
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
|
-
|
|
22
|
-
|
|
21
|
+
replacementByShopForDelivery;
|
|
22
|
+
secondaryReplacementByShopForDelivery;
|
|
23
23
|
replacementByCompanyForItems;
|
|
24
24
|
secondaryReplacementByCompanyForItems;
|
|
25
25
|
replacementByCompanyForDelivery;
|
|
26
|
-
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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;AAEzF,MAAa,gBAAgB;IAM5B,QAAQ,CAAa;IAGrB,MAAM,CAAoB;IAG1B,IAAI,CAAmB;IAGvB,WAAW,CAAU;IAGrB,oBAAoB,CAAU;IAG9B,
|
|
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,EA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ser, 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\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"]}
|
|
@@ -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;
|
|
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,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;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AAe,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"]}
|
|
@@ -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;
|
|
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,2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E,CAAC;;mDACM;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAC,IAAI,EAAE,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;;gDACV;wBA7Bd,aAAa;IA9BzB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;IACjE,IAAA,iBAAK,EAAC,EAAE,QAAQ,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"]}
|
|
@@ -20,10 +20,9 @@ export declare class Product extends TimeStamps {
|
|
|
20
20
|
description?: string;
|
|
21
21
|
attributeMaps?: AttributeMap[];
|
|
22
22
|
addons?: Ref<Product>[];
|
|
23
|
+
isNutritionEnabled?: boolean;
|
|
23
24
|
nutritionPackSize?: number;
|
|
24
25
|
nutritionPackSizeUnit?: string;
|
|
25
|
-
nutritionServingSize?: number;
|
|
26
|
-
nutritionCalories?: number;
|
|
27
26
|
nutritions?: ProductNutrition[];
|
|
28
27
|
dietaryTypes?: ProductDietaryType[];
|
|
29
28
|
storedTemperature?: number;
|
|
@@ -33,10 +33,9 @@ let Product = class Product extends defaultClasses_1.TimeStamps {
|
|
|
33
33
|
description;
|
|
34
34
|
attributeMaps;
|
|
35
35
|
addons;
|
|
36
|
+
isNutritionEnabled;
|
|
36
37
|
nutritionPackSize;
|
|
37
38
|
nutritionPackSizeUnit;
|
|
38
|
-
nutritionServingSize;
|
|
39
|
-
nutritionCalories;
|
|
40
39
|
nutritions;
|
|
41
40
|
dietaryTypes;
|
|
42
41
|
storedTemperature;
|
|
@@ -57,11 +56,11 @@ __decorate([
|
|
|
57
56
|
__metadata("design:type", Object)
|
|
58
57
|
], Product.prototype, "shop", void 0);
|
|
59
58
|
__decorate([
|
|
60
|
-
(0, typegoose_1.prop)({ required: true, type: String, maxlength: 100 }),
|
|
59
|
+
(0, typegoose_1.prop)({ required: true, type: String, trim: true, maxlength: 100 }),
|
|
61
60
|
__metadata("design:type", String)
|
|
62
61
|
], Product.prototype, "name", void 0);
|
|
63
62
|
__decorate([
|
|
64
|
-
(0, typegoose_1.prop)({ type: String,
|
|
63
|
+
(0, typegoose_1.prop)({ type: String, trim: true, maxlength: 50 }),
|
|
65
64
|
__metadata("design:type", String)
|
|
66
65
|
], Product.prototype, "barcode", void 0);
|
|
67
66
|
__decorate([
|
|
@@ -73,7 +72,7 @@ __decorate([
|
|
|
73
72
|
__metadata("design:type", String)
|
|
74
73
|
], Product.prototype, "itemType", void 0);
|
|
75
74
|
__decorate([
|
|
76
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.ProductType
|
|
75
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.ProductType }),
|
|
77
76
|
__metadata("design:type", String)
|
|
78
77
|
], Product.prototype, "productType", void 0);
|
|
79
78
|
__decorate([
|
|
@@ -104,6 +103,10 @@ __decorate([
|
|
|
104
103
|
(0, typegoose_1.prop)({ ref: () => Product, default: [] }),
|
|
105
104
|
__metadata("design:type", Array)
|
|
106
105
|
], Product.prototype, "addons", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
108
|
+
__metadata("design:type", Boolean)
|
|
109
|
+
], Product.prototype, "isNutritionEnabled", void 0);
|
|
107
110
|
__decorate([
|
|
108
111
|
(0, typegoose_1.prop)({ type: Number, min: 0 }),
|
|
109
112
|
__metadata("design:type", Number)
|
|
@@ -112,14 +115,6 @@ __decorate([
|
|
|
112
115
|
(0, typegoose_1.prop)({ type: String }),
|
|
113
116
|
__metadata("design:type", String)
|
|
114
117
|
], Product.prototype, "nutritionPackSizeUnit", void 0);
|
|
115
|
-
__decorate([
|
|
116
|
-
(0, typegoose_1.prop)({ type: Number, min: 0 }),
|
|
117
|
-
__metadata("design:type", Number)
|
|
118
|
-
], Product.prototype, "nutritionServingSize", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
(0, typegoose_1.prop)({ type: Number, min: 0 }),
|
|
121
|
-
__metadata("design:type", Number)
|
|
122
|
-
], Product.prototype, "nutritionCalories", void 0);
|
|
123
118
|
__decorate([
|
|
124
119
|
(0, typegoose_1.prop)({ type: [product_nutrition_model_1.ProductNutrition], default: [] }),
|
|
125
120
|
__metadata("design:type", Array)
|
|
@@ -137,7 +132,7 @@ __decorate([
|
|
|
137
132
|
__metadata("design:type", Boolean)
|
|
138
133
|
], Product.prototype, "isStockEnabled", void 0);
|
|
139
134
|
__decorate([
|
|
140
|
-
(0, typegoose_1.prop)({ type: Number }),
|
|
135
|
+
(0, typegoose_1.prop)({ type: Number, max: 999999999 }),
|
|
141
136
|
__metadata("design:type", Number)
|
|
142
137
|
], Product.prototype, "stockQuantity", void 0);
|
|
143
138
|
__decorate([
|
|
@@ -157,7 +152,7 @@ __decorate([
|
|
|
157
152
|
__metadata("design:type", Number)
|
|
158
153
|
], Product.prototype, "numberOfPreparingHours", void 0);
|
|
159
154
|
__decorate([
|
|
160
|
-
(0, typegoose_1.prop)({ type: Number,
|
|
155
|
+
(0, typegoose_1.prop)({ type: Number, min: 0, max: 999999999 }),
|
|
161
156
|
__metadata("design:type", Number)
|
|
162
157
|
], Product.prototype, "orderQuantityLimit", void 0);
|
|
163
158
|
__decorate([
|
|
@@ -175,10 +170,6 @@ __decorate([
|
|
|
175
170
|
exports.Product = Product = __decorate([
|
|
176
171
|
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'products' } }),
|
|
177
172
|
(0, typegoose_1.Index)({ name: 1, shop: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
|
|
178
|
-
(0, typegoose_1.Index)({ barcode: 1, shop: 1 }, {
|
|
179
|
-
unique: true,
|
|
180
|
-
partialFilterExpression: { barcode: { $exists: true, $nin: [null, '0000000'] }, deletedAt: null },
|
|
181
|
-
}),
|
|
182
173
|
(0, typegoose_1.Index)({ shop: 1, shopCategory: 1, deletedAt: 1 }),
|
|
183
174
|
(0, typegoose_1.Index)({ shop: 1, isStockEnabled: 1, stockQuantity: 1, deletedAt: 1 }),
|
|
184
175
|
(0, typegoose_1.pre)('save', async function (next) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAyG;AACzG,gFAAsE;AACtE,6CAAoC;AACpC,4EAAkE;AAClE,wEAA8D;AAC9D,+DAAqD;AACrD,wBAAiC;
|
|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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,OAAO,CAuFnB","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ProductType, ItemType, ProductDietaryType, Status, PriceOption } from '../../../utilities/enum';\nimport { ProductNutrition } from './embedded/product-nutrition.model';\nimport { Shop } from './shop.model';\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\nimport { AttributeMap } from './embedded/attribute-map.model';\nimport { ShopCategory } from './shop-category.model';\nimport { ProductModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'products' } })\n@Index({ name: 1, shop: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index({ shop: 1, shopCategory: 1, deletedAt: 1 })\n@Index({ shop: 1, isStockEnabled: 1, stockQuantity: 1, deletedAt: 1 })\n@pre<Product>('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 products with the same shop and shopCategory that aren't deleted\n\t\t\tconst maxSortingOrder = await ProductModel.aggregate<{ maxSortingOrder: number }>([\n\t\t\t\t{\n\t\t\t\t\t$match: {\n\t\t\t\t\t\tshop: this.shop,\n\t\t\t\t\t\tshopCategory: this.shopCategory,\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 Product 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: 100 })\n\tpublic name!: string;\n\n\t@prop({ type: String, trim: true, maxlength: 50 })\n\tpublic barcode?: string;\n\n\t@prop({ required: true, ref: () => ShopCategory })\n\tpublic shopCategory!: Ref<ShopCategory>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ type: String, enum: ProductType })\n\tpublic productType?: ProductType;\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: [String], default: [] })\n\tpublic images?: string[];\n\n\t@prop({ type: String, enum: PriceOption, default: PriceOption.SINGLE_PRICE })\n\tpublic priceOption?: PriceOption;\n\n\t@prop({ required: true, type: [PriceBreakdown] })\n\tpublic priceBreakdowns?: PriceBreakdown[];\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic description?: string;\n\n\t@prop({ type: [AttributeMap], default: [] })\n\tpublic attributeMaps?: AttributeMap[];\n\n\t@prop({ ref: () => Product, default: [] })\n\tpublic addons?: Ref<Product>[];\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isNutritionEnabled?: boolean;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionPackSize?: number;\n\n\t@prop({ type: String })\n\tpublic nutritionPackSizeUnit?: string;\n\n\t@prop({ type: [ProductNutrition], default: [] })\n\tpublic nutritions?: ProductNutrition[];\n\n\t@prop({ type: [String], enum: ProductDietaryType, default: [] })\n\tpublic dietaryTypes?: ProductDietaryType[];\n\n\t@prop({ type: Number, min: -9999, max: 9999 })\n\tpublic storedTemperature?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isStockEnabled?: boolean;\n\n\t@prop({ type: Number, max: 999999999 }) // isStockEnabled: true and stockQuantity < 1 means out of stock\n\tpublic stockQuantity?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isDrinkIncluded?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLargeItem?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isPreOrderEnabled?: boolean;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic numberOfPreparingHours?: number;\n\n\t@prop({ type: Number, min: 0, max: 999999999 }) // 0 means, it is disable\n\tpublic orderQuantityLimit?: number;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic note?: 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"]}
|
|
@@ -33,6 +33,7 @@ class RegularOrder extends order_model_1.Order {
|
|
|
33
33
|
shop;
|
|
34
34
|
cart;
|
|
35
35
|
isShopDelivery;
|
|
36
|
+
isShopReject;
|
|
36
37
|
preparingTimeInMinutes;
|
|
37
38
|
isReplacementOrder;
|
|
38
39
|
originalOrderForReplacement;
|
|
@@ -81,6 +82,10 @@ __decorate([
|
|
|
81
82
|
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
82
83
|
__metadata("design:type", Boolean)
|
|
83
84
|
], RegularOrder.prototype, "isShopDelivery", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
87
|
+
__metadata("design:type", Boolean)
|
|
88
|
+
], RegularOrder.prototype, "isShopReject", void 0);
|
|
84
89
|
__decorate([
|
|
85
90
|
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
86
91
|
__metadata("design:type", Number)
|