@lyxa.ai/core 1.3.230 → 1.3.251

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 (68) hide show
  1. package/dist/libraries/mongo/models/embedded/adjustment-information.model.d.ts +3 -0
  2. package/dist/libraries/mongo/models/embedded/adjustment-information.model.js +11 -0
  3. package/dist/libraries/mongo/models/embedded/adjustment-information.model.js.map +1 -1
  4. package/dist/libraries/mongo/models/embedded/cleaning-material.model.d.ts +4 -0
  5. package/dist/libraries/mongo/models/embedded/cleaning-material.model.js +27 -0
  6. package/dist/libraries/mongo/models/embedded/cleaning-material.model.js.map +1 -0
  7. package/dist/libraries/mongo/models/embedded/service-order-settings.model.d.ts +5 -5
  8. package/dist/libraries/mongo/models/embedded/service-order-settings.model.js +14 -23
  9. package/dist/libraries/mongo/models/embedded/service-order-settings.model.js.map +1 -1
  10. package/dist/libraries/mongo/models/index.d.ts +6 -9
  11. package/dist/libraries/mongo/models/index.js +7 -11
  12. package/dist/libraries/mongo/models/index.js.map +1 -1
  13. package/dist/libraries/mongo/models/line-item.model.d.ts +2 -0
  14. package/dist/libraries/mongo/models/line-item.model.js +10 -0
  15. package/dist/libraries/mongo/models/line-item.model.js.map +1 -1
  16. package/dist/libraries/mongo/models/professional-blocked-time.model.d.ts +10 -0
  17. package/dist/libraries/mongo/models/{blocked-time.model.js → professional-blocked-time.model.js} +13 -23
  18. package/dist/libraries/mongo/models/professional-blocked-time.model.js.map +1 -0
  19. package/dist/libraries/mongo/models/professional.model.d.ts +4 -8
  20. package/dist/libraries/mongo/models/professional.model.js +11 -25
  21. package/dist/libraries/mongo/models/professional.model.js.map +1 -1
  22. package/dist/libraries/mongo/models/service-addon.model.d.ts +15 -0
  23. package/dist/libraries/mongo/models/{addon.model.js → service-addon.model.js} +31 -63
  24. package/dist/libraries/mongo/models/service-addon.model.js.map +1 -0
  25. package/dist/libraries/mongo/models/service-category.model.d.ts +5 -5
  26. package/dist/libraries/mongo/models/service-category.model.js +9 -5
  27. package/dist/libraries/mongo/models/service-category.model.js.map +1 -1
  28. package/dist/libraries/mongo/models/service-line-item.model.d.ts +2 -2
  29. package/dist/libraries/mongo/models/service-line-item.model.js +2 -2
  30. package/dist/libraries/mongo/models/service-line-item.model.js.map +1 -1
  31. package/dist/libraries/mongo/models/service-package.model.d.ts +11 -12
  32. package/dist/libraries/mongo/models/service-package.model.js +25 -43
  33. package/dist/libraries/mongo/models/service-package.model.js.map +1 -1
  34. package/dist/libraries/mongo/models/service.model.d.ts +4 -5
  35. package/dist/libraries/mongo/models/service.model.js +5 -5
  36. package/dist/libraries/mongo/models/service.model.js.map +1 -1
  37. package/dist/libraries/mongo/models/shared/work-hour.model.d.ts +2 -10
  38. package/dist/libraries/mongo/models/shared/work-hour.model.js +7 -31
  39. package/dist/libraries/mongo/models/shared/work-hour.model.js.map +1 -1
  40. package/dist/libraries/mongo/models/vendor-parent.model.d.ts +3 -2
  41. package/dist/libraries/mongo/models/vendor-parent.model.js +26 -7
  42. package/dist/libraries/mongo/models/vendor-parent.model.js.map +1 -1
  43. package/dist/libraries/mongo/models/vendor.model.d.ts +3 -12
  44. package/dist/libraries/mongo/models/vendor.model.js +6 -58
  45. package/dist/libraries/mongo/models/vendor.model.js.map +1 -1
  46. package/dist/libraries/trpc/middlewares/auth.d.ts +1 -1
  47. package/dist/libraries/trpc/middlewares/createRoleProtectedProcedure.d.ts +1 -1
  48. package/dist/libraries/trpc/middlewares/phone-verified.d.ts +1 -1
  49. package/dist/libraries/trpc/middlewares/publicUserDecoder.d.ts +1 -1
  50. package/dist/types/README.md +1 -1
  51. package/dist/types/package.json +1 -1
  52. package/dist/types/utilities/enum.d.ts +7 -8
  53. package/dist/types/utilities/enum.js +8 -8
  54. package/dist/types/utilities/enum.js.map +1 -1
  55. package/dist/types/utilities/validation/common-validation.d.ts +12 -12
  56. package/dist/utilities/enum.d.ts +7 -8
  57. package/dist/utilities/enum.js +8 -8
  58. package/dist/utilities/enum.js.map +1 -1
  59. package/dist/utilities/id-generator.js +1 -0
  60. package/dist/utilities/id-generator.js.map +1 -1
  61. package/package.json +1 -1
  62. package/dist/libraries/mongo/models/addon.model.d.ts +0 -15
  63. package/dist/libraries/mongo/models/addon.model.js.map +0 -1
  64. package/dist/libraries/mongo/models/blocked-time.model.d.ts +0 -11
  65. package/dist/libraries/mongo/models/blocked-time.model.js.map +0 -1
  66. package/dist/libraries/mongo/models/professional-schedule.d.ts +0 -20
  67. package/dist/libraries/mongo/models/professional-schedule.js +0 -102
  68. package/dist/libraries/mongo/models/professional-schedule.js.map +0 -1
