@lyxa.ai/core 1.3.231 → 1.3.252

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 (62) hide show
  1. package/dist/libraries/mongo/models/embedded/cleaning-material.model.d.ts +4 -0
  2. package/dist/libraries/mongo/models/embedded/cleaning-material.model.js +27 -0
  3. package/dist/libraries/mongo/models/embedded/cleaning-material.model.js.map +1 -0
  4. package/dist/libraries/mongo/models/embedded/service-order-settings.model.d.ts +5 -5
  5. package/dist/libraries/mongo/models/embedded/service-order-settings.model.js +14 -23
  6. package/dist/libraries/mongo/models/embedded/service-order-settings.model.js.map +1 -1
  7. package/dist/libraries/mongo/models/index.d.ts +6 -9
  8. package/dist/libraries/mongo/models/index.js +7 -11
  9. package/dist/libraries/mongo/models/index.js.map +1 -1
  10. package/dist/libraries/mongo/models/professional-blocked-time.model.d.ts +10 -0
  11. package/dist/libraries/mongo/models/{blocked-time.model.js → professional-blocked-time.model.js} +13 -23
  12. package/dist/libraries/mongo/models/professional-blocked-time.model.js.map +1 -0
  13. package/dist/libraries/mongo/models/professional.model.d.ts +4 -8
  14. package/dist/libraries/mongo/models/professional.model.js +11 -25
  15. package/dist/libraries/mongo/models/professional.model.js.map +1 -1
  16. package/dist/libraries/mongo/models/service-addon.model.d.ts +15 -0
  17. package/dist/libraries/mongo/models/{addon.model.js → service-addon.model.js} +30 -62
  18. package/dist/libraries/mongo/models/service-addon.model.js.map +1 -0
  19. package/dist/libraries/mongo/models/service-category.model.d.ts +5 -5
  20. package/dist/libraries/mongo/models/service-category.model.js +10 -6
  21. package/dist/libraries/mongo/models/service-category.model.js.map +1 -1
  22. package/dist/libraries/mongo/models/service-line-item.model.d.ts +2 -2
  23. package/dist/libraries/mongo/models/service-line-item.model.js +2 -2
  24. package/dist/libraries/mongo/models/service-line-item.model.js.map +1 -1
  25. package/dist/libraries/mongo/models/service-package.model.d.ts +11 -12
  26. package/dist/libraries/mongo/models/service-package.model.js +25 -43
  27. package/dist/libraries/mongo/models/service-package.model.js.map +1 -1
  28. package/dist/libraries/mongo/models/service.model.d.ts +4 -5
  29. package/dist/libraries/mongo/models/service.model.js +7 -7
  30. package/dist/libraries/mongo/models/service.model.js.map +1 -1
  31. package/dist/libraries/mongo/models/shared/work-hour.model.d.ts +2 -10
  32. package/dist/libraries/mongo/models/shared/work-hour.model.js +7 -31
  33. package/dist/libraries/mongo/models/shared/work-hour.model.js.map +1 -1
  34. package/dist/libraries/mongo/models/vendor-parent.model.d.ts +3 -2
  35. package/dist/libraries/mongo/models/vendor-parent.model.js +26 -7
  36. package/dist/libraries/mongo/models/vendor-parent.model.js.map +1 -1
  37. package/dist/libraries/mongo/models/vendor.model.d.ts +3 -12
  38. package/dist/libraries/mongo/models/vendor.model.js +6 -58
  39. package/dist/libraries/mongo/models/vendor.model.js.map +1 -1
  40. package/dist/libraries/trpc/middlewares/auth.d.ts +1 -1
  41. package/dist/libraries/trpc/middlewares/createRoleProtectedProcedure.d.ts +1 -1
  42. package/dist/libraries/trpc/middlewares/phone-verified.d.ts +1 -1
  43. package/dist/libraries/trpc/middlewares/publicUserDecoder.d.ts +1 -1
  44. package/dist/types/README.md +1 -1
  45. package/dist/types/package.json +1 -1
  46. package/dist/types/utilities/enum.d.ts +7 -8
  47. package/dist/types/utilities/enum.js +8 -8
  48. package/dist/types/utilities/enum.js.map +1 -1
  49. package/dist/types/utilities/validation/common-validation.d.ts +12 -12
  50. package/dist/utilities/enum.d.ts +7 -8
  51. package/dist/utilities/enum.js +8 -8
  52. package/dist/utilities/enum.js.map +1 -1
  53. package/dist/utilities/id-generator.js +1 -0
  54. package/dist/utilities/id-generator.js.map +1 -1
  55. package/package.json +1 -1
  56. package/dist/libraries/mongo/models/addon.model.d.ts +0 -15
  57. package/dist/libraries/mongo/models/addon.model.js.map +0 -1
  58. package/dist/libraries/mongo/models/blocked-time.model.d.ts +0 -11
  59. package/dist/libraries/mongo/models/blocked-time.model.js.map +0 -1
  60. package/dist/libraries/mongo/models/professional-schedule.d.ts +0 -20
  61. package/dist/libraries/mongo/models/professional-schedule.js +0 -102
  62. package/dist/libraries/mongo/models/professional-schedule.js.map +0 -1
@@ -15,7 +15,6 @@ const vendor_model_1 = require("./vendor.model");
15
15
  const enum_1 = require("../../../utilities/enum");
16
16
  const password_1 = require("../../../utilities/password");
17
17
  const work_hour_model_1 = require("./shared/work-hour.model");
18
- const service_model_1 = require("./service.model");
19
18
  const id_generator_1 = require("../../../utilities/id-generator");
20
19
  const _1 = require(".");
