- Tweaks
This commit is contained in:
@@ -66,8 +66,8 @@ const UserSchema = new mongoose.Schema(
|
||||
trim: true,
|
||||
},
|
||||
|
||||
address: [ AddressSchema ],
|
||||
phone: [ PhoneSchema ],
|
||||
addresses: [ AddressSchema ],
|
||||
phones: [ PhoneSchema ],
|
||||
|
||||
credentials: [ LoginSchema ],
|
||||
tokenCheckBit: {
|
||||
@@ -256,6 +256,27 @@ UserSchema.methods.toAuthJSON = function () {
|
||||
};
|
||||
};
|
||||
|
||||
UserSchema.methods.toProfileJSON = function () {
|
||||
const hasNomDeBid = !!this.nomDeBid;
|
||||
const nomDeBid = this.getNomDeBid();
|
||||
|
||||
return {
|
||||
addresses: this.addresses,
|
||||
avatar: this.avatar,
|
||||
email: this.email,
|
||||
firstName: this.firstName,
|
||||
generatedNomDeBid: !hasNomDeBid,
|
||||
isAllowedToBid: this.isAllowedToBid,
|
||||
isOrganizationEmployee: this.isOrganizationEmployee,
|
||||
isVerified: this.isVerified,
|
||||
lastName: this.lastName,
|
||||
nomDeBid: nomDeBid,
|
||||
organizationIdentifier: this.organizationIdentifier,
|
||||
paymentToken: this.paymentToken,
|
||||
phones: this.phones,
|
||||
};
|
||||
};
|
||||
|
||||
UserSchema.methods.validatePassword = function (password) {
|
||||
const strategy = this.getAuthStrategy('local');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user