Upgrade mongoose (#10767)

* fix mongoose and upgrade

* fix more validations
This commit is contained in:
Matteo Pagliazzi
2018-10-23 13:25:14 +02:00
committed by GitHub
parent d49db6d367
commit c813afba44
13 changed files with 107 additions and 67 deletions

View File

@@ -35,7 +35,7 @@ let schema = new Schema({
email: {
type: String,
validate: [{
validator: validator.isEmail,
validator: (v) => validator.isEmail(v),
message: shared.i18n.t('invalidEmail'),
}, {
validator (email) {
@@ -374,7 +374,7 @@ let schema = new Schema({
return {};
}},
challenges: [{type: String, ref: 'Challenge', validate: [validator.isUUID, 'Invalid uuid.']}],
challenges: [{type: String, ref: 'Challenge', validate: [v => validator.isUUID(v), 'Invalid uuid.']}],
invitations: {
// Using an array without validation because otherwise mongoose treat this as a subdocument and applies _id by default
@@ -391,7 +391,7 @@ let schema = new Schema({
type: String,
ref: 'Group',
required: true,
validate: [validator.isUUID, 'Invalid uuid.'],
validate: [v => validator.isUUID(v), 'Invalid uuid.'],
},
name: {
type: String,
@@ -401,15 +401,15 @@ let schema = new Schema({
type: String,
ref: 'User',
required: true,
validate: [validator.isUUID, 'Invalid uuid.'],
validate: [v => validator.isUUID(v), 'Invalid uuid.'],
},
}],
},
guilds: [{type: String, ref: 'Group', validate: [validator.isUUID, 'Invalid uuid.']}],
guilds: [{type: String, ref: 'Group', validate: [v => validator.isUUID(v), 'Invalid uuid.']}],
party: {
_id: {type: String, validate: [validator.isUUID, 'Invalid uuid.'], ref: 'Group'},
_id: {type: String, validate: [v => validator.isUUID(v), 'Invalid uuid.'], ref: 'Group'},
order: {type: String, default: 'level'},
orderAscending: {type: String, default: 'ascending'},
quest: {