@@ -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,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AAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EACtB,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CACjE;IACA,IAAA,eAAG,EAAiB,MAAM,EAAE,KAAK,WAAW,IAAI;QAE7C,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YACzD,IAAI,CAAC;gBAED,MAAM,eAAe,GAAG,MAAM,2BAAmB,CAAC,SAAS,CAA8B;oBACrF;wBACI,MAAM,EAAE;4BACJ,GAAG,EAAE,IAAI;4BACT,eAAe,EAAE,EAAE,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,mC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AI;QAEhD,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YAC5D,IAAI,CAAC;gBAEJ,MAAM,eAAe,GAAG,MAAM,2BAAmB,CAAC,SAAS,CAA8B;oBACxF;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,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
  }
@@ -16,7 +16,7 @@ const enum_1 = require("../../../utilities/enum");
16
16
  let Service = class Service extends defaultClasses_1.TimeStamps {
17
17
  name;
18
18
  serviceType;
19
- parentService;
19
+ subServiceType;
20
20
  image;
21
21
  };
22
22
  exports.Service = Service;
@@ -29,11 +29,11 @@ __decorate([
29
29
  __metadata("design:type", String)
30
30
  ], Service.prototype, "serviceType", void 0);
31
31
  __decorate([
32
- (0, typegoose_1.prop)({ ref: () => Service }),
33
- __metadata("design:type", Object)
34
- ], Service.prototype, "parentService", void 0);
32
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.SubServiceType }),
33
+ __metadata("design:type", String)
34
+ ], Service.prototype, "subServiceType", void 0);
35
35
  __decorate([
36
- (0, typegoose_1.prop)({ type: String }),
36
+ (0, typegoose_1.prop)({ required: true, type: String }),
37
37
  __metadata("design:type", String)
38
38
  ], Service.prototype, "image", void 0);
39
39
  exports.Service = Service = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"service.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAsD;AAK/C,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE5B,IAAI,CAAU;IAGd,WAAW,CAAc;IAGzB,aAAa,CAAe;IAG5B,KAAK,CAAU;CACzB,CAAA;AAZY,0BAAO;AAET;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAW,EAAE,CAAC;;4CAC1B;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;;8CACM;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACD;kBAXb,OAAO;IAFnB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IAClF,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;GAC/C,OAAO,CAYnB","sourcesContent":["import { Index, modelOptions, prop, Ref } from \"@typegoose/typegoose\";\nimport { TimeStamps } from \"@typegoose/typegoose/lib/defaultClasses\";\nimport { ServiceType } from \"../../../utilities/enum\";\n\n\n@Index({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@modelOptions({ schemaOptions: { collection: 'services' } })\nexport class Service extends TimeStamps {\n @prop({ required: true, type: String })\n public name!: string;\n\n @prop({ required: true, type: String, enum: ServiceType })\n public serviceType!: ServiceType\n\n @prop({ ref: () => Service })\n public parentService?: Ref<Service>\n\n @prop({ type: String })\n public image?: string;\n}"]}
1
+ {"version":3,"file":"service.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAsE;AAI/D,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,IAAI,CAAU;IAGd,WAAW,CAAe;IAG1B,cAAc,CAAkB;IAGhC,KAAK,CAAU;CACtB,CAAA;AAZY,0BAAO;AAEZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAW,EAAE,CAAC;;4CACzB;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAc,EAAE,CAAC;;+CACN;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACjB;kBAXV,OAAO;IAFnB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IAClF,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;GAC/C,OAAO,CAYnB","sourcesContent":["import { Index, modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceType, SubServiceType } from '../../../utilities/enum';\n\n@Index({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@modelOptions({ schemaOptions: { collection: 'services' } })\nexport class Service extends TimeStamps {\n\t@prop({ required: true, type: String })\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, type: String })\n\tpublic image!: string;\n}\n"]}
@@ -1,6 +1,4 @@
1
- import { Ref } from '@typegoose/typegoose';
2
1
  import { HolidayWorkStatus, WeekDay, WorkStatus } from '../../../../utilities/enum';
