mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-14 02:02:19 +00:00
[#1711] taskSchema back to doc so we can use .id(). The performacne hit isn't
drastic, it was the history entries that was hurting us
This commit is contained in:
parent
e84aa13d62
commit
c5d3d142d9
1 changed files with 7 additions and 2 deletions
|
|
@ -12,7 +12,7 @@ var _ = require('lodash');
|
|||
// Task Schema
|
||||
// -----------
|
||||
|
||||
var TaskSchema = {
|
||||
var TaskSchema = new Schema({
|
||||
_id:{type: String,'default': helpers.uuid},
|
||||
id: String,
|
||||
history: Array, // [{date:Date, value:Number}], // this causes major performance problems
|
||||
|
|
@ -33,6 +33,11 @@ var TaskSchema = {
|
|||
winner: String // user.profile.name
|
||||
// group: {type: 'Strign', ref: 'Group'} // if we restore this, rename `id` above to `challenge`
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
TaskSchema.pre('save', function(next){
|
||||
this.id = this.id || this._id;
|
||||
next()
|
||||
})
|
||||
|
||||
module.exports.schema = TaskSchema;
|
||||
Loading…
Reference in a new issue