@lyxa.ai/core 1.0.281 → 1.0.282
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.
|
@@ -2,7 +2,7 @@ import { Ref } from '@typegoose/typegoose';
|
|
|
2
2
|
import { Shop } from './shop.model';
|
|
3
3
|
import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
|
|
4
4
|
import { CartStatus, PaymentPreference } from '../../../utilities/enum';
|
|
5
|
-
import {
|
|
5
|
+
import { RegularOrderAddress } from './shared/address.model';
|
|
6
6
|
import { Coupon } from './coupon.model';
|
|
7
7
|
import { User } from './user.model';
|
|
8
8
|
import { LineItem } from './line-item.model';
|
|
@@ -11,7 +11,7 @@ export declare class Cart extends TimeStamps {
|
|
|
11
11
|
slug?: string;
|
|
12
12
|
user: Ref<User>;
|
|
13
13
|
shop: Ref<Shop>;
|
|
14
|
-
deliveryAddress?:
|
|
14
|
+
deliveryAddress?: RegularOrderAddress;
|
|
15
15
|
isGroupOrder?: boolean;
|
|
16
16
|
paymentPreference?: PaymentPreference;
|
|
17
17
|
spendingLimitForGuest?: number;
|
|
@@ -55,8 +55,8 @@ __decorate([
|
|
|
55
55
|
__metadata("design:type", Object)
|
|
56
56
|
], Cart.prototype, "shop", void 0);
|
|
57
57
|
__decorate([
|
|
58
|
-
(0, typegoose_1.prop)({ required: false, type: address_model_1.
|
|
59
|
-
__metadata("design:type", address_model_1.
|
|
58
|
+
(0, typegoose_1.prop)({ required: false, type: address_model_1.RegularOrderAddress }),
|
|
59
|
+
__metadata("design:type", address_model_1.RegularOrderAddress)
|
|
60
60
|
], Cart.prototype, "deliveryAddress", void 0);
|
|
61
61
|
__decorate([
|
|
62
62
|
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oD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AAC,EAAE,CAAC;IACpB,IAAA,iBAAK,EACL,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EACpB;QACC,MAAM,EAAE,IAAI;QACZ,uBAAuB,EAAE;YACxB,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,iBAAU,CAAC,MAAM,EAAE,iBAAU,CAAC,MAAM,CAAC,EAAE;YACvD,SAAS,EAAE,IAAI;SACf;KACD,CACD;IACA,IAAA,eAAG,EAAO,MAAM,EAAE,KAAK,WAAW,IAAI;QACtC,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,IAAA,iBAAO,EAAC,IAAI,CAAC,KAAK,EAAE;gBACpC,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;aACV,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,IAAI,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;QACvC,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,IAAI,CA8ChB","sourcesContent":["import { prop, Ref, index, modelOptions, Severity, pre } from '@typegoose/typegoose';\nimport { Shop } from './shop.model';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { CartStatus, PaymentPreference } from '../../../utilities/enum';\nimport { RegularOrderAddress, UserAddress } from './shared/address.model';\nimport slugify from 'slugify';\nimport { randomBytes } from 'crypto';\n\nimport { Coupon } from './coupon.model';\nimport { User } from './user.model';\nimport { LineItem } from './line-item.model';\n\n/**\n * Cart configuration model using Typegoose with automatic slug generation\n */\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'carts',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@index({ slug: 1 }, { unique: true, sparse: true })\n@index({ user: 1 })\n@index({ shop: 1 })\n@index({ status: 1 })\n@index(\n\t{ user: 1, shop: 1 },\n\t{\n\t\tunique: true,\n\t\tpartialFilterExpression: {\n\t\t\tstatus: { $in: [CartStatus.ACTIVE, CartStatus.LOCKED] },\n\t\t\tdeletedAt: null,\n\t\t},\n\t}\n)\n@pre<Cart>('save', async function (next) {\n\tif (this.title && !this.slug) {\n\t\tconst baseSlug = slugify(this.title, {\n\t\t\tlower: true,\n\t\t\tstrict: true,\n\t\t\ttrim: true,\n\t\t});\n\n\t\tconst uniqueId = randomBytes(8).toString('hex');\n\t\tthis.slug = `${baseSlug}-${uniqueId}`;\n\t}\n\tnext();\n})\nexport class Cart extends TimeStamps {\n\t@prop({ trim: true, maxlength: 100 })\n\tpublic title?: string;\n\n\t@prop()\n\tpublic slug?: string;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: false, type: RegularOrderAddress })\n\tpublic deliveryAddress?: RegularOrderAddress;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isGroupOrder?: boolean;\n\n\n\t@prop({ type: String, enum: PaymentPreference })\n\tpublic paymentPreference?: PaymentPreference;\n\n\t@prop({ type: Number, default: Infinity })\n\tpublic spendingLimitForGuest?: number;\n\n\t@prop({ type: Number, default: Infinity })\n\tpublic secondarySpendingLimitForGuest?: number;\n\n\t@prop({\n\t\tenum: CartStatus,\n\t\ttype: String,\n\t\tdefault: CartStatus.ACTIVE,\n\t\trequired: true,\n\t})\n\tpublic status!: CartStatus;\n\n\t@prop({ ref: () => Coupon })\n\tpublic coupon?: Ref<Coupon>;\n\n\t@prop({\n\t\tref: () => LineItem,\n\t\tforeignField: 'cart',\n\t\tlocalField: '_id',\n\t})\n\tpublic lineItems: Ref<LineItem>[];\n}\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED