mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
* Minor refactoring in scoreTask.js * Reward value validation added (should be >= 0)
This commit is contained in:
@@ -96,7 +96,17 @@ export const TaskSchema = new Schema({
|
||||
validate: [v => validator.isUUID(v), 'Invalid uuid for task tags.'],
|
||||
}],
|
||||
// redness or cost for rewards Required because it must be settable (for rewards)
|
||||
value: { $type: Number, default: 0, required: true },
|
||||
value: {
|
||||
$type: Number,
|
||||
default: 0,
|
||||
required: true,
|
||||
validate: {
|
||||
validator (value) {
|
||||
return this.type === 'reward' ? value >= 0 : true;
|
||||
},
|
||||
msg: 'Reward cost should be a positive number or 0.',
|
||||
},
|
||||
},
|
||||
priority: {
|
||||
$type: Number,
|
||||
default: 1,
|
||||
|
||||
Reference in New Issue
Block a user