3
- import { Service } from '../service.model';
4
2
  export declare class StartEndTime {
5
3
  start: string;
6
4
  end: string;
@@ -19,13 +17,7 @@ export declare class WorkHourSetting {
19
17
  normalHours?: NormalHour[];
20
18
  holidayHours?: HolidayHour[];
21
19
  }
22
- export declare class TimeSlot {
23
- timeFrom: string;
24
- timeTo: string;
25
- services: Ref<Service>[];
26
- }
27
- export declare class TeamMemberWorkHourSetting {
20
+ export declare class TeamMemberAvailability {
28
21
  day: WeekDay;
29
- isEnabled: boolean;
30
- timeSlots: TimeSlot[];
22
+ openingHours: StartEndTime[];
31
23
  }
@@ -9,10 +9,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.TeamMemberWorkHourSetting = exports.TimeSlot = exports.WorkHourSetting = exports.HolidayHour = exports.NormalHour = exports.StartEndTime = void 0;
12
+ exports.TeamMemberAvailability = exports.WorkHourSetting = exports.HolidayHour = exports.NormalHour = exports.StartEndTime = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
14
  const enum_1 = require("../../../../utilities/enum");
15
- const service_model_1 = require("../service.model");
16
15
  class StartEndTime {
17
16
  start;
18
17
  end;
@@ -79,40 +78,17 @@ __decorate([
79
78
  (0, typegoose_1.prop)({ type: () => [HolidayHour], default: [] }),
80
79
  __metadata("design:type", Array)
81
80
  ], WorkHourSetting.prototype, "holidayHours", void 0);
82
- class TimeSlot {
83
- timeFrom;
84
- timeTo;
85
- services;
86
- }
87
- exports.TimeSlot = TimeSlot;
88
- __decorate([
89
- (0, typegoose_1.prop)({ required: true }),
90
- __metadata("design:type", String)
91
- ], TimeSlot.prototype, "timeFrom", void 0);
92
- __decorate([
93
- (0, typegoose_1.prop)({ required: true }),
94
- __metadata("design:type", String)
95
- ], TimeSlot.prototype, "timeTo", void 0);
96
- __decorate([
97
- (0, typegoose_1.prop)({ ref: () => service_model_1.Service }),
98
- __metadata("design:type", Array)
99
- ], TimeSlot.prototype, "services", void 0);
100
- class TeamMemberWorkHourSetting {
81
+ class TeamMemberAvailability {
101
82
  day;
102
- isEnabled;
103
- timeSlots;
83
+ openingHours;
104
84
  }
105
- exports.TeamMemberWorkHourSetting = TeamMemberWorkHourSetting;
85
+ exports.TeamMemberAvailability = TeamMemberAvailability;
106
86
  __decorate([
107
87
  (0, typegoose_1.prop)({ required: true, type: Number, enum: enum_1.WeekDay }),
108
88
  __metadata("design:type", Number)
109
- ], TeamMemberWorkHourSetting.prototype, "day", void 0);
110
- __decorate([
111
- (0, typegoose_1.prop)({ type: Boolean, default: true }),
112
- __metadata("design:type", Boolean)
113
- ], TeamMemberWorkHourSetting.prototype, "isEnabled", void 0);
89
+ ], TeamMemberAvailability.prototype, "day", void 0);
114
90
  __decorate([
115
- (0, typegoose_1.prop)({ type: () => [TimeSlot], default: [] }),
91
+ (0, typegoose_1.prop)({ required: true, type: () => [StartEndTime] }),
116
92
  __metadata("design:type", Array)
117
- ], TeamMemberWorkHourSetting.prototype, "timeSlots", void 0);
93
+ ], TeamMemberAvailability.prototype, "openingHours", void 0);
118
94
  //# sourceMappingURL=work-hour.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"work-hour.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shared/work-hour.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAoF;AACpF,oDAA2C;AAE3C,MAAa,YAAY;IAEjB,KAAK,CAAU;IAGf,GAAG,CAAU;CACpB;AAND,oCAMC;AAJO;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;;yCACnB;AAGrB,MAAa,UAAU;IAEf,GAAG,CAAW;IAGd,MAAM,CAAc;IAGpB,YAAY,CAAkB;CACrC;AATD,gCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QA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QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACA;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACF;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,uBAAO,EAAE,CAAC;;0CACG;AAIjC,MAAa,yBAAyB;IAE9B,GAAG,CAAW;IAGd,SAAS,CAAW;IAGpB,SAAS,CAAc;CAC9B;AATD,8DASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAO,EAAE,CAAC;;sDACjC;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;4DACZ;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;4DAChB","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { HolidayWorkStatus, WeekDay, WorkStatus } from '../../../../utilities/enum';\nimport { Service } from '../service.model';\n\nexport class StartEndTime {\n\t@prop({ required: true, type: String })\n\tpublic start!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic end!: string;\n}\n\nexport class NormalHour {\n\t@prop({ required: true, type: Number, enum: WeekDay })\n\tpublic day!: WeekDay;\n\n\t@prop({ required: true, type: String, enum: WorkStatus })\n\tpublic status!: WorkStatus;\n\n\t@prop({ type: () => [StartEndTime], default: [] })\n\tpublic openingHours?: StartEndTime[];\n}\n\nexport class HolidayHour {\n\t@prop({ required: true, type: Date })\n\tpublic date?: Date;\n\n\t@prop({\n\t\trequired: true,\n\t\ttype: String,\n\t\tenum: HolidayWorkStatus,\n\t})\n\tpublic status!: HolidayWorkStatus;\n\n\t@prop({ type: StartEndTime })\n\tpublic closingHour?: StartEndTime;\n}\n\nexport class WorkHourSetting {\n\t@prop({ type: () => [NormalHour], default: [] })\n\tpublic normalHours?: NormalHour[];\n\n\t@prop({ type: () => [HolidayHour], default: [] })\n\tpublic holidayHours?: HolidayHour[];\n}\n\nexport class TimeSlot {\n\t@prop({ required: true })\n\tpublic timeFrom!: string; // Format: \"HH:mm\" (e.g., \"09:00\")\n\n\t@prop({ required: true })\n\tpublic timeTo!: string; // Format: \"HH:mm\" (e.g., \"17:00\")\n\n\t@prop({ ref: () => Service })\n\tpublic services!: Ref<Service>[]\n}\n\n\nexport class TeamMemberWorkHourSetting {\n\t@prop({ required: true, type: Number, enum: WeekDay })\n\tpublic day!: WeekDay;\n\n\t@prop({ type: Boolean, default: true })\n\tpublic isEnabled!: boolean;\n\n\t@prop({ type: () => [TimeSlot], default: [] })\n\tpublic timeSlots!: TimeSlot[];\n}"]}
