@lyxa.ai/core 1.2.78 → 1.2.79
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/addon.model.d.ts +2 -0
- package/dist/libraries/mongo/models/addon.model.js +6 -0
- package/dist/libraries/mongo/models/addon.model.js.map +1 -1
- package/dist/libraries/mongo/models/service-line-item.model.d.ts +3 -1
- package/dist/libraries/mongo/models/service-line-item.model.js +7 -1
- package/dist/libraries/mongo/models/service-line-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/service-package.model.d.ts +1 -1
- package/dist/libraries/mongo/models/service-package.model.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Ref } from "@typegoose/typegoose";
|
|
2
2
|
import { Service, Vendor } from "./index";
|
|
3
|
+
import { Status } from "../../../utilities/enum";
|
|
3
4
|
export declare class AddOn {
|
|
4
5
|
name: string;
|
|
5
6
|
service: Ref<Service>[];
|
|
@@ -9,4 +10,5 @@ export declare class AddOn {
|
|
|
9
10
|
hours: number;
|
|
10
11
|
minutes: number;
|
|
11
12
|
description?: string;
|
|
13
|
+
status: Status;
|
|
12
14
|
}
|
|
@@ -16,6 +16,7 @@ exports.AddOn = void 0;
|
|
|
16
16
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
17
17
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
18
18
|
const index_1 = require("./index");
|
|
19
|
+
const enum_1 = require("../../../utilities/enum");
|
|
19
20
|
let AddOn = class AddOn {
|
|
20
21
|
name;
|
|
21
22
|
service;
|
|
@@ -25,6 +26,7 @@ let AddOn = class AddOn {
|
|
|
25
26
|
hours;
|
|
26
27
|
minutes;
|
|
27
28
|
description;
|
|
29
|
+
status;
|
|
28
30
|
};
|
|
29
31
|
exports.AddOn = AddOn;
|
|
30
32
|
__decorate([
|
|
@@ -87,6 +89,10 @@ __decorate([
|
|
|
87
89
|
}),
|
|
88
90
|
__metadata("design:type", String)
|
|
89
91
|
], AddOn.prototype, "description", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.Status, default: enum_1.Status.ACTIVE }),
|
|
94
|
+
__metadata("design:type", String)
|
|
95
|
+
], AddOn.prototype, "status", void 0);
|
|
90
96
|
exports.AddOn = AddOn = __decorate([
|
|
91
97
|
(0, typegoose_1.modelOptions)({
|
|
92
98
|
schemaOptions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/addon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAK8B;AAC9B,wDAAgC;AAChC,mCAA0C;
|
|
1
|
+
{"version":3,"file":"addon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/addon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAK8B;AAC9B,wDAAgC;AAChC,mCAA0C;AAC1C,kDAAiD;AAU1C,IAAM,KAAK,GAAX,MAAM,KAAK;IAEP,IAAI,CAAU;IAOd,OAAO,CAAkB;IAOzB,MAAM,CAAe;IAOrB,KAAK,CAAU;IAOf,KAAK,CAAU;IAOf,KAAK,CAAU;IAQf,OAAO,CAAU;IAMjB,WAAW,CAAU;IAGrB,MAAM,CAAS;CAEzB,CAAA;AAxDY,sBAAK;AAEP;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;mCAChB;AAOd;IALN,IAAA,gBAAI,EAAC;QACF,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,kBAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QACrC,GAAG,EAAE,GAAG,EAAE,CAAC,eAAO;KACrB,CAAC;;sCAC8B;AAOzB;IALN,IAAA,gBAAI,EAAC;QACF,QAA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\";\nimport { Service, Vendor } from \"./index\";\nimport { Status } from \"../../../utilities/enum\";\n\n\n@modelOptions({\n schemaOptions: {\n collection: \"addons\",\n timestamps: true,\n },\n})\n@index({ name: 1, service: 1 }, { unique: false })\nexport class AddOn {\n @prop({ required: true, trim: true })\n public name!: string;\n\n @prop({\n required: true,\n type: () => [mongoose.Types.ObjectId],\n ref: () => Service,\n })\n public service!: Ref<Service>[];\n\n @prop({\n required: true,\n type: () => mongoose.Types.ObjectId,\n ref: () => Vendor,\n })\n public vendor!: Ref<Vendor>;\n\n @prop({\n required: true,\n type: String,\n trim: true,\n })\n public image!: string; // store URL or path\n\n @prop({\n required: true,\n type: Number,\n min: 0,\n })\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({\n maxlength: 250,\n trim: true,\n })\n public description?: string;\n \n @prop({ type: String, enum: Status, default: Status.ACTIVE })\n public status: Status;\n \n}\n"]}
|
|
@@ -4,11 +4,13 @@ import { ServiceCart } from './service-cart.model';
|
|
|
4
4
|
import { User } from './user.model';
|
|
5
5
|
import { Vendor } from './vendor.model';
|
|
6
6
|
import { ServicePackage } from './service-package.model';
|
|
7
|
+
import { AddOn } from './addon.model';
|
|
7
8
|
export declare class ServiceLineItem extends TimeStamps {
|
|
8
9
|
cart: Ref<ServiceCart>;
|
|
9
10
|
user: Ref<User>;
|
|
10
11
|
vendor: Ref<Vendor>;
|
|
11
|
-
servicePackage
|
|
12
|
+
servicePackage?: Ref<ServicePackage>;
|
|
13
|
+
addOn?: Ref<AddOn>;
|
|
12
14
|
quantity?: number;
|
|
13
15
|
isAddon: boolean;
|
|
14
16
|
calculationSnap?: Record<string, unknown>;
|
|
@@ -20,11 +20,13 @@ const user_model_1 = require("./user.model");
|
|
|
20
20
|
const vendor_model_1 = require("./vendor.model");
|
|
21
21
|
const service_package_model_1 = require("./service-package.model");
|
|
22
22
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
23
|
+
const addon_model_1 = require("./addon.model");
|
|
23
24
|
let ServiceLineItem = class ServiceLineItem extends defaultClasses_1.TimeStamps {
|
|
24
25
|
cart;
|
|
25
26
|
user;
|
|
26
27
|
vendor;
|
|
27
28
|
servicePackage;
|
|
29
|
+
addOn;
|
|
28
30
|
quantity;
|
|
29
31
|
isAddon;
|
|
30
32
|
calculationSnap;
|
|
@@ -43,9 +45,13 @@ __decorate([
|
|
|
43
45
|
__metadata("design:type", Object)
|
|
44
46
|
], ServiceLineItem.prototype, "vendor", void 0);
|
|
45
47
|
__decorate([
|
|
46
|
-
(0, typegoose_1.prop)({
|
|
48
|
+
(0, typegoose_1.prop)({ ref: () => service_package_model_1.ServicePackage }),
|
|
47
49
|
__metadata("design:type", Object)
|
|
48
50
|
], ServiceLineItem.prototype, "servicePackage", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typegoose_1.prop)({ ref: () => addon_model_1.AddOn }),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], ServiceLineItem.prototype, "addOn", void 0);
|
|
49
55
|
__decorate([
|
|
50
56
|
(0, typegoose_1.prop)({ min: 1, default: 1 }),
|
|
51
57
|
__metadata("design:type", Number)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,6DAAmD;AACnD,6CAAoC;AACpC,iDAAwC;AACxC,mEAAyD;AACzD,wDAAgC;
|
|
1
|
+
{"version":3,"file":"service-line-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-line-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,6DAAmD;AACnD,6CAAoC;AACpC,iDAAwC;AACxC,mEAAyD;AACzD,wDAAgC;A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AAE,IAAI,EAAE;YAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC5B;QACD,OAAO,EAAE;YACR,UAAU,EAAE,oBAAQ,CAAC,KAAK;SAC1B;KACD,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAClB,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC3B,IAAA,iBAAK,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACrB,IAAA,iBAAK,EAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;GACR,eAAe,CAwB3B","sourcesContent":["import { Index, modelOptions, prop, Ref, Severity } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceCart } from './service-cart.model';\nimport { User } from './user.model';\nimport { Vendor } from './vendor.model';\nimport { ServicePackage } from './service-package.model';\nimport mongoose from 'mongoose';\nimport { AddOn } from './addon.model';\n\n/**\n * ServiceLineItem model - Represents individual items in a cart\n */\n\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'serviceLineItems',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@Index({ cart: 1 })\n@Index({ cart: 1, user: 1 })\n@Index({ package: 1 })\n@Index({ vendor: 1 })\nexport class ServiceLineItem extends TimeStamps {\n\t@prop({ require: true, ref: () => ServiceCart })\n\tpublic cart!: Ref<ServiceCart>;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Vendor })\n\tpublic vendor!: Ref<Vendor>;\n\n\t@prop({ ref: () => ServicePackage })\n\tpublic servicePackage?: Ref<ServicePackage>;\n\n\t@prop({ref:()=> AddOn})\n\tpublic addOn?: Ref<AddOn>;\n\n\t@prop({ min: 1, default: 1 })\n\tpublic quantity?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isAddon: boolean;\n\n\t@prop({ type: mongoose.Schema.Types.Mixed })\n\tpublic calculationSnap?: Record<string, unknown>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-package.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-package.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAiD;AACjD,iDAAwC;AACxC,qEAA2D;AAC3D,mDAA0C;AAC1C,mCAAqD;AA8B9C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEnC,IAAI,CAAU;IAGd,MAAM,CAAe;IAGrB,OAAO,CAAc;IAGrB,QAAQ,CAAwB;IAGhC,KAAK,CAAU;IAOf,KAAK,CAAU;IAQf,OAAO,CAAU;IAGjB,qBAAqB,CAAU;IAG/B,WAAW,CAAU;IAGrB,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,MAAM,CAAgB;IAGtB,MAAM,
|
|
1
|
+
{"version":3,"file":"service-package.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-package.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAiD;AACjD,iDAAwC;AACxC,qEAA2D;AAC3D,mDAA0C;AAC1C,mCAAqD;AA8B9C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEnC,IAAI,CAAU;IAGd,MAAM,CAAe;IAGrB,OAAO,CAAc;IAGrB,QAAQ,CAAwB;IAGhC,KAAK,CAAU;IAOf,KAAK,CAAU;IAQf,OAAO,CAAU;IAGjB,qBAAqB,CAAU;IAG/B,WAAW,CAAU;IAGrB,KAAK,CAAU;IAGf,WAAW,CAAU;IAGrB,MAAM,CAAgB;IAGtB,MAAM,CAAS;IAGf,gBAAgB,CAAW;IAG3B,aAAa,CAAU;IAG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ACJ,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,CAyD1B","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\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED