@lyxa.ai/core 1.0.29 → 1.0.30
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/providers/core-email-auth-identity.model.d.ts +1 -1
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.js +1 -1
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.js.map +1 -1
- package/dist/libraries/mongo/models/user.model.d.ts +3 -1
- package/dist/libraries/mongo/models/user.model.js +11 -5
- package/dist/libraries/mongo/models/user.model.js.map +1 -1
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ __decorate([
|
|
|
36
36
|
__metadata("design:type", String)
|
|
37
37
|
], CoreEmailAuthIdentity.prototype, "password", void 0);
|
|
38
38
|
__decorate([
|
|
39
|
-
(0, typegoose_1.prop)({
|
|
39
|
+
(0, typegoose_1.prop)({ type: otp_fields_model_1.OTPFields }),
|
|
40
40
|
__metadata("design:type", Array)
|
|
41
41
|
], CoreEmailAuthIdentity.prototype, "otps", void 0);
|
|
42
42
|
exports.CoreEmailAuthIdentity = CoreEmailAuthIdentity = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-email-auth-identity.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/core-email-auth-identity.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAoE;AACpE,0EAA+D;AAC/D,mEAAyD;AACzD,wDAA8B;AAG9B,KAAK,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,IAAI,GAAG,MAAM,kBAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACtC,OAAO,kBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC;AAeM,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,2CAAgB;IAEnD,KAAK,CAAU;IAGf,QAAQ,CAAU;IAGlB,IAAI,CAAe;CAC1B,CAAA;AATY,sDAAqB;AAE1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDACd;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"core-email-auth-identity.model.js","sourceRoot":"/","sources":["libraries/mongo/models/providers/core-email-auth-identity.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAoE;AACpE,0EAA+D;AAC/D,mEAAyD;AACzD,wDAA8B;AAG9B,KAAK,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,IAAI,GAAG,MAAM,kBAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACtC,OAAO,kBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC;AAeM,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,2CAAgB;IAEnD,KAAK,CAAU;IAGf,QAAQ,CAAU;IAGlB,IAAI,CAAe;CAC1B,CAAA;AATY,sDAAqB;AAE1B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDACd;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,4BAAS,EAAE,CAAC;;mDACA;gCARd,qBAAqB;IAdjC,IAAA,eAAG,EAAwB,MAAM,EAAE,KAAK,WAAW,IAAI;QACvD,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;IACD,IAAA,eAAG,EAAoC,kBAAkB,EAAE,KAAK,WAAW,IAAI;QAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAyB,CAAC;QACvD,IAAI,MAAM,EAAE,QAAQ,EAAE,CAAC;YACtB,MAAM,CAAC,QAAQ,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACtD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,qBAAqB,CASjC","sourcesContent":["import { modelOptions, prop, pre, Ref } from '@typegoose/typegoose';\r\nimport { CoreAuthIdentity } from '../core-auth-identity.model';\r\nimport { OTPFields } from '../embedded/otp-fields.model';\r\nimport bcrypt from 'bcryptjs';\r\nimport { Query } from 'mongoose';\r\n\r\nasync function hashPassword(password: string): Promise<string> {\r\n\tconst salt = await bcrypt.genSalt(10);\r\n\treturn bcrypt.hash(password, salt);\r\n}\r\n@pre<CoreEmailAuthIdentity>('save', async function (next) {\r\n\tif (this.isModified('password')) {\r\n\t\tthis.password = await hashPassword(this.password);\r\n\t}\r\n\tnext();\r\n})\r\n@pre<Query<any, CoreEmailAuthIdentity>>('findOneAndUpdate', async function (next) {\r\n\tconst update = this.getUpdate() as Record<string, any>;\r\n\tif (update?.password) {\r\n\t\tupdate.password = await hashPassword(update.password);\r\n\t\tthis.setUpdate(update);\r\n\t}\r\n\tnext();\r\n})\r\nexport class CoreEmailAuthIdentity extends CoreAuthIdentity {\r\n\t@prop({ required: true, type: String })\r\n\tpublic email!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic password!: string;\r\n\r\n\t@prop({ type: OTPFields })\r\n\tpublic otps?: OTPFields[];\r\n}\r\n"]}
|
|
@@ -7,9 +7,9 @@ import { UserAddress } from './shared/address.model';
|
|
|
7
7
|
import { Coupon } from './coupon.model';
|
|
8
8
|
import { Subscription } from './subscription.model';
|
|
9
9
|
import { Status } from '../../../utilities/enum';
|
|
10
|
+
import { OTPFields } from './embedded/otp-fields.model';
|
|
10
11
|
export declare class User extends TimeStamps {
|
|
11
12
|
coreUser: Ref<CoreUser>;
|
|
12
|
-
companyName?: string;
|
|
13
13
|
favoriteProducts?: Ref<Product>[];
|
|
14
14
|
favoriteShops?: Ref<Shop>[];
|
|
15
15
|
addresses?: UserAddress[];
|
|
@@ -27,4 +27,6 @@ export declare class User extends TimeStamps {
|
|
|
27
27
|
referralCode?: Ref<Coupon>;
|
|
28
28
|
subscription?: Ref<Subscription>;
|
|
29
29
|
isSubscribed?: boolean;
|
|
30
|
+
phoneNumber?: string;
|
|
31
|
+
phoneOtpInfo?: OTPFields;
|
|
30
32
|
}
|
|
@@ -19,9 +19,9 @@ const address_model_1 = require("./shared/address.model");
|
|
|
19
19
|
const coupon_model_1 = require("./coupon.model");
|
|
20
20
|
const subscription_model_1 = require("./subscription.model");
|
|
21
21
|
const enum_1 = require("../../../utilities/enum");
|
|
22
|
+
const otp_fields_model_1 = require("./embedded/otp-fields.model");
|
|
22
23
|
let User = class User extends defaultClasses_1.TimeStamps {
|
|
23
24
|
coreUser;
|
|
24
|
-
companyName;
|
|
25
25
|
favoriteProducts;
|
|
26
26
|
favoriteShops;
|
|
27
27
|
addresses;
|
|
@@ -39,16 +39,14 @@ let User = class User extends defaultClasses_1.TimeStamps {
|
|
|
39
39
|
referralCode;
|
|
40
40
|
subscription;
|
|
41
41
|
isSubscribed;
|
|
42
|
+
phoneNumber;
|
|
43
|
+
phoneOtpInfo;
|
|
42
44
|
};
|
|
43
45
|
exports.User = User;
|
|
44
46
|
__decorate([
|
|
45
47
|
(0, typegoose_1.prop)({ required: true, type: typegoose_1.mongoose.Types.ObjectId, ref: () => core_user_model_1.CoreUser }),
|
|
46
48
|
__metadata("design:type", Object)
|
|
47
49
|
], User.prototype, "coreUser", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, typegoose_1.prop)({ type: String }),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], User.prototype, "companyName", void 0);
|
|
52
50
|
__decorate([
|
|
53
51
|
(0, typegoose_1.prop)({ type: () => [String], ref: () => product_model_1.Product }),
|
|
54
52
|
__metadata("design:type", Array)
|
|
@@ -122,6 +120,14 @@ __decorate([
|
|
|
122
120
|
(0, typegoose_1.prop)({ type: Boolean, default: false }),
|
|
123
121
|
__metadata("design:type", Boolean)
|
|
124
122
|
], User.prototype, "isSubscribed", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
(0, typegoose_1.prop)({ type: String, unique: true }),
|
|
125
|
+
__metadata("design:type", String)
|
|
126
|
+
], User.prototype, "phoneNumber", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, typegoose_1.prop)({ type: otp_fields_model_1.OTPFields }),
|
|
129
|
+
__metadata("design:type", otp_fields_model_1.OTPFields)
|
|
130
|
+
], User.prototype, "phoneOtpInfo", void 0);
|
|
125
131
|
exports.User = User = __decorate([
|
|
126
132
|
(0, typegoose_1.index)({ location: '2dsphere' }),
|
|
127
133
|
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'users' } })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.model.js","sourceRoot":"/","sources":["libraries/mongo/models/user.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,uDAA6C;AAC7C,mDAA0C;AAC1C,6CAAoC;AACpC,0DAAqD;AACrD,iDAAwC;AACxC,6DAAoD;AACpD,kDAAiD;
|
|
1
|
+
{"version":3,"file":"user.model.js","sourceRoot":"/","sources":["libraries/mongo/models/user.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAgF;AAChF,4EAAqE;AACrE,uDAA6C;AAC7C,mDAA0C;AAC1C,6CAAoC;AACpC,0DAAqD;AACrD,iDAAwC;AACx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EAAE,CAAC;;0CACR;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iCAAY,EAAE,CAAC;;0CACR;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;0CACV;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;yCACT;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,4BAAS,EAAE,CAAC;8BACJ,4BAAS;0CAAC;eAhEpB,IAAI;IAFhB,IAAA,iBAAK,EAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC/B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;GAC5C,IAAI,CAiEhB","sourcesContent":["import { index, modelOptions, mongoose, prop, Ref } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { CoreUser } from './core-user.model';\r\nimport { Product } from './product.model';\r\nimport { Shop } from './shop.model';\r\nimport { UserAddress } from './shared/address.model';\r\nimport { Coupon } from './coupon.model';\r\nimport { Subscription } from './subscription.model';\r\nimport { Status } from '../../../utilities/enum';\r\nimport { OTPFields } from './embedded/otp-fields.model';\r\n\r\n@index({ location: '2dsphere' })\r\n@modelOptions({ schemaOptions: { collection: 'users' } })\r\nexport class User extends TimeStamps {\r\n\t@prop({ required: true, type: mongoose.Types.ObjectId, ref: () => CoreUser })\r\n\tpublic coreUser!: Ref<CoreUser>;\r\n\r\n\t@prop({ type: () => [String], ref: () => Product })\r\n\tpublic favoriteProducts?: Ref<Product>[];\r\n\r\n\t@prop({ type: () => [String], ref: () => Shop })\r\n\tpublic favoriteShops?: Ref<Shop>[];\r\n\r\n\t@prop({ type: () => [UserAddress] })\r\n\tpublic addresses?: UserAddress[];\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n\r\n\t@prop({ type: String })\r\n\tpublic socialId?: string;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic tempBalance?: number;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic orderCompleted?: number;\r\n\r\n\t@prop({ type: Date })\r\n\tpublic repeatedOrderAt?: Date;\r\n\r\n\t@prop({\r\n\t\ttype: Number,\r\n\t\tdefault: 0,\r\n\t\tset: (points: number) => Math.max(points, 0),\r\n\t\tget: (points: number) => Math.max(points, 0),\r\n\t})\r\n\tpublic tempRewardPoints?: number;\r\n\r\n\t@prop({ type: () => [String], ref: () => Coupon })\r\n\tpublic coupons?: Ref<Coupon>[];\r\n\r\n\t@prop({ type: String })\r\n\tpublic newUserCouponDiscountType?: string;\r\n\r\n\t@prop({ type: Number })\r\n\tpublic newUserCouponValue?: number;\r\n\r\n\t@prop({ type: Number })\r\n\tpublic newUserCouponMaximumDiscountLimit?: number;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isNewUserCouponShowed?: boolean;\r\n\r\n\t@prop({ type: String, ref: () => Coupon })\r\n\tpublic referralCode?: Ref<Coupon>;\r\n\r\n\t@prop({ type: String, ref: () => Subscription })\r\n\tpublic subscription?: Ref<Subscription>;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isSubscribed?: boolean;\r\n\r\n\t@prop({ type: String, unique: true })\r\n\tpublic phoneNumber?: string;\r\n\r\n\t@prop({ type: OTPFields })\r\n\tpublic phoneOtpInfo?: OTPFields;\r\n}\r\n"]}
|