@lyxa.ai/core 1.3.251 → 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.
- package/dist/libraries/mongo/models/professional.model.js +1 -1
- package/dist/libraries/mongo/models/professional.model.js.map +1 -1
- package/dist/libraries/mongo/models/service-addon.model.d.ts +1 -1
- package/dist/libraries/mongo/models/service-addon.model.js +4 -4
- package/dist/libraries/mongo/models/service-addon.model.js.map +1 -1
- package/dist/libraries/mongo/models/service-category.model.js +1 -1
- package/dist/libraries/mongo/models/service-category.model.js.map +1 -1
- package/dist/libraries/mongo/models/service.model.js +2 -2
- package/dist/libraries/mongo/models/service.model.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/package.json +1 -1
|
@@ -68,7 +68,7 @@ __decorate([
|
|
|
68
68
|
__metadata("design:type", Array)
|
|
69
69
|
], Professional.prototype, "availability", void 0);
|
|
70
70
|
__decorate([
|
|
71
|
-
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.SubServiceType }),
|
|
71
|
+
(0, typegoose_1.prop)({ required: true, type: [String], enum: enum_1.SubServiceType }),
|
|
72
72
|
__metadata("design:type", Array)
|
|
73
73
|
], Professional.prototype, "worksOn", void 0);
|
|
74
74
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
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,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, 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"]}
|
|
@@ -5,7 +5,7 @@ import { PreparingTime } from './embedded/preparing-time.model';
|
|
|
5
5
|
export declare class ServiceAddon {
|
|
6
6
|
name: string;
|
|
7
7
|
serviceType: ServiceType;
|
|
8
|
-
|
|
8
|
+
subServiceTypes?: SubServiceType[];
|
|
9
9
|
vendor: Ref<Vendor>;
|
|
10
10
|
image: string;
|
|
11
11
|
price: number;
|
|
@@ -21,7 +21,7 @@ const preparing_time_model_1 = require("./embedded/preparing-time.model");
|
|
|
21
21
|
let ServiceAddon = class ServiceAddon {
|
|
22
22
|
name;
|
|
23
23
|
serviceType;
|
|
24
|
-
|
|
24
|
+
subServiceTypes;
|
|
25
25
|
vendor;
|
|
26
26
|
image;
|
|
27
27
|
price;
|
|
@@ -39,9 +39,9 @@ __decorate([
|
|
|
39
39
|
__metadata("design:type", String)
|
|
40
40
|
], ServiceAddon.prototype, "serviceType", void 0);
|
|
41
41
|
__decorate([
|
|
42
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.SubServiceType }),
|
|
43
|
-
__metadata("design:type",
|
|
44
|
-
], ServiceAddon.prototype, "
|
|
42
|
+
(0, typegoose_1.prop)({ type: [String], enum: enum_1.SubServiceType }),
|
|
43
|
+
__metadata("design:type", Array)
|
|
44
|
+
], ServiceAddon.prototype, "subServiceTypes", void 0);
|
|
45
45
|
__decorate([
|
|
46
46
|
(0, typegoose_1.prop)({ required: true, type: () => mongoose_1.default.Types.ObjectId, ref: () => index_1.Vendor }),
|
|
47
47
|
__metadata("design:type", Object)
|
|
@@ -1 +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,
|
|
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;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I,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;4CACvC;uBA1BV,YAAY;IAPxB,IAAA,wBAAY,EAAC;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"]}
|
|
@@ -51,7 +51,7 @@ __decorate([
|
|
|
51
51
|
__metadata("design:type", String)
|
|
52
52
|
], ServiceCategory.prototype, "status", void 0);
|
|
53
53
|
__decorate([
|
|
54
|
-
(0, typegoose_1.prop)({ type: Boolean,
|
|
54
|
+
(0, typegoose_1.prop)({ type: Boolean, default: true }),
|
|
55
55
|
__metadata("design:type", Boolean)
|
|
56
56
|
], ServiceCategory.prototype, "isVisible", void 0);
|
|
57
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,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;CAC7B,CAAA;AAxBY,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,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAW,EAAE,CAAC;;oDACzB;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAc,EAAE,CAAC;;uDACN;AAGhC;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,EAA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op, 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,
|
|
1
|
+
{"version":3,"file":"service-category.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-category.model.ts"],"names":[],"mappings":";;;;;;;;;;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C,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,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"]}
|
|
@@ -37,7 +37,7 @@ __decorate([
|
|
|
37
37
|
__metadata("design:type", String)
|
|
38
38
|
], Service.prototype, "image", void 0);
|
|
39
39
|
exports.Service = Service = __decorate([
|
|
40
|
-
(0, typegoose_1.
|
|
41
|
-
(0, typegoose_1.
|
|
40
|
+
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'services' } }),
|
|
41
|
+
(0, typegoose_1.Index)({ serviceType: 1, subServiceType: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })
|
|
42
42
|
], Service);
|
|
43
43
|
//# sourceMappingURL=service.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"service.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiE;AACjE,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,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IAC3D,IAAA,iBAAK,EAAC,EAAE,WAAW,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;GAChG,OAAO,CAYnB","sourcesContent":["import { Index, modelOptions, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceType, SubServiceType } from '../../../utilities/enum';\n\n@modelOptions({ schemaOptions: { collection: 'services' } })\n@Index({ serviceType: 1, subServiceType: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\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"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED