mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
* Validate that everyX values are integers bounded by 0 and 9999 * Added client side check * Updated tests * Added migration for bad dailies Near idential to the other task migration. * fix(typo): camelCase function call
This commit is contained in:
@@ -239,7 +239,14 @@ export let habit = Task.discriminator('habit', HabitSchema);
|
||||
|
||||
export let DailySchema = new Schema(_.defaults({
|
||||
frequency: {type: String, default: 'weekly', enum: ['daily', 'weekly', 'monthly', 'yearly']},
|
||||
everyX: {type: Number, default: 1}, // e.g. once every X weeks
|
||||
everyX: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
validate: [
|
||||
(val) => val % 1 === 0 && val >= 0 && val <= 9999,
|
||||
'Valid everyX values are integers from 0 to 9999',
|
||||
],
|
||||
},
|
||||
startDate: {
|
||||
type: Date,
|
||||
default () {
|
||||
|
||||
Reference in New Issue
Block a user