@lyxa.ai/core 1.3.101 → 1.3.103

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.
@@ -4,4 +4,5 @@ export declare class ServiceControl extends TimeStamps {
4
4
  name: string;
5
5
  serviceItemType: ItemType;
6
6
  isVisibleToUserApp: boolean;
7
+ sortingOrder?: number;
7
8
  }
@@ -13,10 +13,12 @@ exports.ServiceControl = void 0;
13
13
  const enum_1 = require("../../../utilities/enum");
14
14
  const typegoose_1 = require("@typegoose/typegoose");
15
15
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
16
+ const index_1 = require("./index");
16
17
  let ServiceControl = class ServiceControl extends defaultClasses_1.TimeStamps {
17
18
  name;
18
19
  serviceItemType;
19
20
  isVisibleToUserApp;
21
+ sortingOrder;
20
22
  };
21
23
  exports.ServiceControl = ServiceControl;
22
24
  __decorate([
@@ -31,9 +33,37 @@ __decorate([
31
33
  (0, typegoose_1.prop)({ required: true, type: Boolean }),
32
34
  __metadata("design:type", Boolean)
33
35
  ], ServiceControl.prototype, "isVisibleToUserApp", void 0);
36
+ __decorate([
37
+ (0, typegoose_1.prop)({ type: Number }),
38
+ __metadata("design:type", Number)
39
+ ], ServiceControl.prototype, "sortingOrder", void 0);
34
40
  exports.ServiceControl = ServiceControl = __decorate([
35
41
  (0, typegoose_1.Index)({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
36
- (0, typegoose_1.Index)({ serviceItemType: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
37
- (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'service-control' } })
42
+ (0, typegoose_1.Index)({ serviceItemType: 1, sortingOrder: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
43
+ (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'service-control' } }),
44
+ (0, typegoose_1.pre)('save', async function () {
45
+ if (this.sortingOrder !== undefined)
46
+ return;
47
+ const lastItem = await index_1.ServiceControlModel.findOne({
48
+ serviceItemType: this.serviceItemType,
49
+ deletedAt: null,
50
+ })
51
+ .sort({ sortingOrder: -1 })
52
+ .select('sortingOrder')
53
+ .lean();
54
+ this.sortingOrder = (lastItem?.sortingOrder ?? 0) + 1;
55
+ }),
56
+ (0, typegoose_1.pre)('findOneAndUpdate', function () {
57
+ const update = this.getUpdate();
58
+ if (!update)
59
+ return;
60
+ if (!update.$set)
61
+ update.$set = {};
62
+ if ('sortingOrder' in update) {
63
+ update.$set.sortingOrder = update.sortingOrder;
64
+ delete update.sortingOrder;
65
+ }
66
+ this.setUpdate(update);
67
+ })
38
68
  ], ServiceControl);
39
69
  //# sourceMappingURL=service-control.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-control.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-control.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAmD;AACnD,oDAAiE;AACjE,4EAAqE;AAQ9D,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEtC,IAAI,CAAU;IAGd,eAAe,CAAY;IAG3B,kBAAkB,CAAW;CACpC,CAAA;AATY,wCAAc;AAEnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;uDACP;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0DACJ;yBARxB,cAAc;IAN1B,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IAClF,IAAA,iBAAK,EACJ,EAAE,eAAe,EAAE,CAAC,EAAE,EACtB,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAC/D;IACA,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE,CAAC;GACtD,cAAc,CAS1B","sourcesContent":["import { ItemType } from '../../../utilities/enum';\nimport { Index, modelOptions, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\n\n@Index({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index(\n { serviceItemType: 1 },\n { unique: true, partialFilterExpression: { deletedAt: null } }\n)\n@modelOptions({ schemaOptions: { collection: 'service-control' } })\nexport class ServiceControl extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, enum: ItemType })\n\tpublic serviceItemType!: ItemType;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUserApp!: boolean;\n}"]}
1
+ {"version":3,"file":"service-control.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-control.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAmD;AACnD,oDAAsE;AACtE,4EAAqE;AACrE,mCAA8C;AAgDvC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEtC,IAAI,CAAU;IAGd,eAAe,CAAY;IAG3B,kBAAkB,CAAW;IAG7B,YAAY,CAAU;CAC7B,CAAA;AAZY,wCAAc;AAEnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;uDACP;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE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CAAC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;YAC/C,OAAO,MAAM,CAAC,YAAY,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC;GAEW,cAAc,CAY1B","sourcesContent":["import { ItemType } from '../../../utilities/enum';\nimport { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceControlModel } from './index';\nimport { Query } from 'mongoose';\n\n@Index({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index(\n\t{ serviceItemType: 1, sortingOrder: 1 },\n\t{ unique: true, partialFilterExpression: { deletedAt: null } }\n)\n@modelOptions({ schemaOptions: { collection: 'service-control' } })\n/**\n * PRE SAVE\n * Auto assign sortingOrder if missing\n */\n@pre<ServiceControl>('save', async function () {\n\tif (this.sortingOrder !== undefined) return;\n\n\tconst lastItem = await ServiceControlModel.findOne({\n\t\tserviceItemType: this.serviceItemType,\n\t\tdeletedAt: null,\n\t})\n\t\t.sort({ sortingOrder: -1 })\n\t\t.select('sortingOrder')\n\t\t.lean();\n\n\tthis.sortingOrder = (lastItem?.sortingOrder ?? 0) + 1;\n})\n\n/**\n * PRE FINDONEANDUPDATE\n * Prevent clearing sortingOrder accidentally\n */\n@pre<ServiceControl>('findOneAndUpdate', function (this: Query<any, ServiceControl>) {\n\tconst update = this.getUpdate() as any;\n\n\tif (!update) return;\n\n\t// normalize $set\n\tif (!update.$set) update.$set = {};\n\n\t// if sortingOrder is explicitly set → allow it\n\tif ('sortingOrder' in update) {\n\t\tupdate.$set.sortingOrder = update.sortingOrder;\n\t\tdelete update.sortingOrder;\n\t}\n\n\tthis.setUpdate(update);\n})\n\nexport class ServiceControl extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, enum: ItemType })\n\tpublic serviceItemType!: ItemType;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUserApp!: boolean;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}"]}
@@ -1,8 +1,6 @@
1
1
  import { Ref, ReturnModelType } from '@typegoose/typegoose';
2
2
  import { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';
3
3
  import { CoreUser } from './core-user.model';
4
- import { Product } from './product.model';
5
- import { Shop } from './shop.model';
6
4
  import { UserAddress } from './shared/address.model';
7
5
  import { Coupon } from './coupon.model';
8
6
  import { Subscription } from './subscription.model';
@@ -13,8 +11,6 @@ import { Wallet } from './embedded/wallet.model';
13
11
  export declare class User extends TimeStamps {
14
12
  coreUser: Ref<CoreUser>;
15
13
  deviceId?: string;
16
- favoriteProducts?: Ref<Product>[];
17
- favoriteShops?: Ref<Shop>[];
18
14
  addresses?: UserAddress[];
19
15
  location?: GeoLocation;
20
16
  orderCompleted?: number;
@@ -14,8 +14,6 @@ exports.User = void 0;
14
14
  const typegoose_1 = require("@typegoose/typegoose");
15
15
  const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
16
16
  const core_user_model_1 = require("./core-user.model");
17
- const product_model_1 = require("./product.model");
18
- const shop_model_1 = require("./shop.model");
19
17
  const address_model_1 = require("./shared/address.model");
20
18
  const coupon_model_1 = require("./coupon.model");
21
19
  const subscription_model_1 = require("./subscription.model");
@@ -26,8 +24,6 @@ const wallet_model_1 = require("./embedded/wallet.model");
26
24
  let User = User_1 = class User extends defaultClasses_1.TimeStamps {
27
25
  coreUser;
28
26
  deviceId;
29
- favoriteProducts;
30
- favoriteShops;
31
27
  addresses;
32
28
  location;
33
29
  orderCompleted;
@@ -59,14 +55,6 @@ __decorate([
59
55
  (0, typegoose_1.prop)({ type: () => String }),
60
56
  __metadata("design:type", String)
61
57
  ], User.prototype, "deviceId", void 0);
62
- __decorate([
63
- (0, typegoose_1.prop)({ type: () => [String], ref: () => product_model_1.Product }),
64
- __metadata("design:type", Array)
65
- ], User.prototype, "favoriteProducts", void 0);
66
- __decorate([
67
- (0, typegoose_1.prop)({ type: () => [String], ref: () => shop_model_1.Shop }),
68
- __metadata("design:type", Array)
69
- ], User.prototype, "favoriteShops", void 0);
70
58
  __decorate([
71
59
  (0, typegoose_1.prop)({ type: () => [address_model_1.UserAddress], default: [] }),
72
60
  __metadata("design:type", Array)
@@ -1 +1 @@
1
- {"version":3,"file":"user.model.js","sourceRoot":"/","sources":["libraries/mongo/models/user.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,oDAA4F;AAC5F,4EAAqE;AACrE,uDAA6C;AAC7C,mDAA0C;AAC1C,6CAAoC;AACpC,0DAAqD;AACrD,iDAAwC;AACxC,6DAAoD;AACpD,kDAAoE;AACpE,kEAAwD;AACxD,oEAA0D;AAG1D,0DAAiD;AAM1C,IAAM,IAAI,YAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,QAAQ,CAAiB;IAGzB,QAAQ,CAAU;IAGlB,gBAAgB,CAAkB;IAGlC,aAAa,CAAe;IAG5B,SAAS,CAAiB;IAG1B,QAAQ,CAAe;IAGvB,cAAc,CAAU;IAGxB,eAAe,CAAQ;IAGvB,OAAO,CAAiB;IAGxB,yBAAyB,CAAU;IAGnC,kBAAkB,CAAU;IAG5B,iCAAiC,CAAU;IAG3C,qBAAqB,CAAW;IAGhC,YAAY,CAAe;IAG3B,YAAY,CAAqB;IAGjC,YAAY,CAAW;IAGvB,WAAW,CAAU;IAGrB,YAAY,CAAa;IAGzB,eAAe,CAAW;IAO1B,YAAY,CAAgB;IAG5B,SAAS,CAAY;IAGrB,MAAM,CAAU;IAEhB,MAAM,CAAC,KAAK,CAAC,YAAY,CAE/B,MAAc,EACd,IAAI,GAAG,CAAC,EACR,OAAO,GAAG,CAAC;QAEX,OAAO,IAAI,CAAC,iBAAiB,CAC5B,MAAM,EACN,EAAE,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,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,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;IACxD,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC/B,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;GACzB,IAAI,CAmFhB","sourcesContent":["import { index, modelOptions, pre, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { CoreUser } from './core-user.model';\nimport { Product } from './product.model';\nimport { Shop } from './shop.model';\nimport { UserAddress } from './shared/address.model';\nimport { Coupon } from './coupon.model';\nimport { Subscription } from './subscription.model';\nimport { CounterType, OnlineStatus } from '../../../utilities/enum';\nimport { OTPFields } from './embedded/otp-fields.model';\nimport { GeoLocation } from './shared/geo-location.model';\nimport { generateId } from '../../../utilities/id-generator';\nimport { CounterModel } from '.';\nimport { Wallet } from './embedded/wallet.model';\n\n\n@modelOptions({ schemaOptions: { collection: 'users' } })\n@index({ location: '2dsphere' })\n@index({ createdAt: 1, addresses: 1 })\nexport class User extends TimeStamps {\n\t@prop({ required: true, ref: () => CoreUser })\n\tpublic coreUser!: Ref<CoreUser>;\n\n\t@prop({ type: () => String })\n\tpublic deviceId?: string;\n\n\t@prop({ type: () => [String], ref: () => Product })\n\tpublic favoriteProducts?: Ref<Product>[];\n\n\t@prop({ type: () => [String], ref: () => Shop })\n\tpublic favoriteShops?: Ref<Shop>[];\n\n\t@prop({ type: () => [UserAddress], default: [] })\n\tpublic addresses?: UserAddress[];\n\n\t@prop({ type: GeoLocation }) // Last order location for finding user zone\n\tpublic location?: GeoLocation;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic orderCompleted?: number;\n\n\t@prop({ type: Date })\n\tpublic repeatedOrderAt?: Date;\n\n\t@prop({ ref: () => Coupon })\n\tpublic coupons?: Ref<Coupon>[];\n\n\t@prop({ type: String })\n\tpublic newUserCouponDiscountType?: string;\n\n\t@prop({ type: Number })\n\tpublic newUserCouponValue?: number;\n\n\t@prop({ type: Number })\n\tpublic newUserCouponMaximumDiscountLimit?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isNewUserCouponShowed?: boolean;\n\n\t@prop({ ref: () => Coupon })\n\tpublic referralCode?: Ref<Coupon>;\n\n\t@prop({ type: String, ref: () => Subscription })\n\tpublic subscription?: Ref<Subscription>;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isSubscribed?: boolean;\n\n\t@prop({ type: String, unique: true, sparse: true })\n\tpublic phoneNumber?: string;\n\n\t@prop({ type: () => OTPFields })\n\tpublic phoneOtpInfo?: OTPFields;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isPhoneVerified?: boolean;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: OnlineStatus,\n\t\tdefault: OnlineStatus.OFFLINE,\n\t})\n\tpublic onlineStatus?: OnlineStatus;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic fcmTokens?: string[];\n\n\t@prop({ type: Wallet })\n\tpublic wallet?: Wallet;\n\n\tpublic static async updateWallet(\n\t\tthis: ReturnModelType<typeof User>,\n\t\tuserId: string,\n\t\tmain = 0,\n\t\treserve = 0\n\t) {\n\t\treturn this.findByIdAndUpdate(\n\t\t\tuserId,\n\t\t\t{ $inc: { 'wallet.main': main, 'wallet.reserve': reserve, 'wallet.total': main + reserve } },\n\t\t\t{ new: true }\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"user.model.js","sourceRoot":"/","sources":["libraries/mongo/models/user.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,oDAAuF;AACvF,4EAAqE;AACrE,uDAA6C;AAC7C,0DAAqD;AACrD,iDAAwC;AACxC,6DAAoD;AACpD,kDAAuD;AACvD,kEAAwD;AACxD,oEAA0D;AAC1D,0DAAiD;AAK1C,IAAM,IAAI,YAAV,MAAM,IAAK,SAAQ,2BAAU;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ACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,mBAAY;QAClB,OAAO,EAAE,mBAAY,CAAC,OAAO;KAC7B,CAAC;;0CACiC;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;uCAChB;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,qBAAM,EAAE,CAAC;8BACP,qBAAM;oCAAC;eA/DX,IAAI;IAHhB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;IACxD,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC/B,IAAA,iBAAK,EAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;GACzB,IAAI,CA6EhB","sourcesContent":["import { index, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { CoreUser } from './core-user.model';\nimport { UserAddress } from './shared/address.model';\nimport { Coupon } from './coupon.model';\nimport { Subscription } from './subscription.model';\nimport { OnlineStatus } from '../../../utilities/enum';\nimport { OTPFields } from './embedded/otp-fields.model';\nimport { GeoLocation } from './shared/geo-location.model';\nimport { Wallet } from './embedded/wallet.model';\n\n@modelOptions({ schemaOptions: { collection: 'users' } })\n@index({ location: '2dsphere' })\n@index({ createdAt: 1, addresses: 1 })\nexport class User extends TimeStamps {\n\t@prop({ required: true, ref: () => CoreUser })\n\tpublic coreUser!: Ref<CoreUser>;\n\n\t@prop({ type: () => String })\n\tpublic deviceId?: string;\n\n\t@prop({ type: () => [UserAddress], default: [] })\n\tpublic addresses?: UserAddress[];\n\n\t@prop({ type: GeoLocation }) // Last order location for finding user zone\n\tpublic location?: GeoLocation;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic orderCompleted?: number;\n\n\t@prop({ type: Date })\n\tpublic repeatedOrderAt?: Date;\n\n\t@prop({ ref: () => Coupon })\n\tpublic coupons?: Ref<Coupon>[];\n\n\t@prop({ type: String })\n\tpublic newUserCouponDiscountType?: string;\n\n\t@prop({ type: Number })\n\tpublic newUserCouponValue?: number;\n\n\t@prop({ type: Number })\n\tpublic newUserCouponMaximumDiscountLimit?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isNewUserCouponShowed?: boolean;\n\n\t@prop({ ref: () => Coupon })\n\tpublic referralCode?: Ref<Coupon>;\n\n\t@prop({ type: String, ref: () => Subscription })\n\tpublic subscription?: Ref<Subscription>;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isSubscribed?: boolean;\n\n\t@prop({ type: String, unique: true, sparse: true })\n\tpublic phoneNumber?: string;\n\n\t@prop({ type: () => OTPFields })\n\tpublic phoneOtpInfo?: OTPFields;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isPhoneVerified?: boolean;\n\n\t@prop({\n\t\ttype: String,\n\t\tenum: OnlineStatus,\n\t\tdefault: OnlineStatus.OFFLINE,\n\t})\n\tpublic onlineStatus?: OnlineStatus;\n\n\t@prop({ type: () => [String], default: [] })\n\tpublic fcmTokens?: string[];\n\n\t@prop({ type: Wallet })\n\tpublic wallet?: Wallet;\n\n\tpublic static async updateWallet(\n\t\tthis: ReturnModelType<typeof User>,\n\t\tuserId: string,\n\t\tmain = 0,\n\t\treserve = 0\n\t) {\n\t\treturn this.findByIdAndUpdate(\n\t\t\tuserId,\n\t\t\t{ $inc: { 'wallet.main': main, 'wallet.reserve': reserve, 'wallet.total': main + reserve } },\n\t\t\t{ new: true }\n\t\t);\n\t}\n}\n"]}
@@ -93,8 +93,8 @@ export declare const OrderActionsOutputSchema: z.ZodObject<{
93
93
  _id: import("mongoose").Types.ObjectId;
94
94
  createdAt: Date;
95
95
  orderId: string;
96
- shopId: import("mongoose").Types.ObjectId;
97
96
  paymentMethod: PaymentMethod;
97
+ shopId: import("mongoose").Types.ObjectId;
98
98
  triggerAt: Date;
99
99
  adjustedFinance: {
100
100
  paymentMethod: PaymentMethod;
@@ -121,8 +121,8 @@ export declare const OrderActionsOutputSchema: z.ZodObject<{
121
121
  _id: string | import("mongoose").Types.ObjectId;
122
122
  createdAt: Date;
123
123
  orderId: string;
124
- shopId: string | import("mongoose").Types.ObjectId;
125
124
  paymentMethod: PaymentMethod;
125
+ shopId: string | import("mongoose").Types.ObjectId;
126
126
  triggerAt: Date;
127
127
  adjustedFinance: {
128
128
  paymentMethod: PaymentMethod;
@@ -246,8 +246,8 @@ export declare class OrderActionsSocketEvent extends BaseSocketEvent<typeof Orde
246
246
  _id: import("mongoose").Types.ObjectId;
247
247
  createdAt: Date;
248
248
  orderId: string;
249
- shopId: import("mongoose").Types.ObjectId;
250
249
  paymentMethod: PaymentMethod;
250
+ shopId: import("mongoose").Types.ObjectId;
251
251
  triggerAt: Date;
252
252
  adjustedFinance: {
253
253
  paymentMethod: PaymentMethod;
@@ -274,8 +274,8 @@ export declare class OrderActionsSocketEvent extends BaseSocketEvent<typeof Orde
274
274
  _id: string | import("mongoose").Types.ObjectId;
275
275
  createdAt: Date;
276
276
  orderId: string;
277
- shopId: string | import("mongoose").Types.ObjectId;
278
277
  paymentMethod: PaymentMethod;
278
+ shopId: string | import("mongoose").Types.ObjectId;
279
279
  triggerAt: Date;
280
280
  adjustedFinance: {
281
281
  paymentMethod: PaymentMethod;
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.3.101
25
+ Version: 1.3.103
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.3.101",
3
+ "version": "1.3.103",
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.3.101",
3
+ "version": "1.3.103",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",