Error if user already exists, clean user
This commit is contained in:
@@ -245,6 +245,25 @@ module.exports.createClass = function(model) {
|
||||
}
|
||||
}
|
||||
|
||||
ret.prototype.toJSON = function() {
|
||||
let json = {};
|
||||
for (let field of model.fields) {
|
||||
json[field.name] = this[field.name]
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
ret.fromJSON = function(json) {
|
||||
let result = new ret();
|
||||
|
||||
for (let field of model.fields) {
|
||||
result[field.name] = json[field.name];
|
||||
}
|
||||
result._persisted = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ret.prototype.save = function(callback = () => {}) {
|
||||
let fieldsToSave = [];
|
||||
for (let field of model.fields) {
|
||||
|
||||
Reference in New Issue
Block a user