mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Upgrade mongoose (#10767)
* fix mongoose and upgrade * fix more validations
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user