21
20
  let Professional = class Professional {
@@ -29,10 +28,7 @@ let Professional = class Professional {
29
28
  vendor;
30
29
  availability;
31
30
  worksOn;
32
- avgRating;
33
- totalReviews;
34
31
  status;
35
- currentStatus;
36
32
  };
37
33
  exports.Professional = Professional;
38
34
  __decorate([
@@ -40,19 +36,19 @@ __decorate([
40
36
  __metadata("design:type", String)
41
37
  ], Professional.prototype, "professionalId", void 0);
42
38
  __decorate([
43
- (0, typegoose_1.prop)({ required: true, trim: true }),
39
+ (0, typegoose_1.prop)({ required: true, type: String, trim: true }),
44
40
  __metadata("design:type", String)
45
41
  ], Professional.prototype, "name", void 0);
46
42
  __decorate([
47
- (0, typegoose_1.prop)({ required: true }),
43
+ (0, typegoose_1.prop)({ required: true, type: String }),
48
44
  __metadata("design:type", String)
49
45
  ], Professional.prototype, "image", void 0);
50
46
  __decorate([
51
- (0, typegoose_1.prop)({ required: true, unique: true }),
47
+ (0, typegoose_1.prop)({ required: true, type: String }),
52
48
  __metadata("design:type", String)
53
49
  ], Professional.prototype, "phoneNumber", void 0);
54
50
  __decorate([
55
- (0, typegoose_1.prop)({ required: true, unique: true }),
51
+ (0, typegoose_1.prop)({ required: true, type: String }),
56
52
  __metadata("design:type", String)
57
53
  ], Professional.prototype, "email", void 0);
58
54
  __decorate([
@@ -60,37 +56,25 @@ __decorate([
60
56
  __metadata("design:type", String)
61
57
  ], Professional.prototype, "password", void 0);
62
58
  __decorate([
63
- (0, typegoose_1.prop)(),
59
+ (0, typegoose_1.prop)({ type: String }),
64
60
  __metadata("design:type", String)
65
61
  ], Professional.prototype, "nationality", void 0);
66
62
  __decorate([
67
- (0, typegoose_1.prop)({ ref: () => vendor_model_1.Vendor, required: true }),
63
+ (0, typegoose_1.prop)({ required: true, ref: () => vendor_model_1.Vendor }),
68
64
  __metadata("design:type", Object)
69
65
  ], Professional.prototype, "vendor", void 0);
70
66
  __decorate([
71
- (0, typegoose_1.prop)({ type: () => work_hour_model_1.TeamMemberWorkHourSetting, default: [] }),
67
+ (0, typegoose_1.prop)({ type: () => work_hour_model_1.TeamMemberAvailability, default: [] }),
72
68
  __metadata("design:type", Array)
73
69
  ], Professional.prototype, "availability", void 0);
74
70
  __decorate([
75
- (0, typegoose_1.prop)({ ref: () => service_model_1.Service, default: [] }),
71
+ (0, typegoose_1.prop)({ required: true, type: [String], enum: enum_1.SubServiceType }),
76
72
  __metadata("design:type", Array)
77
73
  ], Professional.prototype, "worksOn", void 0);
78
- __decorate([
79
- (0, typegoose_1.prop)({ type: Number, default: 0 }),
80
- __metadata("design:type", Number)
81
- ], Professional.prototype, "avgRating", void 0);
82
- __decorate([
83
- (0, typegoose_1.prop)({ type: Number, default: 0 }),
84
- __metadata("design:type", Number)
85
- ], Professional.prototype, "totalReviews", void 0);
86
74
  __decorate([
87
75
  (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.Status, default: enum_1.Status.ACTIVE }),
88
76
  __metadata("design:type", String)
89
77
  ], Professional.prototype, "status", void 0);
90
- __decorate([
91
- (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ProfessionalStatus, default: enum_1.ProfessionalStatus.AVAILABLE }),
92
- __metadata("design:type", String)
93
- ], Professional.prototype, "currentStatus", void 0);
94
78
  exports.Professional = Professional = __decorate([
95
79
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'professionals', timestamps: true } }),
96
80
  (0, typegoose_1.pre)('save', async function () {
@@ -100,6 +84,8 @@ exports.Professional = Professional = __decorate([
100
84
  if (this.isModified('password')) {
101
85
  this.password = await (0, password_1.hashPassword)(this.password);
102
86
  }
103
- })
87
+ }),
88
+ (0, typegoose_1.Index)({ phoneNumber: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
89
+ (0, typegoose_1.Index)({ email: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })
104
90
  ], Professional);
105
91
  //# sourceMappingURL=professional.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"professional.model.js","sourceRoot":"/","sources":["libraries/mongo/models/professional.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoE;AACpE,iDAAwC;AACxC,kDAAkF;AAClF,0DAA2D;AAC3D,8DAAqE;AACrE,mDAA0C;AAC1C,kEAA6D;AAC7D,wBAAiC;AAmB1B,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEjB,cAAc,CAAU;IAGxB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,KAAK,CAAU;IAGf,QAAQ,CAAU;IAGlB,WAAW,CAAU;IAGrB,MAAM,CAAe;IAGrB,YAAY,CAA8B;IAG1C,OAAO,CAAkB;IAGzB,SAAS,CAAU;IAGnB,YAAY,CAAU;IAGtB,MAAM,CAAU;IAGhB,aAAa,CAAsB;CAC1C,CAAA;AA1CY,oCAAY;AAEjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;oDACnB;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;0CAChB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACH;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;iDACX;AAGrB;IADN,IAAA,g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AAM,EAAE,KAAK;QAE/B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,cAAc,GAAG,MAAM,IAAA,yBAAU,EACrC,eAAY,EACZ,kBAAW,CAAC,WAAW,CACvB,CAAC;QACH,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,MAAM,IAAA,uBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnD,CAAC;IACF,CAAC,CAAC;GAGW,YAAY,CA0CxB","sourcesContent":["import { prop, Ref, modelOptions, pre } from '@typegoose/typegoose';\nimport { Vendor } from './vendor.model';\nimport { CounterType, ProfessionalStatus, Status } from '../../../utilities/enum';\nimport { hashPassword } from '../../../utilities/password';\nimport { TeamMemberWorkHourSetting } from './shared/work-hour.model';\nimport { Service } from './service.model';\nimport { generateId } from '../../../utilities/id-generator';\nimport { CounterModel } from '.';\n\n\n@modelOptions({ schemaOptions: { collection: 'professionals', timestamps: true } })\n@pre<Professional>('save', async function () {\n\n\tif (this.isNew) {\n\t\tthis.professionalId = await generateId(\n\t\t\tCounterModel,\n\t\t\tCounterType.TEAM_MEMBER\n\t\t);\n\t}\n\n\tif (this.isModified('password')) {\n\t\tthis.password = await hashPassword(this.password);\n\t}\n})\n\n\nexport class Professional {\n\t@prop({ type: String, unique: true, index: true })\n\tpublic professionalId!: string;\n\n\t@prop({ required: true, trim: true })\n\tpublic name!: string;\n\n\t@prop({ required: true })\n\tpublic image!: string;\n\n\t@prop({ required: true, unique: true })\n\tpublic phoneNumber!: string;\n\n\t@prop({ required: true, unique: true })\n\tpublic email!: string;\n\n\t@prop({ type: String })\n\tpublic password!: string;\n\n\t@prop()\n\tpublic nationality?: string;\n\n\t@prop({ ref: () => Vendor, required: true })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ type: () => TeamMemberWorkHourSetting, default: [] })\n\tpublic availability!: TeamMemberWorkHourSetting[]\n\n\t@prop({ ref: () => Service, default: [] })\n\tpublic worksOn!: Ref<Service>[];\n\n\t@prop({ type: Number, default: 0 })\n\tpublic avgRating?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic totalReviews!: number;\n\n\t@prop({ required: true, type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status!: Status;\n\n\t@prop({ required: true, type: String, enum: ProfessionalStatus, default: ProfessionalStatus.AVAILABLE })\n\tpublic currentStatus?: ProfessionalStatus;\n}\n"]}
1
+ {"version":3,"file":"professional.model.js","sourceRoot":"/","sources":["libraries/mongo/models/professional.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,iDAAwC;AACxC,kDAA8E;AAC9E,0DAA2D;AAC3D,8DAAkE;AAClE,kEAA6D;AAC7D,wBAAiC;AAc1B,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEjB,cAAc,CAAU;IAGxB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,KAAK,CAAU;IAGf,QAAQ,CAAU;IAGlB,WAAW,CAAU;IAGrB,MAAM,CAAe;IAGrB,YAAY,CAA4B;IAGxC,OAAO,CAAoB;IAG3B,MAAM,CAAU;CACvB,CAAA;AAjCY,oCAAY;AAEjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;oDACnB;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;0CAC9B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDAC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AI,CAAC,QAAQ,CAAC,CAAC;QACnD,CAAC;IACF,CAAC,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IACzF,IAAA,iBAAK,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;GACvE,YAAY,CAiCxB","sourcesContent":["import { prop, Ref, modelOptions, pre, Index } from '@typegoose/typegoose';\nimport { Vendor } from './vendor.model';\nimport { CounterType, Status, SubServiceType } from '../../../utilities/enum';\nimport { hashPassword } from '../../../utilities/password';\nimport { TeamMemberAvailability } from './shared/work-hour.model';\nimport { generateId } from '../../../utilities/id-generator';\nimport { CounterModel } from '.';\n\n@modelOptions({ schemaOptions: { collection: 'professionals', timestamps: true } })\n@pre<Professional>('save', async function () {\n\tif (this.isNew) {\n\t\tthis.professionalId = await generateId(CounterModel, CounterType.TEAM_MEMBER);\n\t}\n\n\tif (this.isModified('password')) {\n\t\tthis.password = await hashPassword(this.password);\n\t}\n})\n@Index({ phoneNumber: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index({ email: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\nexport class Professional {\n\t@prop({ type: String, unique: true, index: true })\n\tpublic professionalId!: string;\n\n\t@prop({ required: true, type: String, trim: true })\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 phoneNumber!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic email!: string;\n\n\t@prop({ type: String })\n\tpublic password!: string;\n\n\t@prop({ type: String })\n\tpublic nationality?: string;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ type: () => TeamMemberAvailability, default: [] })\n\tpublic availability!: TeamMemberAvailability[];\n\n\t@prop({ required: true, type: [String], enum: SubServiceType })\n\tpublic worksOn!: SubServiceType[];\n\n\t@prop({ required: true, type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status!: Status;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { Ref } from '@typegoose/typegoose';
2
+ import { Vendor } from './index';
3
+ import { ServiceType, Status, SubServiceType } from '../../../utilities/enum';
4
+ import { PreparingTime } from './embedded/preparing-time.model';
5
+ export declare class ServiceAddon {
6
+ name: string;
7
+ serviceType: ServiceType;
8
+ subServiceTypes?: SubServiceType[];
9
+ vendor: Ref<Vendor>;
10
+ image: string;
11
+ price: number;
12
+ duration: PreparingTime;
13
+ description?: string;
14
+ status: Status;
15
+ }
@@ -12,99 +12,67 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.AddOn = void 0;
15
+ exports.ServiceAddon = void 0;
16
16
  const typegoose_1 = require("@typegoose/typegoose");
17
17
  const mongoose_1 = __importDefault(require("mongoose"));
18
18
  const index_1 = require("./index");
19
19
  const enum_1 = require("../../../utilities/enum");
20
- let AddOn = class AddOn {
20
+ const preparing_time_model_1 = require("./embedded/preparing-time.model");
21
+ let ServiceAddon = class ServiceAddon {
21
22
  name;
22
- service;
23
+ serviceType;
24
+ subServiceTypes;
23
25
  vendor;
24
26
  image;
25
27
  price;
26
- hours;
27
- minutes;
28
+ duration;
28
29
  description;
29
30
  status;
30
- isVisible;
31
31
  };
32
- exports.AddOn = AddOn;
32
+ exports.ServiceAddon = ServiceAddon;
33
33
  __decorate([
34
34
  (0, typegoose_1.prop)({ required: true, trim: true }),
35
35
  __metadata("design:type", String)
36
- ], AddOn.prototype, "name", void 0);
36
+ ], ServiceAddon.prototype, "name", void 0);
37
37
  __decorate([
38
- (0, typegoose_1.prop)({
39
- required: true,
40
- type: () => [mongoose_1.default.Types.ObjectId],
41
- ref: () => index_1.Service,
42
- }),
38
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ServiceType }),
39
+ __metadata("design:type", String)
40
+ ], ServiceAddon.prototype, "serviceType", void 0);
41
+ __decorate([
42
+ (0, typegoose_1.prop)({ type: [String], enum: enum_1.SubServiceType }),
43
43
  __metadata("design:type", Array)
44
- ], AddOn.prototype, "service", void 0);
44
+ ], ServiceAddon.prototype, "subServiceTypes", void 0);
45
45
  __decorate([
46
- (0, typegoose_1.prop)({
47
- required: true,
48
- type: () => mongoose_1.default.Types.ObjectId,
49
- ref: () => index_1.Vendor,
50
- }),
46
+ (0, typegoose_1.prop)({ required: true, type: () => mongoose_1.default.Types.ObjectId, ref: () => index_1.Vendor }),
51
47
  __metadata("design:type", Object)
52
- ], AddOn.prototype, "vendor", void 0);
48
+ ], ServiceAddon.prototype, "vendor", void 0);
53
49
  __decorate([
54
- (0, typegoose_1.prop)({
55
- required: true,
56
- type: String,
57
- trim: true,
58
- }),
50
+ (0, typegoose_1.prop)({ required: true, type: String, trim: true }),
59
51
  __metadata("design:type", String)
60
- ], AddOn.prototype, "image", void 0);
52
+ ], ServiceAddon.prototype, "image", void 0);
61
53
  __decorate([
62
- (0, typegoose_1.prop)({
63
- required: true,
64
- type: Number,
65
- min: 0,
66
- }),
54
+ (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
67
55
  __metadata("design:type", Number)
68
- ], AddOn.prototype, "price", void 0);
56
+ ], ServiceAddon.prototype, "price", void 0);
69
57
  __decorate([
70
- (0, typegoose_1.prop)({
71
- required: true,
72
- type: Number,
73
- min: 0,
74
- }),
75
- __metadata("design:type", Number)
76
- ], AddOn.prototype, "hours", void 0);
77
- __decorate([
78
- (0, typegoose_1.prop)({
79
- required: true,
80
- type: Number,
81
- min: 0,
82
- max: 59,
83
- }),
84
- __metadata("design:type", Number)
85
- ], AddOn.prototype, "minutes", void 0);
58
+ (0, typegoose_1.prop)({ required: true, type: preparing_time_model_1.PreparingTime }),
59
+ __metadata("design:type", preparing_time_model_1.PreparingTime)
60
+ ], ServiceAddon.prototype, "duration", void 0);
86
61
  __decorate([
87
- (0, typegoose_1.prop)({
88
- maxlength: 250,
89
- trim: true,
90
- }),
62
+ (0, typegoose_1.prop)({ maxlength: 250, trim: true }),
91
63
  __metadata("design:type", String)
92
- ], AddOn.prototype, "description", void 0);
64
+ ], ServiceAddon.prototype, "description", void 0);
93
65
  __decorate([
94
66
  (0, typegoose_1.prop)({ type: String, enum: enum_1.Status, default: enum_1.Status.ACTIVE }),
95
67
  __metadata("design:type", String)
96
- ], AddOn.prototype, "status", void 0);
97
- __decorate([
98
- (0, typegoose_1.prop)({ type: Boolean, deafult: true }),
99
- __metadata("design:type", Boolean)
100
- ], AddOn.prototype, "isVisible", void 0);
101
- exports.AddOn = AddOn = __decorate([
68
+ ], ServiceAddon.prototype, "status", void 0);
69
+ exports.ServiceAddon = ServiceAddon = __decorate([
102
70
  (0, typegoose_1.modelOptions)({
103
71
  schemaOptions: {
104
- collection: "addons",
72
+ collection: 'serviceAddons',
105
73
  timestamps: true,
106
74
  },
107
75
  }),
108
76
  (0, typegoose_1.index)({ name: 1, service: 1 }, { unique: false })
109
- ], AddOn);
110
- //# sourceMappingURL=addon.model.js.map
77
+ ], ServiceAddon);
78
+ //# sourceMappingURL=service-addon.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-addon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-addon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAsE;AACtE,wDAAgC;AAChC,mCAAiC;AACjC,kDAA8E;AAC9E,0EAAgE;AASzD,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEjB,IAAI,CAAU;IAGd,WAAW,CAAe;IAG1B,eAAe,CAAoB;IAGnC,MAAM,CAAe;IAGrB,KAAK,CAAU;IAGf,KAAK,CAAU;IAGf,QAAQ,CAAi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AC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,eAAe;YAC3B,UAAU,EAAE,IAAI;SAChB;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;GACrC,YAAY,CA2BxB","sourcesContent":["import { prop, modelOptions, Ref, index } from '@typegoose/typegoose';\nimport mongoose from 'mongoose';\nimport { Vendor } from './index';\nimport { ServiceType, Status, SubServiceType } from '../../../utilities/enum';\nimport { PreparingTime } from './embedded/preparing-time.model';\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'serviceAddons',\n\t\ttimestamps: true,\n\t},\n})\n@index({ name: 1, service: 1 }, { unique: false })\nexport class ServiceAddon {\n\t@prop({ required: true, trim: true })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: [String], enum: SubServiceType })\n\tpublic subServiceTypes?: SubServiceType[];\n\n\t@prop({ required: true, type: () => mongoose.Types.ObjectId, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ required: true, type: String, trim: true })\n\tpublic image!: string;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n\n\t@prop({ required: true, type: PreparingTime })\n\tpublic duration!: PreparingTime;\n\n\t@prop({ maxlength: 250, trim: true })\n\tpublic description?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status: Status;\n}\n"]}
@@ -1,14 +1,14 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { Status } from '../../../utilities/enum';
3
+ import { ServiceType, Status, SubServiceType } from '../../../utilities/enum';
4
4
  import { Vendor } from './vendor.model';
