- Tweaks
This commit is contained in:
@@ -64,7 +64,7 @@ const item = ({
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const getItems = ({
|
const getDemoData = ({
|
||||||
eventId = faker.random.uuid(),
|
eventId = faker.random.uuid(),
|
||||||
auction = 10,
|
auction = 10,
|
||||||
ticket = 4,
|
ticket = 4,
|
||||||
@@ -120,4 +120,7 @@ const getItems = ({
|
|||||||
return items;
|
return items;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = getItems;
|
module.exports = {
|
||||||
|
getDemoData,
|
||||||
|
item,
|
||||||
|
};
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ const UserSchema = new mongoose.Schema(
|
|||||||
trim: true,
|
trim: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
address: [ AddressSchema ],
|
addresses: [ AddressSchema ],
|
||||||
phone: [ PhoneSchema ],
|
phones: [ PhoneSchema ],
|
||||||
|
|
||||||
credentials: [ LoginSchema ],
|
credentials: [ LoginSchema ],
|
||||||
tokenCheckBit: {
|
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) {
|
UserSchema.methods.validatePassword = function (password) {
|
||||||
const strategy = this.getAuthStrategy('local');
|
const strategy = this.getAuthStrategy('local');
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ module.exports = function (server, auth) {
|
|||||||
return next(err, false, 'There was a problem creating the event');
|
return next(err, false, 'There was a problem creating the event');
|
||||||
}
|
}
|
||||||
|
|
||||||
const itemsStub = ItemFixture({
|
const itemsStub = ItemFixture.getDemoData({
|
||||||
eventId: event.id,
|
eventId: event.id,
|
||||||
auction: 10,
|
auction: 10,
|
||||||
ticket: eventTickets,
|
ticket: eventTickets,
|
||||||
|
|||||||
Reference in New Issue
Block a user