@lyxa.ai/core 1.0.336-alpha.4 → 1.0.336
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.
|
@@ -3,7 +3,6 @@ import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
|
3
3
|
import { ItemType, Status } from '../../../utilities/enum';
|
|
4
4
|
export declare class Category extends TimeStamps {
|
|
5
5
|
name: string;
|
|
6
|
-
nameNormalized?: string;
|
|
7
6
|
image?: string;
|
|
8
7
|
itemType: ItemType;
|
|
9
8
|
parentCategory?: Ref<Category>;
|
|
@@ -15,7 +15,6 @@ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
|
|
|
15
15
|
const enum_1 = require("../../../utilities/enum");
|
|
16
16
|
let Category = class Category extends defaultClasses_1.TimeStamps {
|
|
17
17
|
name;
|
|
18
|
-
nameNormalized;
|
|
19
18
|
image;
|
|
20
19
|
itemType;
|
|
21
20
|
parentCategory;
|
|
@@ -27,10 +26,6 @@ __decorate([
|
|
|
27
26
|
(0, typegoose_1.prop)({ required: true, type: String, trim: true, maxlength: 30 }),
|
|
28
27
|
__metadata("design:type", String)
|
|
29
28
|
], Category.prototype, "name", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, typegoose_1.prop)({ type: String, trim: true, lowercase: true, select: false }),
|
|
32
|
-
__metadata("design:type", String)
|
|
33
|
-
], Category.prototype, "nameNormalized", void 0);
|
|
34
29
|
__decorate([
|
|
35
30
|
(0, typegoose_1.prop)({ type: String }),
|
|
36
31
|
__metadata("design:type", String)
|
|
@@ -53,32 +48,6 @@ __decorate([
|
|
|
53
48
|
], Category.prototype, "note", void 0);
|
|
54
49
|
exports.Category = Category = __decorate([
|
|
55
50
|
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'categories' } }),
|
|
56
|
-
(0, typegoose_1.
|
|
57
|
-
unique: true,
|
|
58
|
-
partialFilterExpression: {
|
|
59
|
-
itemType: { $in: [enum_1.ItemType.GROCERY, enum_1.ItemType.PHARMACY] },
|
|
60
|
-
parentCategory: null,
|
|
61
|
-
deletedAt: null,
|
|
62
|
-
},
|
|
63
|
-
}),
|
|
64
|
-
(0, typegoose_1.pre)('save', function (next) {
|
|
65
|
-
if (this.name) {
|
|
66
|
-
this.nameNormalized = this.name.toLowerCase();
|
|
67
|
-
}
|
|
68
|
-
next();
|
|
69
|
-
}),
|
|
70
|
-
(0, typegoose_1.pre)('findOneAndUpdate', function (next) {
|
|
71
|
-
const update = this.getUpdate();
|
|
72
|
-
if (update?.name) {
|
|
73
|
-
update.nameNormalized = update.name.toLowerCase();
|
|
74
|
-
}
|
|
75
|
-
if (update?.$set?.name) {
|
|
76
|
-
update.$set.nameNormalized = update.$set.name.toLowerCase();
|
|
77
|
-
}
|
|
78
|
-
if (update?.$setOnInsert?.name) {
|
|
79
|
-
update.$setOnInsert.nameNormalized = update.$setOnInsert.name.toLowerCase();
|
|
80
|
-
}
|
|
81
|
-
next();
|
|
82
|
-
})
|
|
51
|
+
(0, typegoose_1.Index)({ name: 1, itemType: 1 }, { unique: true, partialFilterExpression: { parentCategory: null, deletedAt: null } })
|
|
83
52
|
], Category);
|
|
84
53
|
//# sourceMappingURL=category.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category.model.js","sourceRoot":"/","sources":["libraries/mongo/models/category.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"category.model.js","sourceRoot":"/","sources":["libraries/mongo/models/category.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAA2D;AAOpD,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,2BAAU;IAEhC,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,QAAQ,CAAY;IAGpB,cAAc,CAAiB;IAG/B,MAAM,CAAU;IAGhB,IAAI,CAAU;CACrB,CAAA;AAlBY,4BAAQ;AAEb;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;sCAC7C;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uCACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;0CAC5B;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;;gDACQ;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;wCACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;sCAClB;mBAjBT,QAAQ;IALpB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,CAAC;IAC7D,IAAA,iBAAK,EACL,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EACxB,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CACpF;GACY,QAAQ,CAkBpB","sourcesContent":["import { Index, modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ItemType, Status } from '../../../utilities/enum';\n\n@modelOptions({ schemaOptions: { collection: 'categories' } })\n@Index(\n\t{ name: 1, itemType: 1 },\n\t{ unique: true, partialFilterExpression: { parentCategory: null, deletedAt: null } }\n)\nexport class Category extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 30 })\n\tpublic name!: string;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ ref: () => Category })\n\tpublic parentCategory?: Ref<Category>;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic note?: string;\n}\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lyxa.ai/types",
|
|
3
|
-
"version": "1.0.336
|
|
3
|
+
"version": "1.0.336",
|
|
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",
|