1
+ {"version":3,"file":"work-hour.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shared/work-hour.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAAoF;AAGpF,MAAa,YAAY;IAEjB,KAAK,CAAU;IAGf,GAAG,CAAU;CACpB;AAND,oCAMC;AAJO;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;;yCACnB;AAGrB,MAAa,UAAU;IAEf,GAAG,CAAW;IAGd,MAAM,CAAc;IAGpB,YAAY,CAAkB;CACrC;AATD,gCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAO,EAAE,CAAC;;uCACjC;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE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C,CAAC,YAAY,CAAC,EAAE,CAAC;;4DAChB","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { HolidayWorkStatus, WeekDay, WorkStatus } from '../../../../utilities/enum';\nimport { Service } from '../service.model';\n\nexport class StartEndTime {\n\t@prop({ required: true, type: String })\n\tpublic start!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic end!: string;\n}\n\nexport class NormalHour {\n\t@prop({ required: true, type: Number, enum: WeekDay })\n\tpublic day!: WeekDay;\n\n\t@prop({ required: true, type: String, enum: WorkStatus })\n\tpublic status!: WorkStatus;\n\n\t@prop({ type: () => [StartEndTime], default: [] })\n\tpublic openingHours?: StartEndTime[];\n}\n\nexport class HolidayHour {\n\t@prop({ required: true, type: Date })\n\tpublic date?: Date;\n\n\t@prop({\n\t\trequired: true,\n\t\ttype: String,\n\t\tenum: HolidayWorkStatus,\n\t})\n\tpublic status!: HolidayWorkStatus;\n\n\t@prop({ type: StartEndTime })\n\tpublic closingHour?: StartEndTime;\n}\n\nexport class WorkHourSetting {\n\t@prop({ type: () => [NormalHour], default: [] })\n\tpublic normalHours?: NormalHour[];\n\n\t@prop({ type: () => [HolidayHour], default: [] })\n\tpublic holidayHours?: HolidayHour[];\n}\n\nexport class TeamMemberAvailability {\n\t@prop({ required: true, type: Number, enum: WeekDay })\n\tpublic day!: WeekDay;\n\n\t@prop({ required: true, type: () => [StartEndTime] })\n\tpublic openingHours!: StartEndTime[];\n}\n"]}
@@ -1,17 +1,17 @@
1
1
  import { Ref } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
- import { ChargeType, ServiceType, Status } from '../../../utilities/enum';
3
+ import { ServiceType, Status } from '../../../utilities/enum';
4
4
  import { Admin } from './admin.model';
5
5
  import { Charge } from './embedded/charge.model';
6
6
  import { ParentDocument } from './embedded/parent-document.model';
7
7
  import { Address } from './shared/address.model';
8
8
  import { Duration } from './shared/duration.model';