5
- import { Service } from './service.model';
6
5
  export declare class ServiceCategory extends TimeStamps {
7
6
  name: string;
8
- service: Ref<Service>;
7
+ serviceType: ServiceType;
8
+ subServiceType?: SubServiceType;
9
9
  vendor: Ref<Vendor>;
10
10
  image?: string;
11
- status: Status;
12
- isVisible: boolean;
11
+ status?: Status;
12
+ isVisible?: boolean;
13
13
  sortingOrder?: number;
14
14
  }
@@ -14,11 +14,11 @@ const typegoose_1 = require("@typegoose/typegoose");
14
14
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
15
  const enum_1 = require("../../../utilities/enum");
16
16
  const vendor_model_1 = require("./vendor.model");
17
- const service_model_1 = require("./service.model");
18
17
  const _1 = require(".");
19
18
  let ServiceCategory = class ServiceCategory extends defaultClasses_1.TimeStamps {
20
19
  name;
21
- service;
20
+ serviceType;
21
+ subServiceType;
22
22
  vendor;
23
23
  image;
24
24
  status;
@@ -31,9 +31,13 @@ __decorate([
31
31
  __metadata("design:type", String)
32
32
  ], ServiceCategory.prototype, "name", void 0);
33
33
  __decorate([
34
- (0, typegoose_1.prop)({ required: true, ref: () => service_model_1.Service }),
35
- __metadata("design:type", Object)
36
- ], ServiceCategory.prototype, "service", void 0);
34
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ServiceType }),
35
+ __metadata("design:type", String)
36
+ ], ServiceCategory.prototype, "serviceType", void 0);
37
+ __decorate([
38
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.SubServiceType }),
39
+ __metadata("design:type", String)
40
+ ], ServiceCategory.prototype, "subServiceType", void 0);
37
41
  __decorate([
38
42
  (0, typegoose_1.prop)({ required: true, ref: () => vendor_model_1.Vendor }),
39
43
  __metadata("design:type", Object)
@@ -47,7 +51,7 @@ __decorate([
47
51
  __metadata("design:type", String)
48
52
  ], ServiceCategory.prototype, "status", void 0);
49
53
  __decorate([
50
- (0, typegoose_1.prop)({ type: Boolean, deafult: true }),
54
+ (0, typegoose_1.prop)({ type: Boolean, default: true }),
51
55
  __metadata("design:type", Boolean)
52
56
  ], ServiceCategory.prototype, "isVisible", void 0);
53
57
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"service-category.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-category.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAiD;AACjD,iDAAwC;AACxC,mDAA0C;AAC1C,wBAAyC;AA2BlC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAU;IAGd,OAAO,CAAgB;IAGvB,MAAM,CAAe;IAGrB,KAAK,CAAU;IAGf,MAAM,CAAU;IAGhB,SAAS,CAAS;IAGlB,YAAY,CAAU;CAC7B,CAAA;AArBY,0CAAe;AAEpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;6CAC7C;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,uBAAO,EAAE,CAAC;;gDACf;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;+CAChB;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACD;AAGf;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,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;kDACd;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACM;0BApBjB,eAAe;IAxB3B,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;IACzF,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE,EAAE,CAAC;IACpE,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,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,CAqB3B","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Status } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { Service } from './service.model';\nimport { ServiceCategoryModel } from '.';\n\n\n@Index({ name: 1, vendor: 1 }, { unique: true, collation: { locale: 'en', strength: 2 } })\n@modelOptions({ schemaOptions: { collection: 'serviceCategories' } })\n@pre<ServiceCategory>('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 shops with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ServiceCategoryModel.aggregate<{ maxSortingOrder: number }>([\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 ServiceCategory extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ required: true, ref: () => Service })\n\tpublic service!: Ref<Service>;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status!: Status;\n\n\t@prop({ type: Boolean, deafult: true })\n\tpublic isVisible: boolean\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
1
+ {"version":3,"file":"service-category.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-category.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAA8E;AAC9E,iDAAwC;AACxC,wBAAyC;AA0BlC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAU;IAGd,WAAW,CAAe;IAG1B,cAAc,CAAkB;IAGhC,MAAM,CAAe;IAGrB,KAAK,CAAU;IAGf,MAAM,CAAU;IAGhB,SAAS,CAAW;IAGpB,YAAY,CAAU;CAC7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M,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,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,CAwB3B","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceType, Status, SubServiceType } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategoryModel } from '.';\n\n@Index({ name: 1, vendor: 1 }, { unique: true, collation: { locale: 'en', strength: 2 } })\n@modelOptions({ schemaOptions: { collection: 'serviceCategories' } })\n@pre<ServiceCategory>('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 shops with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ServiceCategoryModel.aggregate<{ maxSortingOrder: number }>([\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 ServiceCategory extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: String, enum: SubServiceType })\n\tpublic subServiceType?: SubServiceType;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Boolean, default: true })\n\tpublic isVisible?: boolean;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
@@ -4,14 +4,14 @@ import { ServiceCart } from './service-cart.model';
4
4
  import { User } from './user.model';
5
5
  import { Vendor } from './vendor.model';
6
6
  import { ServicePackage } from './service-package.model';
7
- import { AddOn } from './addon.model';
7
+ import { ServiceAddon } from './service-addon.model';
8
8
  import { Status } from '../../../utilities/enum';
9
9
  export declare class ServiceLineItem extends TimeStamps {
10
10
  cart: Ref<ServiceCart>;
11
11
  user: Ref<User>;
12
12
  vendor: Ref<Vendor>;
13
13
  servicePackage?: Ref<ServicePackage>;
14
- addOn?: Ref<AddOn>;
14
+ addOn?: Ref<ServiceAddon>;
15
15
  quantity?: number;
16
16
  isAddon: boolean;
17
17
  status: Status;
@@ -20,7 +20,7 @@ const user_model_1 = require("./user.model");
20
20
  const vendor_model_1 = require("./vendor.model");
21
21
  const service_package_model_1 = require("./service-package.model");
22
22
  const mongoose_1 = __importDefault(require("mongoose"));
23
- const addon_model_1 = require("./addon.model");
23
+ const service_addon_model_1 = require("./service-addon.model");
24
24
  const enum_1 = require("../../../utilities/enum");
25
25
  let ServiceLineItem = class ServiceLineItem extends defaultClasses_1.TimeStamps {
26
26
  cart;
@@ -51,7 +51,7 @@ __decorate([
51
51
  __metadata("design:type", Object)
52
52
  ], ServiceLineItem.prototype, "servicePackage", void 0);
53
53
  __decorate([
54
- (0, typegoose_1.prop)({ ref: () => addon_model_1.AddOn }),
54
+ (0, typegoose_1.prop)({ ref: () => service_addon_model_1.ServiceAddon }),
55
55
  __metadata("design:type", Object)
56
56
  ], ServiceLineItem.prototype, "addOn", void 0);
57
57
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"service-line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,6DAAmD;AACnD,6CAAoC;AACpC,iDAAwC;AACxC,mEAAyD;AACzD,wDAAgC;AAChC,+CAAsC;AACtC,kDAAiD;AAoB1C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,2BAAU;IAEvC,IAAI,CAAoB;IAGxB,IAAI,CAAa;IAGjB,MAAM,CAAe;IAGrB,cAAc,CAAuB;IAGrC,KAAK,CAAc;IAGnB,QAAQ,CAAU;IAGlB,OAAO,CAAU;IAGjB,MAAM,CAAQ;IAGd,eAAe,CAA2B;CACjD,CAAA;AA3BY,0CAAe;AAEpB;IADN,IAAA,gBAAI,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,gCAAW,EAAE,CAAC;;6CACjB;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;6CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;+CAChB;AAG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/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceCart } from './service-cart.model';\nimport { User } from './user.model';\nimport { Vendor } from './vendor.model';\nimport { ServicePackage } from './service-package.model';\nimport mongoose from 'mongoose';\nimport { AddOn } from './addon.model';\nimport { Status } from '../../../utilities/enum';\n\n/**\n * ServiceLineItem model - Represents individual items in a cart\n */\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'serviceLineItems',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@Index({ cart: 1 })\n@Index({ cart: 1, user: 1 })\n@Index({ package: 1 })\n@Index({ vendor: 1 })\nexport class ServiceLineItem extends TimeStamps {\n\t@prop({ require: true, ref: () => ServiceCart })\n\tpublic cart!: Ref<ServiceCart>;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ ref: () => ServicePackage })\n\tpublic servicePackage?: Ref<ServicePackage>;\n\n\t@prop({ ref: () => AddOn })\n\tpublic addOn?: Ref<AddOn>;\n\n\t@prop({ min: 1, default: 1 })\n\tpublic quantity?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isAddon: boolean;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status: Status\n\n\t@prop({ type: mongoose.Schema.Types.Mixed })\n\tpublic calculationSnap?: Record<string, unknown>;\n}\n"]}
1
+ {"version":3,"file":"service-line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,6DAAmD;AACnD,6CAAoC;AACpC,iDAAwC;AACxC,mEAAyD;AACzD,wDAAgC;AAChC,+DAAqD;AACrD,kDAAiD;AAoB1C,IAAM,eAAe,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K;0BA1BrC,eAAe;IAd3B,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE;YACd,UAAU,EAAE,kBAAkB;YAC9B,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5B;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAClB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACrB,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;GACR,eAAe,CA2B3B","sourcesContent":["import { Index, modelOptions, prop, Ref, Severity } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceCart } from './service-cart.model';\nimport { User } from './user.model';\nimport { Vendor } from './vendor.model';\nimport { ServicePackage } from './service-package.model';\nimport mongoose from 'mongoose';\nimport { ServiceAddon } from './service-addon.model';\nimport { Status } from '../../../utilities/enum';\n\n/**\n * ServiceLineItem model - Represents individual items in a cart\n */\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'serviceLineItems',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@Index({ cart: 1 })\n@Index({ cart: 1, user: 1 })\n@Index({ package: 1 })\n@Index({ vendor: 1 })\nexport class ServiceLineItem extends TimeStamps {\n\t@prop({ require: true, ref: () => ServiceCart })\n\tpublic cart!: Ref<ServiceCart>;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ ref: () => ServicePackage })\n\tpublic servicePackage?: Ref<ServicePackage>;\n\n\t@prop({ ref: () => ServiceAddon })\n\tpublic addOn?: Ref<ServiceAddon>;\n\n\t@prop({ min: 1, default: 1 })\n\tpublic quantity?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isAddon: boolean;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status: Status;\n\n\t@prop({ type: mongoose.Schema.Types.Mixed })\n\tpublic calculationSnap?: Record<string, unknown>;\n}\n"]}
@@ -1,26 +1,25 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { Status } from '../../../utilities/enum';
3
+ import { ServiceType, Status, SubServiceType } from '../../../utilities/enum';
4
4
  import { Vendor } from './vendor.model';
5
5
  import { ServiceCategory } from './service-category.model';
6
- import { Service } from "./service.model";
7
- import { AddOn } from './index';
6
+ import { ServiceAddon } from './index';
7
+ import { PreparingTime } from './embedded/preparing-time.model';
8
+ import { CleaningMaterial } from './embedded/cleaning-material.model';
8
9
  export declare class ServicePackage extends TimeStamps {
9
10
  name: string;
10
11
  vendor: Ref<Vendor>;
11
- service: Ref<Service>;
12
+ serviceType: ServiceType;
13
+ subServiceType?: SubServiceType;
14
+ description?: string;
12
15
  category: Ref<ServiceCategory>;
13
16
  price: number;
14
- hours: number;
15
- minutes: number;
16
- numberOfProfessionals?: number;
17
- description?: string;
17
+ duration: PreparingTime;
18
+ numberOfProfessionals: number;
18
19
  image: string;
19
20
  vendorNotes?: string;
20
- addons?: Ref<AddOn>[];
21
+ addons?: Ref<ServiceAddon>[];
21
22
  status: Status;
22
- includeMaterials: boolean;
23
- materialsCost?: number;
23
+ cleaningMaterial: CleaningMaterial;
24
24
  sortingOrder?: number;
25
- isVisible: boolean;
26
25
  }
@@ -15,26 +15,25 @@ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
15
  const enum_1 = require("../../../utilities/enum");
16
16
  const vendor_model_1 = require("./vendor.model");
17
17
  const service_category_model_1 = require("./service-category.model");
18
- const service_model_1 = require("./service.model");
19
18
  const index_1 = require("./index");
19
+ const preparing_time_model_1 = require("./embedded/preparing-time.model");
20
+ const cleaning_material_model_1 = require("./embedded/cleaning-material.model");
20
21
  let ServicePackage = class ServicePackage extends defaultClasses_1.TimeStamps {
21
22
  name;
22
23
  vendor;
23
- service;
24
+ serviceType;
25
+ subServiceType;
26
+ description;
24
27
  category;
25
28
  price;
26
- hours;
27
- minutes;
29
+ duration;
28
30
  numberOfProfessionals;
29
- description;
30
31
  image;
31
32
  vendorNotes;
32
33
  addons;
33
34
  status;
34
- includeMaterials;
35
- materialsCost;
35
+ cleaningMaterial;
36
36
  sortingOrder;
37
- isVisible;
38
37
  };
39
38
  exports.ServicePackage = ServicePackage;
40
39
  __decorate([
@@ -46,9 +45,17 @@ __decorate([
46
45
  __metadata("design:type", Object)
47
46
  ], ServicePackage.prototype, "vendor", void 0);
48
47
  __decorate([
49
- (0, typegoose_1.prop)({ required: true, ref: () => service_model_1.Service }),
50
- __metadata("design:type", Object)
51
- ], ServicePackage.prototype, "service", void 0);
48
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ServiceType }),
49
+ __metadata("design:type", String)
50
+ ], ServicePackage.prototype, "serviceType", void 0);
51
+ __decorate([
52
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.SubServiceType }),
53
+ __metadata("design:type", String)
54
+ ], ServicePackage.prototype, "subServiceType", void 0);
55
+ __decorate([
56
+ (0, typegoose_1.prop)({ type: String, trim: true }),
57
+ __metadata("design:type", String)
58
+ ], ServicePackage.prototype, "description", void 0);
52
59
  __decorate([
53
60
  (0, typegoose_1.prop)({ required: true, ref: () => service_category_model_1.ServiceCategory }),
54
61
  __metadata("design:type", Object)
@@ -58,30 +65,13 @@ __decorate([
58
65
  __metadata("design:type", Number)
59
66
  ], ServicePackage.prototype, "price", void 0);
60
67
  __decorate([
61
- (0, typegoose_1.prop)({
62
- required: true,
63
- type: Number,
64
- min: 0,
65
- }),
66
- __metadata("design:type", Number)
67
- ], ServicePackage.prototype, "hours", void 0);
68
- __decorate([
69
- (0, typegoose_1.prop)({
70
- required: true,
71
- type: Number,
72
- min: 0,
73
- max: 59,
74
- }),
75
- __metadata("design:type", Number)
76
- ], ServicePackage.prototype, "minutes", void 0);
68
+ (0, typegoose_1.prop)({ required: true, type: preparing_time_model_1.PreparingTime }),
69
+ __metadata("design:type", preparing_time_model_1.PreparingTime)
70
+ ], ServicePackage.prototype, "duration", void 0);
77
71
  __decorate([
78
72
  (0, typegoose_1.prop)({ required: true, type: Number, min: 1 }),
79
73
  __metadata("design:type", Number)
80
74
  ], ServicePackage.prototype, "numberOfProfessionals", void 0);
