@lyxa.ai/core 1.0.327 → 1.0.329

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.
@@ -40,6 +40,10 @@ let CachedSettingsService = class CachedSettingsService {
40
40
  async updateSettings() {
41
41
  const key = getSettingsKey();
42
42
  await this.redisService.deleteCachedObject(key);
43
+ const settings = await models_1.SettingModel.findOne({}).lean().exec();
44
+ if (!settings)
45
+ throw new Error('Settings not found');
46
+ await this.redisService.cacheObject(key, settings);
43
47
  return 'Settings cache cleared successfully';
44
48
  }
45
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/cache/settings/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAyC;AACzC,uCAA2C;AAC3C,+CAAkD;AAElD,MAAM,cAAc,GAAG,GAAW,EAAE;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC;IAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,KAAK,CAAC;IACrD,OAAO,YAAY,MAAM,IAAI,WAAW,EAAE,CAAC;AAC5C,CAAC,CAAC;AAGK,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACwB;IAAzD,YAAyD,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAEvF,KAAK,CAAC,WAAW;QAChB,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAM,GAAG,CAAC,CAAC;QACjE,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAC1B,MAAM,QAAQ,GAAG,MAAM,qBAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9D,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACrD,MAAM,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,cAAc;QACnB,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAChD,OAAO,qCAAqC,CAAC;IAC9C,CAAC;CACD,CAAA;AAlBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,gBAAO,GAAE;IAEI,WAAA,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,oBAAY,CAAC,CAAA;qCAAgC,oBAAY;GADvE,qBAAqB,CAkBjC","sourcesContent":["import { Service, Inject } from 'typedi';\nimport { RedisService } from '../../redis';\nimport { SettingModel } from '../../mongo/models';\n\nconst getSettingsKey = (): string => {\n\tconst tenant = process.env.tenant || 'lb';\n\tconst environment = process.env.environment || 'dev';\n\treturn `settings:${tenant}:${environment}`;\n};\n\n@Service()\nexport class CachedSettingsService {\n\tconstructor(@Inject(() => RedisService) private readonly redisService: RedisService) {}\n\n\tasync getSettings(): Promise<any> {\n\t\tconst key = getSettingsKey();\n\t\tconst cached = await this.redisService.getCachedObject<any>(key);\n\t\tif (cached) return cached;\n\t\tconst settings = await SettingModel.findOne({}).lean().exec();\n\t\tif (!settings) throw new Error('Settings not found');\n\t\tawait this.redisService.cacheObject(key, settings);\n\t\treturn settings;\n\t}\n\n\tasync updateSettings(): Promise<string> {\t\t\n\t\tconst key = getSettingsKey();\n\t\tawait this.redisService.deleteCachedObject(key);\n\t\treturn 'Settings cache cleared successfully';\n\t}\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/cache/settings/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAyC;AACzC,uCAA2C;AAC3C,+CAAkD;AAElD,MAAM,cAA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QAAQ,CAAC,CAAC;QACnD,OAAO,qCAAqC,CAAC;IAC9C,CAAC;CACD,CAAA;AArBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,gBAAO,GAAE;IAEI,WAAA,IAAA,eAAM,EAAC,GAAG,EAAE,CAAC,oBAAY,CAAC,CAAA;qCAAgC,oBAAY;GADvE,qBAAqB,CAqBjC","sourcesContent":["import { Service, Inject } from 'typedi';\nimport { RedisService } from '../../redis';\nimport { SettingModel } from '../../mongo/models';\n\nconst getSettingsKey = (): string => {\n\tconst tenant = process.env.tenant || 'lb';\n\tconst environment = process.env.environment || 'dev';\n\treturn `settings:${tenant}:${environment}`;\n};\n\n@Service()\nexport class CachedSettingsService {\n\tconstructor(@Inject(() => RedisService) private readonly redisService: RedisService) {}\n\n\tasync getSettings(): Promise<any> {\n\t\tconst key = getSettingsKey();\n\t\tconst cached = await this.redisService.getCachedObject<any>(key);\n\t\tif (cached) return cached;\n\t\tconst settings = await SettingModel.findOne({}).lean().exec();\n\t\tif (!settings) throw new Error('Settings not found');\n\t\tawait this.redisService.cacheObject(key, settings);\n\t\treturn settings;\n\t}\n\n\tasync updateSettings(): Promise<string> {\t\t\n\t\tconst key = getSettingsKey();\n\t\tawait this.redisService.deleteCachedObject(key);\n\t\tconst settings = await SettingModel.findOne({}).lean().exec();\n\t\tif (!settings) throw new Error('Settings not found');\n\t\tawait this.redisService.cacheObject(key, settings);\n\t\treturn 'Settings cache cleared successfully';\n\t}\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import { Ref } from '@typegoose/typegoose';
2
+ import { WeekDay } from '../../../../utilities/enum';
3
+ import { Service } from '../service.model';
4
+ export declare class CapacitySettings {
5
+ day: WeekDay;
6
+ service: Ref<Service>;
7
+ numberOfProfessionals: number;
8
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CapacitySettings = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ const enum_1 = require("../../../../utilities/enum");
15
+ let CapacitySettings = class CapacitySettings {
16
+ day;
17
+ service;
18
+ numberOfProfessionals;
19
+ };
20
+ exports.CapacitySettings = CapacitySettings;
21
+ __decorate([
22
+ (0, typegoose_1.prop)({ required: true, type: Number, enum: enum_1.WeekDay }),
23
+ __metadata("design:type", Number)
24
+ ], CapacitySettings.prototype, "day", void 0);
25
+ __decorate([
26
+ (0, typegoose_1.prop)({ required: true }),
27
+ __metadata("design:type", Object)
28
+ ], CapacitySettings.prototype, "service", void 0);
29
+ __decorate([
30
+ (0, typegoose_1.prop)({
31
+ required: true,
32
+ type: Number,
33
+ }),
34
+ __metadata("design:type", Number)
35
+ ], CapacitySettings.prototype, "numberOfProfessionals", void 0);
36
+ exports.CapacitySettings = CapacitySettings = __decorate([
37
+ (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'capacitySettings' } })
38
+ ], CapacitySettings);
39
+ //# sourceMappingURL=capacity-settings.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capacity-settings.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/capacity-settings.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAC/D,qDAAqD;AAI9C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGlB,GAAG,CAAW;IAGd,OAAO,CAAe;IAMtB,qBAAqB,CAAU;CACzC,CAAA;AAbY,4CAAgB;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAO,EAAE,CAAC;;6CACjC;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACI;AAMtB;IAJN,IAAA,gBAAI,EAAC;QACF,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,MAAM;KACf,CAAC;;+DACoC;2BAZ7B,gBAAgB;IAD5B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE,EAAE,CAAC;GACvD,gBAAgB,CAa5B","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { WeekDay } from '../../../../utilities/enum';\nimport { Service } from '../service.model';\n\n@modelOptions({ schemaOptions: { collection: 'capacitySettings' } })\nexport class CapacitySettings {\n\n @prop({ required: true, type: Number, enum: WeekDay })\n public day!: WeekDay;\n\n @prop({ required: true })\n public service!: Ref<Service>\n\n @prop({\n required: true,\n type: Number,\n })\n public numberOfProfessionals!: number;\n}\n"]}
@@ -1,10 +1,9 @@
1
1
  import { FrequencyConfig } from './frequency-configuration.model';
2
2
  export declare class ServiceOrderSettings {
3
- slotBufferTime: number;
4
- slotInterval: number;
5
- frequencyConfigs: FrequencyConfig[];
6
- servicePreparationTime: number;
7
- maxBookingsPerSlot: number;
8
- autoUrgencyTimeLimit: number;
9
- numberOfProfessionalsPerDay: number;
3
+ slotBufferTime?: number;
4
+ slotInterval?: number;
5
+ frequencyConfigs?: FrequencyConfig[];
6
+ servicePreparationTime?: number;
7
+ maxBookingsPerSlot?: number;
8
+ autoUrgencyTimeLimit?: number;
10
9
  }
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ServiceOrderSettings = void 0;
13
13
  const typegoose_1 = require("@typegoose/typegoose");
14
+ const frequency_configuration_model_1 = require("./frequency-configuration.model");
14
15
  let ServiceOrderSettings = class ServiceOrderSettings {
15
16
  slotBufferTime;
16
17
  slotInterval;
@@ -18,7 +19,6 @@ let ServiceOrderSettings = class ServiceOrderSettings {
18
19
  servicePreparationTime;
19
20
  maxBookingsPerSlot;
20
21
  autoUrgencyTimeLimit;
21
- numberOfProfessionalsPerDay;
22
22
  };
23
23
  exports.ServiceOrderSettings = ServiceOrderSettings;
24
24
  __decorate([
@@ -38,12 +38,11 @@ __decorate([
38
38
  __metadata("design:type", Number)
39
39
  ], ServiceOrderSettings.prototype, "slotInterval", void 0);
40
40
  __decorate([
41
- (0, typegoose_1.prop)({ required: true }),
41
+ (0, typegoose_1.prop)({ type: () => [frequency_configuration_model_1.FrequencyConfig] }),
42
42
  __metadata("design:type", Array)
43
43
  ], ServiceOrderSettings.prototype, "frequencyConfigs", void 0);
44
44
  __decorate([
45
45
  (0, typegoose_1.prop)({
46
- required: true,
47
46
  type: Number,
48
47
  min: 0,
49
48
  max: 200,
@@ -53,7 +52,6 @@ __decorate([
53
52
  ], ServiceOrderSettings.prototype, "servicePreparationTime", void 0);
54
53
  __decorate([
55
54
  (0, typegoose_1.prop)({
56
- required: true,
57
55
  default: 3,
58
56
  min: 1,
59
57
  }),
@@ -61,20 +59,12 @@ __decorate([
61
59
  ], ServiceOrderSettings.prototype, "maxBookingsPerSlot", void 0);
62
60
  __decorate([
63
61
  (0, typegoose_1.prop)({
64
- required: true,
65
62
  default: 6,
66
63
  min: 0,
67
64
  max: 72,
68
65
  }),
69
66
  __metadata("design:type", Number)
70
67
  ], ServiceOrderSettings.prototype, "autoUrgencyTimeLimit", void 0);
71
- __decorate([
72
- (0, typegoose_1.prop)({
73
- required: true,
74
- type: Number,
75
- }),
76
- __metadata("design:type", Number)
77
- ], ServiceOrderSettings.prototype, "numberOfProfessionalsPerDay", void 0);
78
68
  exports.ServiceOrderSettings = ServiceOrderSettings = __decorate([
79
69
  (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'serviceOrderSettings' } })
80
70
  ], ServiceOrderSettings);
@@ -1 +1 @@
1
- {"version":3,"file":"service-order-settings.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-settings.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAKxD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAMzB,cAAc,CAAU;IAOxB,YAAY,CAAS;IAGrB,gBAAgB,CAAqB;IASrC,sBAAsB,CAAU;IAOhC,kBAAkB,CAAU;IAQ5B,oBAAoB,CAAU;IAM9B,2BAA2B,CAAU;CAC5C,CAAA;AA/CY,oDAAoB;AAMzB;IALN,IAAA,gBAAI,EAAC;QACL,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;QACP,OAAO,EAAE,CAAC;KACV,CAAC;;4DAC6B;AAOxB;IALN,IAAA,gBAAI,EAAC;QACL,GAAG,EAAE,EAAE;QACP,GAAG,EAAE,GAAG;QACR,OAAO,EAAE,EAAE;KACX,CAAC;;0DAC0B;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8DACmB;AASrC;IAPN,IAAA,gBAAI,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,GAAG;QACR,OAAO,EAAE,CAAC;KACV,CAAC;;oEACqC;AAOhC;IALN,IAAA,gBAAI,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,CAAC;KACN,CAAC;;gEACiC;AAQ5B;IANN,IAAA,gBAAI,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;KACP,CAAC;;kEACmC;AAM9B;IAJN,IAAA,gBAAI,EAAC;QACL,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,MAAM;KACZ,CAAC;;yEAC0C;+BA9ChC,oBAAoB;IADhC,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,sBAAsB,EAAE,EAAE,CAAC;GAC3D,oBAAoB,CA+ChC","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { Vendor } from '../vendor.model';\nimport { FrequencyConfig } from './frequency-configuration.model';\n\n@modelOptions({ schemaOptions: { collection: 'serviceOrderSettings' } })\nexport class ServiceOrderSettings {\n\t@prop({\n\t\tmin: 5,\n\t\tmax: 60,\n\t\tdefault: 5,\n\t})\n\tpublic slotBufferTime!: number; // minutes\n\n\t@prop({\n\t\tmin: 30,\n\t\tmax: 120,\n\t\tdefault: 30,\n\t})\n\tpublic slotInterval: number; // minutes\n\n\t@prop({ required: true })\n\tpublic frequencyConfigs!: FrequencyConfig[];\n\n\t@prop({\n\t\trequired: true,\n\t\ttype: Number,\n\t\tmin: 0,\n\t\tmax: 200,\n\t\tdefault: 3,\n\t})\n\tpublic servicePreparationTime!: number; // hours\n\n\t@prop({\n\t\trequired: true,\n\t\tdefault: 3,\n\t\tmin: 1,\n\t})\n\tpublic maxBookingsPerSlot!: number;\n\n\t@prop({\n\t\trequired: true,\n\t\tdefault: 6,\n\t\tmin: 0,\n\t\tmax: 72,\n\t})\n\tpublic autoUrgencyTimeLimit!: number; // hours\n\n\t@prop({\n\t\trequired: true,\n\t\ttype: Number,\n\t})\n\tpublic numberOfProfessionalsPerDay!: number;\n}\n"]}
1
+ {"version":3,"file":"service-order-settings.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-settings.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAE/D,mFAAkE;AAG3D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAMzB,cAAc,CAAU;IAOxB,YAAY,CAAU;IAGtB,gBAAgB,CAAqB;IAQrC,sBAAsB,CAAU;IAMhC,kBAAkB,CAAU;IAO5B,oBAAoB,CAAU;CACrC,CAAA;AAtCY,oDAAoB;AAMzB;IALN,IAAA,gBAAI,EAAC;QACL,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;QACP,OAAO,EAAE,CAAC;KACV,CAAC;;4DAC6B;AAOxB;IALN,IAAA,gBAAI,EAAC;QACL,GAAG,EAAE,EAAE;QACP,GAAG,EAAE,GAAG;QACR,OAAO,EAAE,EAAE;KACX,CAAC;;0DAC2B;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,+CAAe,CAAC,EAAE,CAAC;;8DACI;AAQrC;IANN,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,GAAG;QACR,OAAO,EAAE,CAAC;KACV,CAAC;;oEACqC;AAMhC;IAJN,IAAA,gBAAI,EAAC;QACL,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,CAAC;KACN,CAAC;;gEACiC;AAO5B;IALN,IAAA,gBAAI,EAAC;QACL,OAAO,EAAE,CAAC;QACV,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;KACP,CAAC;;kEACmC;+BArCzB,oBAAoB;IADhC,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,sBAAsB,EAAE,EAAE,CAAC;GAC3D,oBAAoB,CAsChC","sourcesContent":["import { modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { Vendor } from '../vendor.model';\nimport { FrequencyConfig } from './frequency-configuration.model';\n\n@modelOptions({ schemaOptions: { collection: 'serviceOrderSettings' } })\nexport class ServiceOrderSettings {\n\t@prop({\n\t\tmin: 5,\n\t\tmax: 60,\n\t\tdefault: 5,\n\t})\n\tpublic slotBufferTime?: number; // minutes\n\n\t@prop({\n\t\tmin: 30,\n\t\tmax: 120,\n\t\tdefault: 30,\n\t})\n\tpublic slotInterval?: number; // minutes\n\n\t@prop({ type: () => [FrequencyConfig] })\n\tpublic frequencyConfigs?: FrequencyConfig[];\n\n\t@prop({\n\t\ttype: Number,\n\t\tmin: 0,\n\t\tmax: 200,\n\t\tdefault: 3,\n\t})\n\tpublic servicePreparationTime?: number; // hours\n\n\t@prop({\n\t\tdefault: 3,\n\t\tmin: 1,\n\t})\n\tpublic maxBookingsPerSlot?: number;\n\n\t@prop({\n\t\tdefault: 6,\n\t\tmin: 0,\n\t\tmax: 72,\n\t})\n\tpublic autoUrgencyTimeLimit?: number; // hours\n}\n"]}
@@ -9,6 +9,7 @@ import { Zone } from './zone.model';
9
9
  import { VendorParent } from '.';
10
10
  import { Service } from "./service.model";
11
11
  import { ServiceOrderSettings } from './embedded/service-order-settings.model';
12
+ import { CapacitySettings } from './embedded/capacity-settings.model';
12
13
  export declare class Vendor extends TimeStamps {
13
14
  name: string;
14
15
  ownerName: string;
@@ -25,7 +26,6 @@ export declare class Vendor extends TimeStamps {
25
26
  logo?: string;
26
27
  banner?: string;
27
28
  document?: ShopDocument;
28
- workHourSetting?: WorkHourSetting;
29
29
  vendorActiveTimingsOfCurrentDate?: StartEndTime[];
30
30
  tags?: Ref<Tag>[];
31
31
  isVisibleToUser: boolean;
@@ -37,4 +37,6 @@ export declare class Vendor extends TimeStamps {
37
37
  ordersCount?: number;
38
38
  customersCount?: number;
39
39
  orderSettings?: ServiceOrderSettings;
40
+ capacitySettings?: CapacitySettings[];
41
+ workHourSetting?: WorkHourSetting;
40
42
  }
@@ -25,6 +25,7 @@ const _1 = require(".");
25
25
  const slugify_1 = __importDefault(require("slugify"));
26
26
  const service_model_1 = require("./service.model");
27
27
  const service_order_settings_model_1 = require("./embedded/service-order-settings.model");
28
+ const capacity_settings_model_1 = require("./embedded/capacity-settings.model");
28
29
  let Vendor = class Vendor extends defaultClasses_1.TimeStamps {
29
30
  name;
30
31
  ownerName;
@@ -41,7 +42,6 @@ let Vendor = class Vendor extends defaultClasses_1.TimeStamps {
41
42
  logo;
42
43
  banner;
43
44
  document;
44
- workHourSetting;
45
45
  vendorActiveTimingsOfCurrentDate;
46
46
  tags;
47
47
  isVisibleToUser;
@@ -53,6 +53,8 @@ let Vendor = class Vendor extends defaultClasses_1.TimeStamps {
53
53
  ordersCount;
54
54
  customersCount;
55
55
  orderSettings;
56
+ capacitySettings;
57
+ workHourSetting;
56
58
  };
57
59
  exports.Vendor = Vendor;
58
60
  __decorate([
@@ -115,10 +117,6 @@ __decorate([
115
117
  (0, typegoose_1.prop)({ type: shop_document_model_1.ShopDocument }),
116
118
  __metadata("design:type", shop_document_model_1.ShopDocument)
117
119
  ], Vendor.prototype, "document", void 0);
118
- __decorate([
119
- (0, typegoose_1.prop)({ type: work_hour_model_1.WorkHourSetting }),
120
- __metadata("design:type", work_hour_model_1.WorkHourSetting)
121
- ], Vendor.prototype, "workHourSetting", void 0);
122
120
  __decorate([
123
121
  (0, typegoose_1.prop)({ type: () => [work_hour_model_1.StartEndTime], default: [] }),
124
122
  __metadata("design:type", Array)
@@ -163,6 +161,14 @@ __decorate([
163
161
  (0, typegoose_1.prop)({ type: () => service_order_settings_model_1.ServiceOrderSettings }),
164
162
  __metadata("design:type", service_order_settings_model_1.ServiceOrderSettings)
165
163
  ], Vendor.prototype, "orderSettings", void 0);
164
+ __decorate([
165
+ (0, typegoose_1.prop)({ type: () => [capacity_settings_model_1.CapacitySettings] }),
166
+ __metadata("design:type", Array)
167
+ ], Vendor.prototype, "capacitySettings", void 0);
168
+ __decorate([
169
+ (0, typegoose_1.prop)({ type: work_hour_model_1.WorkHourSetting }),
170
+ __metadata("design:type", work_hour_model_1.WorkHourSetting)
171
+ ], Vendor.prototype, "workHourSetting", void 0);
166
172
  exports.Vendor = Vendor = __decorate([
167
173
  (0, typegoose_1.modelOptions)({
168
174
  schemaOptions: { collection: 'vendors' },
@@ -1 +1 @@
1
- {"version":3,"file":"vendor.model.js","sourceRoot":"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CAAC,KAAK,EAAE,CAAC;gBAChB,MAAM,QAAQ,GAAG,IAAA,iBAAO,EAAC,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;gBACnE,IAAI,IAAI,GAAG,QAAQ,CAAC;gBACpB,IAAI,KAAK,GAAG,CAAC,CAAC;gBACd,OAAO,MAAM,cAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;oBAC3C,KAAK,EAAE,CAAC;oBACR,IAAI,GAAG,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC;gBAC/B,CAAC;gBACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YAClB,CAAC;YACD,IAAI,EAAE,CAAC;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAc,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,MAAM,CAiFlB","sourcesContent":["import { modelOptions, prop, Ref, Severity, Index, pre } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Status } from '../../../utilities/enum';\nimport { ShopDocument } from './embedded/shop-document.model';\nimport { Address } from './shared/address.model';\nimport { StartEndTime, WorkHourSetting } from './shared/work-hour.model';\nimport { Tag } from './tag.model';\nimport { Zone } from './zone.model';\nimport { VendorParent, VendorModel } from '.';\nimport slugify from 'slugify';\nimport { Service } from \"./service.model\";\nimport { ServiceOrderSettings } from './embedded/service-order-settings.model';\n\n@modelOptions({\n\tschemaOptions: { collection: 'vendors' },\n\toptions: { allowMixed: Severity.ALLOW },\n})\n@Index({ name: 1, itemType: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index({ parent: 1, status: 1, isVisibleToUser: 1, deletedAt: 1 })\n@pre<Vendor>('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 VendorModel.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\ttry {\n\t\tif (this.isNew) {\n\t\t\tconst baseSlug = slugify(this.name, { lower: true, strict: true });\n\t\t\tlet slug = baseSlug;\n\t\t\tlet count = 0;\n\t\t\twhile (await VendorModel.exists({ slug })) {\n\t\t\t\tcount++;\n\t\t\t\tslug = `${baseSlug}-${count}`;\n\t\t\t}\n\t\t\tthis.slug = slug;\n\t\t}\n\t\tnext();\n\t} catch (error) {\n\t\tnext(error as Error);\n\t}\n\tnext();\n})\nexport class Vendor extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic ownerName!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic email!: string;\n\n\t@prop({ unique: true, type: String })\n\tpublic slug?: string;\n\n\t@prop({ required: true, ref: () => VendorParent })\n\tpublic parent: Ref<VendorParent>;\n\n\t@prop({ required: true, ref: () => Service })\n\tpublic service: Ref<Service>\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 })\n\tpublic phoneNumber!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic userPhoneNumber!: string;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic additionalPhoneNumbers?: string[];\n\n\t@prop({ required: true, type: Address })\n\tpublic address!: Address;\n\n\t@prop({ required: true, ref: () => Zone, type: () => [String] })\n\tpublic zone!: Ref<Zone>[];\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: String })\n\tpublic banner?: string;\n\n\t@prop({ type: ShopDocument })\n\tpublic document?: ShopDocument;\n\n\t@prop({ type: WorkHourSetting })\n\tpublic workHourSetting?: WorkHourSetting;\n\n\t@prop({ type: () => [StartEndTime], default: [] })\n\tpublic vendorActiveTimingsOfCurrentDate?: StartEndTime[];\n\n\t@prop({ ref: () => Tag, default: [] })\n\tpublic tags?: Ref<Tag>[];\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUser!: boolean;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t@prop({ required: false, type: () => Boolean })\n\tpublic isFavouriteCategoryVisible?: boolean;\n\n\t@prop({ required: false, type: () => String })\n\tpublic favouriteCategoryTitle?: string;\n\n\t@prop({ required: false, type: () => Boolean })\n\tpublic isBestSellerCategoryVisible?: boolean;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic avgRating?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic ordersCount?: number\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic customersCount?: number\n\n\t@prop({ type: () => ServiceOrderSettings })\n\tpublic orderSettings?: ServiceOrderSettings\n}\n"]}
1
+ {"version":3,"file":"vendor.model.js","sourceRoot":"/","sources":["libraries/mongo/models/vendor.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAqF;AACrF,4EAAqE;AACrE,kDAAiD;AACjD,wEAA8D;AAC9D,0DAAiD;AACjD,8DAAyE;AACzE,2CAAkC;AAClC,6CAAoC;AACpC,wBAA8C;AAC9C,sDAA8B;AAC9B,mDAA0C;AAC1C,0FAA+E;AAC/E,gFAAsE;AA6C/D,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,2BAAU;IAE9B,IAAI,CAAU;IAGd,SAAS,CAAU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pB,IAAI,KAAK,GAAG,CAAC,CAAC;gBACd,OAAO,MAAM,cAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;oBAC3C,KAAK,EAAE,CAAC;oBACR,IAAI,GAAG,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC;gBAC/B,CAAC;gBACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YAClB,CAAC;YACD,IAAI,EAAE,CAAC;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAc,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,MAAM,CAoFlB","sourcesContent":["import { modelOptions, prop, Ref, Severity, Index, pre } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Status } from '../../../utilities/enum';\nimport { ShopDocument } from './embedded/shop-document.model';\nimport { Address } from './shared/address.model';\nimport { StartEndTime, WorkHourSetting } from './shared/work-hour.model';\nimport { Tag } from './tag.model';\nimport { Zone } from './zone.model';\nimport { VendorParent, VendorModel } from '.';\nimport slugify from 'slugify';\nimport { Service } from \"./service.model\";\nimport { ServiceOrderSettings } from './embedded/service-order-settings.model';\nimport { CapacitySettings } from './embedded/capacity-settings.model';\n\n@modelOptions({\n\tschemaOptions: { collection: 'vendors' },\n\toptions: { allowMixed: Severity.ALLOW },\n})\n@Index({ name: 1, itemType: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index({ parent: 1, status: 1, isVisibleToUser: 1, deletedAt: 1 })\n@pre<Vendor>('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 VendorModel.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\ttry {\n\t\tif (this.isNew) {\n\t\t\tconst baseSlug = slugify(this.name, { lower: true, strict: true });\n\t\t\tlet slug = baseSlug;\n\t\t\tlet count = 0;\n\t\t\twhile (await VendorModel.exists({ slug })) {\n\t\t\t\tcount++;\n\t\t\t\tslug = `${baseSlug}-${count}`;\n\t\t\t}\n\t\t\tthis.slug = slug;\n\t\t}\n\t\tnext();\n\t} catch (error) {\n\t\tnext(error as Error);\n\t}\n\tnext();\n})\nexport class Vendor extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic ownerName!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic email!: string;\n\n\t@prop({ unique: true, type: String })\n\tpublic slug?: string;\n\n\t@prop({ required: true, ref: () => VendorParent })\n\tpublic parent: Ref<VendorParent>;\n\n\t@prop({ required: true, ref: () => Service })\n\tpublic service: Ref<Service>\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 })\n\tpublic phoneNumber!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic userPhoneNumber!: string;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic additionalPhoneNumbers?: string[];\n\n\t@prop({ required: true, type: Address })\n\tpublic address!: Address;\n\n\t@prop({ required: true, ref: () => Zone, type: () => [String] })\n\tpublic zone!: Ref<Zone>[];\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: String })\n\tpublic banner?: string;\n\n\t@prop({ type: ShopDocument })\n\tpublic document?: ShopDocument;\n\n\t@prop({ type: () => [StartEndTime], default: [] })\n\tpublic vendorActiveTimingsOfCurrentDate?: StartEndTime[];\n\n\t@prop({ ref: () => Tag, default: [] })\n\tpublic tags?: Ref<Tag>[];\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUser!: boolean;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t@prop({ required: false, type: () => Boolean })\n\tpublic isFavouriteCategoryVisible?: boolean;\n\n\t@prop({ required: false, type: () => String })\n\tpublic favouriteCategoryTitle?: string;\n\n\t@prop({ required: false, type: () => Boolean })\n\tpublic isBestSellerCategoryVisible?: boolean;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic avgRating?: number;\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic ordersCount?: number\n\n\t@prop({ default: 0, type: () => Number })\n\tpublic customersCount?: number\n\n\t@prop({ type: () => ServiceOrderSettings })\n\tpublic orderSettings?: ServiceOrderSettings\n\n\t@prop({type: ()=> [CapacitySettings]})\n\tpublic capacitySettings?: CapacitySettings[]\n\n\t@prop({ type: WorkHourSetting })\n\tpublic workHourSetting?: WorkHourSetting;\n}\n"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.0.327
25
+ Version: 1.0.329
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.0.327",
3
+ "version": "1.0.329",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.0.327",
3
+ "version": "1.0.329",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",