9
9
  export declare class VendorParent extends TimeStamps {
10
+ vendorParentId: string;
10
11
  name: string;
11
12
  email: string;
12
13
  phoneNumber: string;
13
14
  address: Address;
14
- chargeType: ChargeType;
15
15
  charge: Charge;
16
16
  serviceType: ServiceType;
17
17
  commissionDuration: Duration;
@@ -20,4 +20,5 @@ export declare class VendorParent extends TimeStamps {
20
20
  status?: Status;
21
21
  profilePhoto?: string;
22
22
  document?: ParentDocument;
23
+ vendorCount?: number;
23
24
  }
@@ -18,12 +18,15 @@ const charge_model_1 = require("./embedded/charge.model");
18
18
  const parent_document_model_1 = require("./embedded/parent-document.model");
19
19
  const address_model_1 = require("./shared/address.model");
20
20
  const duration_model_1 = require("./shared/duration.model");
21
+ const vendor_model_1 = require("./vendor.model");
22
+ const id_generator_1 = require("../../../utilities/id-generator");
23
+ const _1 = require(".");
21
24
  let VendorParent = class VendorParent extends defaultClasses_1.TimeStamps {
25
+ vendorParentId;
22
26
  name;
23
27
  email;
24
28
  phoneNumber;
25
29
  address;
26
- chargeType;
27
30
  charge;
28
31
  serviceType;
29
32
  commissionDuration;
@@ -32,28 +35,29 @@ let VendorParent = class VendorParent extends defaultClasses_1.TimeStamps {
32
35
  status;
33
36
  profilePhoto;
34
37
  document;
38
+ vendorCount;
35
39
  };
36
40
  exports.VendorParent = VendorParent;
41
+ __decorate([
42
+ (0, typegoose_1.prop)({ required: true, type: String, unique: true, index: true }),
43
+ __metadata("design:type", String)
44
+ ], VendorParent.prototype, "vendorParentId", void 0);
37
45
  __decorate([
38
46
  (0, typegoose_1.prop)({ required: true, type: String, maxlength: 50 }),
39
47
  __metadata("design:type", String)
40
48
  ], VendorParent.prototype, "name", void 0);
41
49
  __decorate([
42
- (0, typegoose_1.prop)({ required: true, unique: true, type: String }),
50
+ (0, typegoose_1.prop)({ required: true, type: String }),
43
51
  __metadata("design:type", String)
44
52
  ], VendorParent.prototype, "email", void 0);
45
53
  __decorate([
46
- (0, typegoose_1.prop)({ required: true, unique: true, type: String }),
54
+ (0, typegoose_1.prop)({ required: true, type: String }),
47
55
  __metadata("design:type", String)
48
56
  ], VendorParent.prototype, "phoneNumber", void 0);
49
57
  __decorate([
50
58
  (0, typegoose_1.prop)({ required: true, type: address_model_1.Address }),
51
59
  __metadata("design:type", address_model_1.Address)
52
60
  ], VendorParent.prototype, "address", void 0);
53
- __decorate([
54
- (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ChargeType, default: enum_1.ChargeType.CUSTOM }),
55
- __metadata("design:type", String)
56
- ], VendorParent.prototype, "chargeType", void 0);
57
61
  __decorate([
58
62
  (0, typegoose_1.prop)({ required: true, type: charge_model_1.Charge }),
59
63
  __metadata("design:type", charge_model_1.Charge)
@@ -86,12 +90,27 @@ __decorate([
86
90
  (0, typegoose_1.prop)({ type: parent_document_model_1.ParentDocument }),
87
91
  __metadata("design:type", parent_document_model_1.ParentDocument)
88
92
  ], VendorParent.prototype, "document", void 0);
93
+ __decorate([
94
+ (0, typegoose_1.prop)({
95
+ ref: () => vendor_model_1.Vendor,
96
+ foreignField: 'parent',
97
+ localField: '_id',
98
+ count: true,
99
+ match: { deletedAt: null },
100
+ }),
101
+ __metadata("design:type", Number)
102
+ ], VendorParent.prototype, "vendorCount", void 0);
89
103
  exports.VendorParent = VendorParent = __decorate([
90
104
  (0, typegoose_1.modelOptions)({
91
105
  schemaOptions: { collection: 'vendorParents', toJSON: { virtuals: true }, toObject: { virtuals: true } },
92
106
  options: {
93
107
  allowMixed: typegoose_1.Severity.ALLOW,
94
108
  },
109
+ }),
110
+ (0, typegoose_1.pre)('save', async function () {
111
+ if (this.isNew) {
112
+ this.vendorParentId = await (0, id_generator_1.generateId)(_1.CounterModel, enum_1.CounterType.VENDOR_PARENT);
113
+ }
95
114
  })
96
115
  ], VendorParent);
97
116
  //# sourceMappingURL=vendor-parent.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vendor-parent.model.js","sourceRoot":"/","sources":["libraries/mongo/models/vendor-parent.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAyE;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AI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAW,EAAE,CAAC;;iDAC1B;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BACb,yBAAQ;wDAAC;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;yDAClB;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;0DACc;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;4CACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDACM;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,sCAAc,EAAE,CAAC;8BACb,sCAAc;8CAAC;uBAtCrB,YAAY;IANxB,IAAA,wBAAY,EAAC;QACb,aAAa,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QACxG,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;GACW,YAAY,CAgDxB","sourcesContent":["import { modelOptions, prop, Ref, Severity } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ChargeType, ServiceType, Status } from '../../../utilities/enum';\nimport { Admin } from './admin.model';\nimport { Charge } from './embedded/charge.model';\nimport { ParentDocument } from './embedded/parent-document.model';\nimport { Address } from './shared/address.model';\nimport { Duration } from './shared/duration.model';\n\n@modelOptions({\n\tschemaOptions: { collection: 'vendorParents', toJSON: { virtuals: true }, toObject: { virtuals: true } },\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\nexport class VendorParent extends TimeStamps {\n\t@prop({ required: true, type: String, maxlength: 50 })\n\tpublic name!: string;\n\n\t@prop({ required: true, unique: true, type: String })\n\tpublic email!: string;\n\n\t@prop({ required: true, unique: true, type: String })\n\tpublic phoneNumber!: string;\n\n\t@prop({ required: true, type: Address })\n\tpublic address!: Address;\n\n\t@prop({ required: true, type: String, enum: ChargeType, default: ChargeType.CUSTOM })\n\tpublic chargeType!: ChargeType;\n\n\t@prop({ required: true, type: Charge })\n\tpublic charge!: Charge;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType\n\n\t@prop({ required: true, type: Duration })\n\tpublic commissionDuration!: Duration;\n\n\t@prop({ required: true, type: Boolean, default: true })\n\tpublic isServiceFeeCharged!: boolean;\n\n\t@prop({ ref: () => Admin })\n\tpublic businessDevExecutive?: Ref<Admin>;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: String })\n\tpublic profilePhoto?: string;\n\n\t@prop({ type: ParentDocument })\n\tpublic document?: ParentDocument;\n\n\t// @prop({\n\t// \tref: () => Shop,\n\t// \tforeignField: 'parent',\n\t// \tlocalField: '_id',\n\t// \tcount: true,\n\t// \tmatch: { deletedAt: null },\n\t// })\n\t// public shopCount?: number;\n}\n"]}
1
+ {"version":3,"file":"vendor-parent.model.js","sourceRoot":"/","sources":["libraries/mongo/models/vendor-parent.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA8E;AAC9E,4EAAqE;AACrE,kDAAuF;AACvF,+CAAsC;AACtC,0DAAiD;AACjD,4EAAkE;AAClE,0DAAiD;AACjD,4DAAmD;AACnD,iDAAwC;AACxC,kEAA6D;AAC7D,wBAA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,CAAC,aAAa,CAAC,CAAC;QACjF,CAAC;IACF,CAAC,CAAC;GACW,YAAY,CAgDxB","sourcesContent":["import { modelOptions, pre, prop, Ref, Severity } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ChargeType, CounterType, ServiceType, Status } from '../../../utilities/enum';\nimport { Admin } from './admin.model';\nimport { Charge } from './embedded/charge.model';\nimport { ParentDocument } from './embedded/parent-document.model';\nimport { Address } from './shared/address.model';\nimport { Duration } from './shared/duration.model';\nimport { Vendor } from './vendor.model';\nimport { generateId } from '../../../utilities/id-generator';\nimport { CounterModel } from '.';\n\n@modelOptions({\n\tschemaOptions: { collection: 'vendorParents', toJSON: { virtuals: true }, toObject: { virtuals: true } },\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@pre<VendorParent>('save', async function () {\n\tif (this.isNew) {\n\t\tthis.vendorParentId = await generateId(CounterModel, CounterType.VENDOR_PARENT);\n\t}\n})\nexport class VendorParent extends TimeStamps {\n\t@prop({ required: true, type: String, unique: true, index: true })\n\tpublic vendorParentId!: string;\n\n\t@prop({ required: true, type: String, maxlength: 50 })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String})\n\tpublic email!: string;\n\n\t@prop({ required: true, type: String})\n\tpublic phoneNumber!: string;\n\n\t@prop({ required: true, type: Address })\n\tpublic address!: Address;\n\n\t@prop({ required: true, type: Charge })\n\tpublic charge!: Charge;\n\n\t@prop({ required: true, type: String, enum: ServiceType })\n\tpublic serviceType!: ServiceType;\n\n\t@prop({ required: true, type: Duration })\n\tpublic commissionDuration!: Duration;\n\n\t@prop({ required: true, type: Boolean, default: true })\n\tpublic isServiceFeeCharged!: boolean;\n\n\t@prop({ ref: () => Admin })\n\tpublic businessDevExecutive?: Ref<Admin>;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: String })\n\tpublic profilePhoto?: string;\n\n\t@prop({ type: ParentDocument })\n\tpublic document?: ParentDocument;\n\n\t@prop({\n\t\tref: () => Vendor,\n\t\tforeignField: 'parent',\n\t\tlocalField: '_id',\n\t\tcount: true,\n\t\tmatch: { deletedAt: null },\n\t})\n\tpublic vendorCount?: number;\n}\n"]}
@@ -3,36 +3,27 @@ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
3
  import { ServiceType, Status } from '../../../utilities/enum';
4
4
  import { ShopDocument } from './embedded/shop-document.model';
5
5
  import { Address } from './shared/address.model';
6
- import { StartEndTime, WorkHourSetting } from './shared/work-hour.model';
7
- import { Tag } from './tag.model';
6
+ import { WorkHourSetting } from './shared/work-hour.model';
8
7
  import { Zone } from './zone.model';
9
8
  import { VendorParent } from '.';
10
- import { Service } from './service.model';
11
9
  import { ServiceOrderSettings } from './embedded/service-order-settings.model';
12
10
  export declare class Vendor extends TimeStamps {
13
11
  vendorId: string;
14
12
  name: string;
15
13
  ownerName: string;
16
14
  email: string;
17
- slug?: string;
18
15
  parent: Ref<VendorParent>;
19
- service: Ref<Service>;
20
- serviceType: ServiceType;
16
+ serviceType?: ServiceType;
21
17
  status: Status;
22
18
  phoneNumber: string;
23
19
  userPhoneNumber: string;
24
20
  additionalPhoneNumbers?: string[];
25
21
  address: Address;
26
- zone: Ref<Zone>[];
22
+ zones: Ref<Zone>[];
27
23
  logo?: string;
28
24
  banner?: string;
29
25
  document?: ShopDocument;
30
- vendorActiveTimingsOfCurrentDate?: StartEndTime[];
31
- tags?: Ref<Tag>[];
32
- sortingOrder?: number;
33
26
  avgRating?: number;
34
- priceRange?: number;
35
- isBeirutAuthentic: boolean;
36
27
  isVisibleToUser: boolean;
37
28
  ordersCount?: number;
38
29
  customersCount?: number;
@@ -8,9 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.Vendor = void 0;
16
13
  const typegoose_1 = require("@typegoose/typegoose");
@@ -19,11 +16,8 @@ const enum_1 = require("../../../utilities/enum");
19
16
  const shop_document_model_1 = require("./embedded/shop-document.model");
20
17
  const address_model_1 = require("./shared/address.model");
21
18
  const work_hour_model_1 = require("./shared/work-hour.model");
22
- const tag_model_1 = require("./tag.model");
23
19
  const zone_model_1 = require("./zone.model");
24
20
  const _1 = require(".");
25
- const slugify_1 = __importDefault(require("slugify"));
26
- const service_model_1 = require("./service.model");
27
21
  const service_order_settings_model_1 = require("./embedded/service-order-settings.model");
28
22
  const id_generator_1 = require("../../../utilities/id-generator");
29
23
  let Vendor = class Vendor extends defaultClasses_1.TimeStamps {
@@ -31,25 +25,18 @@ let Vendor = class Vendor extends defaultClasses_1.TimeStamps {
31
25
  name;
32
26
  ownerName;
33
27
  email;
34
- slug;
35
28
  parent;
36
- service;
37
29
  serviceType;
38
30
  status;
39
31
  phoneNumber;
40
32
  userPhoneNumber;
41
33
  additionalPhoneNumbers;
42
34
  address;
43
- zone;
35
+ zones;
44
36
  logo;
45
37
  banner;
46
38
  document;
47
- vendorActiveTimingsOfCurrentDate;
48
- tags;
49
- sortingOrder;
50
39
  avgRating;
51
- priceRange;
52
- isBeirutAuthentic;
53
40
  isVisibleToUser;
54
41
  ordersCount;
55
42
  customersCount;
@@ -60,7 +47,7 @@ let Vendor = class Vendor extends defaultClasses_1.TimeStamps {
60
47
  };
61
48
  exports.Vendor = Vendor;
62
49
  __decorate([
63
- (0, typegoose_1.prop)({ type: String, unique: true, index: true }),
50
+ (0, typegoose_1.prop)({ required: true, type: String, unique: true, index: true }),
64
51
  __metadata("design:type", String)
65
52
  ], Vendor.prototype, "vendorId", void 0);
66
53
  __decorate([
@@ -75,20 +62,12 @@ __decorate([
75
62
  (0, typegoose_1.prop)({ required: true, type: String }),
76
63
  __metadata("design:type", String)
77
64
  ], Vendor.prototype, "email", void 0);
78
- __decorate([
79
- (0, typegoose_1.prop)({ unique: true, type: String }),
80
- __metadata("design:type", String)
81
- ], Vendor.prototype, "slug", void 0);
82
65
  __decorate([
83
66
  (0, typegoose_1.prop)({ required: true, ref: () => _1.VendorParent }),
84
67
  __metadata("design:type", Object)
85
68
  ], Vendor.prototype, "parent", void 0);
86
69
  __decorate([
87
- (0, typegoose_1.prop)({ required: true, ref: () => service_model_1.Service }),
88
- __metadata("design:type", Object)
89
- ], Vendor.prototype, "service", void 0);
90
- __decorate([
91
- (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.ServiceType }),
70
+ (0, typegoose_1.prop)({ type: String, enum: enum_1.ServiceType }),
92
71
  __metadata("design:type", String)
93
72
  ], Vendor.prototype, "serviceType", void 0);
94
73
  __decorate([
@@ -112,9 +91,9 @@ __decorate([
112
91
  __metadata("design:type", address_model_1.Address)
113
92
  ], Vendor.prototype, "address", void 0);
114
93
  __decorate([
115
- (0, typegoose_1.prop)({ required: true, ref: () => zone_model_1.Zone, type: () => [String] }),
94
+ (0, typegoose_1.prop)({ required: true, ref: () => zone_model_1.Zone }),
116
95
  __metadata("design:type", Array)
117
- ], Vendor.prototype, "zone", void 0);
96
+ ], Vendor.prototype, "zones", void 0);
118
97
  __decorate([
119
98
  (0, typegoose_1.prop)({ type: String }),
120
99
  __metadata("design:type", String)
@@ -127,30 +106,10 @@ __decorate([
127
106
  (0, typegoose_1.prop)({ type: shop_document_model_1.ShopDocument }),
128
107
  __metadata("design:type", shop_document_model_1.ShopDocument)
129
108
  ], Vendor.prototype, "document", void 0);
130
- __decorate([
131
- (0, typegoose_1.prop)({ type: () => [work_hour_model_1.StartEndTime], default: [] }),
132
- __metadata("design:type", Array)
133
- ], Vendor.prototype, "vendorActiveTimingsOfCurrentDate", void 0);
134
- __decorate([
135
- (0, typegoose_1.prop)({ ref: () => tag_model_1.Tag, default: [] }),
136
- __metadata("design:type", Array)
137
- ], Vendor.prototype, "tags", void 0);
138
- __decorate([
139
- (0, typegoose_1.prop)({ type: Number }),
140
- __metadata("design:type", Number)
141
- ], Vendor.prototype, "sortingOrder", void 0);
142
109
  __decorate([
143
110
  (0, typegoose_1.prop)({ default: 0, type: () => Number }),
144
111
  __metadata("design:type", Number)
145
112
  ], Vendor.prototype, "avgRating", void 0);
146
- __decorate([
147
- (0, typegoose_1.prop)({ type: Number, default: 1, min: 1, max: 4 }),
148
- __metadata("design:type", Number)
149
- ], Vendor.prototype, "priceRange", void 0);
150
- __decorate([
151
- (0, typegoose_1.prop)({ required: true, type: Boolean }),
152
- __metadata("design:type", Boolean)
153
- ], Vendor.prototype, "isBeirutAuthentic", void 0);
154
113
  __decorate([
155
114
  (0, typegoose_1.prop)({ required: true, type: Boolean }),
156
115
  __metadata("design:type", Boolean)
@@ -186,21 +145,10 @@ exports.Vendor = Vendor = __decorate([
186
145
  }),
187
146
  (0, typegoose_1.Index)({ name: 1, serviceType: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
188
147
  (0, typegoose_1.Index)({ parent: 1, status: 1, isVisibleToUser: 1, deletedAt: 1 }),
148
+ (0, typegoose_1.Index)({ serviceType: 1, zones: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
189
149
  (0, typegoose_1.pre)('save', async function () {
190
150
  if (this.isNew) {
191
151
  this.vendorId = await (0, id_generator_1.generateId)(_1.CounterModel, enum_1.CounterType.VENDOR);
192
- const baseSlug = (0, slugify_1.default)(this.name, { lower: true, strict: true });
193
- let slug = baseSlug;
194
- let count = 0;
195
- while (await _1.VendorModel.exists({ slug })) {
196
- count++;
197
- slug = `${baseSlug}-${count}`;
198
- }
199
- this.slug = slug;
200
- const maxSortingOrder = await _1.VendorModel.aggregate([
201
- { $group: { _id: null, maxSortingOrder: { $max: '$sortingOrder' } } }
202
- ]);
203
- this.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;
204
152
  }
205
153
  })
206
154
  ], Vendor);