user model added; message model changed; tag model added

This commit is contained in:
mandutzse68104 committed 2019-06-04 14:50:37 +02:00
1 parent d27216c8a8
commit f6a8c83586
5156 files changed
+62 -437424

No files matched your search

-28
View File
@@ -1,28 +0,0 @@
'use strict';
/*!
* ignore
*/
module.exports = function(schema) {
// ensure the documents receive an id getter unless disabled
const autoIdGetter = !schema.paths['id'] &&
(!schema.options.noVirtualId && schema.options.id);
if (!autoIdGetter) {
return;
}
schema.virtual('id').get(idGetter);
};
/*!
* Returns this documents _id cast to a string.
*/
function idGetter() {
if (this._id != null) {
return String(this._id);
}
return null;
}
-38
View File
@@ -1,38 +0,0 @@
'use strict';
const each = require('async/each');
/*!
* ignore
*/
module.exports = function(schema) {
const unshift = true;
schema.s.hooks.pre('remove', false, function(next) {
if (this.ownerDocument) {
next();
return;
}
const _this = this;
const subdocs = this.$__getAllSubdocs();
if (!subdocs.length) {
next();
return;
}
each(subdocs, function(subdoc, cb) {
subdoc.$__remove(function(err) {
cb(err);
});
}, function(error) {
if (error) {
return _this.schema.s.hooks.execPost('remove:error', _this, [_this], { error: error }, function(error) {
next(error);
});
}
next();
});
}, null, unshift);
};
-66
View File
@@ -1,66 +0,0 @@
'use strict';
const each = require('async/each');
/*!
* ignore
*/
module.exports = function(schema) {
const unshift = true;
schema.s.hooks.pre('save', false, function(next) {
if (this.ownerDocument) {
next();
return;
}
const _this = this;
const subdocs = this.$__getAllSubdocs();
if (!subdocs.length) {
next();
return;
}
each(subdocs, function(subdoc, cb) {
subdoc.schema.s.hooks.execPre('save', subdoc, function(err) {
cb(err);
});
}, function(error) {
if (error) {
return _this.schema.s.hooks.execPost('save:error', _this, [_this], { error: error }, function(error) {
next(error);
});
}
next();
});
}, null, unshift);
schema.s.hooks.post('save', function(doc, next) {
if (this.ownerDocument) {
next();
return;
}
const _this = this;
const subdocs = this.$__getAllSubdocs();
if (!subdocs.length) {
next();
return;
}
each(subdocs, function(subdoc, cb) {
subdoc.schema.s.hooks.execPost('save', subdoc, [subdoc], function(err) {
cb(err);
});
}, function(error) {
if (error) {
return _this.schema.s.hooks.execPost('save:error', _this, [_this], { error: error }, function(error) {
next(error);
});
}
next();
});
}, null, unshift);
};