81
- __decorate([
82
- (0, typegoose_1.prop)({ type: String, trim: true }),
83
- __metadata("design:type", String)
84
- ], ServicePackage.prototype, "description", void 0);
85
75
  __decorate([
86
76
  (0, typegoose_1.prop)({ type: String }),
87
77
  __metadata("design:type", String)
@@ -91,7 +81,7 @@ __decorate([
91
81
  __metadata("design:type", String)
92
82
  ], ServicePackage.prototype, "vendorNotes", void 0);
93
83
  __decorate([
94
- (0, typegoose_1.prop)({ ref: () => index_1.AddOn, default: [], type: [String] }),
84
+ (0, typegoose_1.prop)({ ref: () => index_1.ServiceAddon, default: [] }),
95
85
  __metadata("design:type", Array)
96
86
  ], ServicePackage.prototype, "addons", void 0);
97
87
  __decorate([
@@ -99,21 +89,13 @@ __decorate([
99
89
  __metadata("design:type", String)
100
90
  ], ServicePackage.prototype, "status", void 0);
101
91
  __decorate([
102
- (0, typegoose_1.prop)({ type: Boolean, default: false }),
103
- __metadata("design:type", Boolean)
104
- ], ServicePackage.prototype, "includeMaterials", void 0);
105
- __decorate([
106
- (0, typegoose_1.prop)({ type: Number, default: 0, min: 0 }),
107
- __metadata("design:type", Number)
108
- ], ServicePackage.prototype, "materialsCost", void 0);
92
+ (0, typegoose_1.prop)({ required: true, type: cleaning_material_model_1.CleaningMaterial }),
93
+ __metadata("design:type", cleaning_material_model_1.CleaningMaterial)
94
+ ], ServicePackage.prototype, "cleaningMaterial", void 0);
109
95
  __decorate([
110
96
  (0, typegoose_1.prop)({ type: Number }),
111
97
  __metadata("design:type", Number)
112
98
  ], ServicePackage.prototype, "sortingOrder", void 0);
113
- __decorate([
114
- (0, typegoose_1.prop)({ type: Boolean, deafult: true }),
115
- __metadata("design:type", Boolean)
116
- ], ServicePackage.prototype, "isVisible", void 0);
117
99
  exports.ServicePackage = ServicePackage = __decorate([
118
100
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'servicePackages', timestamps: true } }),
119
101
  (0, typegoose_1.Index)({ name: 1, vendor: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
@@ -1 +1 @@
1
- {"version":3,"file":"service-package.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-package.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAiD;AACjD,iDAAwC;AACxC,qEAA2D;AAC3D,mDAA0C;AAC1C,mCAAqD;AA8B9C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEnC,IAAI,CAAU;IAGd,MAAM,CAAe;IAGrB,OAAO,CAAc;IAGrB,QAAQ,CAAwB;IAGhC,KAAK,CAAU;IAOf,KAAK,CAAU;IAQf,OAAO,CAAU;IAGjB,qBAAqB,CAAU;IAG/B,WAAW,CAAU;IAGrB,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,MAAM,CAAgB;IAGtB,MAAM,CAAS;IAGf,gBAAgB,CAAW;IAG3B,aAAa,CAAU;IAGvB,YAAY,CAAU;IAGtB,SAAS,CAAS;CAC5B,CAAA;AA5DY,wCAAc;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,I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AE,IAAI,EAAE,eAAe,EAAE;yBAC7C;qBACJ;iBACJ,CAAC,CAAC,IAAI,EAAE,CAAC;gBAGV,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACxE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,IAAI,CAAC,KAAc,CAAC,CAAC;YAChC,CAAC;QACL,CAAC;QACD,IAAI,EAAE,CAAC;IACX,CAAC,CAAC;GACW,cAAc,CA4D1B","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Status } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategory } from './service-category.model';\nimport { Service } from \"./service.model\";\nimport { AddOn, ServicePackageModel } from './index';\n\n\n@modelOptions({ schemaOptions: { collection: 'servicePackages', timestamps: true } })\n@Index(\n { name: 1, vendor: 1 },\n { unique: true, partialFilterExpression: { deletedAt: null } }\n)\n@pre<ServicePackage>('save', async function (next) {\n // Only set sortingOrder if it's a new document or sortingOrder is not set\n if (this.isNew || typeof this.sortingOrder === 'undefined') {\n try {\n // Find the maximum sortingOrder for shops with the same itemType that aren't deleted\n const maxSortingOrder = await ServicePackageModel.aggregate<{ maxSortingOrder: number }>([\n {\n $group: {\n _id: null,\n maxSortingOrder: { $max: '$sortingOrder' },\n },\n },\n ]).exec();\n\n // Set the new sortingOrder to max + 1 (or 0 if no items found)\n this.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n } catch (error) {\n return next(error as Error);\n }\n }\n next();\n}) \nexport class ServicePackage extends TimeStamps {\n @prop({ required: true, type: String, trim: true, maxlength: 20 })\n public name!: string;\n\n @prop({ required: true, ref: () => Vendor })\n public vendor!: Ref<Vendor>; \n\n @prop({ required: true, ref: () => Service })\n public service: Ref<Service>\n\n @prop({ required: true, ref: () => ServiceCategory })\n public category!: Ref<ServiceCategory>;\n\n @prop({ required: true, type: Number, min: 0 })\n public price!: number;\n\n @prop({\n required: true,\n type: Number,\n min: 0,\n })\n public hours!: number;\n\n @prop({\n required: true,\n type: Number,\n min: 0,\n max: 59,\n })\n public minutes!: number;\n\n @prop({ required: true, type: Number, min: 1 })\n public numberOfProfessionals?: number; // no need for furniture cleaning\n\n @prop({ type: String, trim: true })\n public description?: string;\n\n @prop({ type: String })\n public image!: string;\n \n @prop({ type: String, maxlength: 250 })\n public vendorNotes?: string;\n\n @prop({ ref: () => AddOn, default: [], type: [String] })\n public addons?: Ref<AddOn>[];\n\n @prop({ type: String, enum: Status, default: Status.ACTIVE })\n public status: Status;\n\n @prop({ type: Boolean, default: false })\n public includeMaterials!: boolean;\n\n @prop({ type: Number, default: 0, min: 0 })\n public materialsCost?: number;\n\n @prop({ type: Number })\n public sortingOrder?: number;\n\n @prop({ type: Boolean, deafult: true })\n public isVisible: boolean\n}\n\n"]}
1
+ {"version":3,"file":"service-package.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-package.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAA8E;AAC9E,iDAAwC;AACxC,qEAA2D;AAC3D,mCAA4D;AAC5D,0EAAgE;AAChE,gFAAsE;AA0B/D,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEtC,IAAI,CAAU;IAGd,MAAM,CAAe;IAGrB,WAAW,CAAe;IAG1B,cAAc,CAAkB;IAGhC,WAAW,CAAU;IAGrB,QAAQ,CAAwB;IAGhC,KAAK,CAAU;IAGf,QAAQ,CAAiB;IAGzB,qBAAqB,CAAU;IAG/B,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,MAAM,CAAuB;IAG7B,MAAM,CAAS;IAGf,gBAAgB,CAAoB;IAGpC,YAAY,CAAU;CAC7B,CAAA;AA7CY,wCAAc;AAEnB;IADN,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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,cAAc,CA6C1B","sourcesContent":["import { Index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceType, Status, SubServiceType } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategory } from './service-category.model';\nimport { ServiceAddon, ServicePackageModel } from './index';\nimport { PreparingTime } from './embedded/preparing-time.model';\nimport { CleaningMaterial } from './embedded/cleaning-material.model';\n\n@modelOptions({ schemaOptions: { collection: 'servicePackages', timestamps: true } })\n@Index({ name: 1, vendor: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@pre<ServicePackage>('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 shops with the same itemType that aren't deleted\n\t\t\tconst maxSortingOrder = await ServicePackageModel.aggregate<{ maxSortingOrder: number }>([\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 ServicePackage extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ type: String, enum: SubServiceType })\n\tpublic subServiceType?: SubServiceType;\n\n\t@prop({ type: String, trim: true })\n\tpublic description?: string;\n\n\t@prop({ required: true, ref: () => ServiceCategory })\n\tpublic category!: Ref<ServiceCategory>;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic price!: number;\n\n\t@prop({ required: true, type: PreparingTime })\n\tpublic duration!: PreparingTime;\n\n\t@prop({ required: true, type: Number, min: 1 })\n\tpublic numberOfProfessionals!: number;\n\n\t@prop({ type: String })\n\tpublic image!: string;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic vendorNotes?: string;\n\n\t@prop({ ref: () => ServiceAddon, default: [] })\n\tpublic addons?: Ref<ServiceAddon>[];\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status: Status;\n\n\t@prop({ required: true, type: CleaningMaterial })\n\tpublic cleaningMaterial!: CleaningMaterial;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}\n"]}
@@ -1,9 +1,8 @@
1
- import { Ref } from "@typegoose/typegoose";
2
- import { TimeStamps } from "@typegoose/typegoose/lib/defaultClasses";
3
- import { ServiceType } from "../../../utilities/enum";
1
+ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
2
+ import { ServiceType, SubServiceType } from '../../../utilities/enum';
4
3
  export declare class Service extends TimeStamps {
5
4
  name: string;
6
5
  serviceType: ServiceType;
7
- parentService?: Ref<Service>;
8
- image?: string;
6
+ subServiceType?: SubServiceType;
7
+ image: string;
9
8
  }