mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Merge branch 'develop' into api-v3
This commit is contained in:
@@ -32,6 +32,12 @@ export let TaskSchema = new Schema({
|
||||
broken: {type: String, enum: ['CHALLENGE_DELETED', 'TASK_DELETED', 'UNSUBSCRIBED', 'CHALLENGE_CLOSED']},
|
||||
winner: String, // user.profile.name TODO necessary?
|
||||
},
|
||||
|
||||
reminders: [{
|
||||
id: {type: String, validate: [validator.isUUID, 'Invalid uuid.'], default: shared.uuid, required: true},
|
||||
startDate: {type: Date, required: true},
|
||||
time: {type: Date, required: true},
|
||||
}],
|
||||
}, _.defaults({
|
||||
minimize: true, // So empty objects are returned
|
||||
strict: true,
|
||||
@@ -63,6 +69,12 @@ TaskSchema.statics.sanitizeChecklist = function sanitizeChecklist (checklistObj)
|
||||
return checklistObj;
|
||||
};
|
||||
|
||||
// Sanitize reminder objects (disallowing id)
|
||||
TaskSchema.statics.sanitizeChecklist = function sanitizeChecklist (reminderObj) {
|
||||
delete reminderObj.id;
|
||||
return reminderObj;
|
||||
};
|
||||
|
||||
export let Task = mongoose.model('Task', TaskSchema);
|
||||
|
||||
// habits and dailies shared fields
|
||||
|
||||
Reference in New Issue
Block a user