fix(core): update

This commit is contained in:
2020-09-25 21:05:21 +00:00
parent e550a8dbd6
commit f29ae67580
3 changed files with 21 additions and 10 deletions

View File

@ -110,17 +110,19 @@ export class SmartDataDbDoc<T, TImplements> {
public async save() {
// tslint:disable-next-line: no-this-assignment
const self: any = this;
let dbResult: any;
switch (this.creationStatus) {
case 'db':
await this.collection.update(self);
dbResult = await this.collection.update(self);
break;
case 'new':
const writeResult = await this.collection.insert(self);
dbResult = await this.collection.insert(self);
this.creationStatus = 'db';
break;
default:
console.error('neither new nor in db?');
}
return dbResult;
}
/**