fix(core): update

This commit is contained in:
2019-01-08 14:37:17 +01:00
parent 5c78f83a28
commit 941d2f0902
2 changed files with 24 additions and 4 deletions

View File

@ -77,7 +77,16 @@ export class SmartDataDbDoc<T> {
*/
constructor() {
this.name = this.constructor['name'];
this.collection = this.constructor['smartdataCollection'];
if(this.constructor['smartdataCollection']) {
// tslint:disable-next-line: no-string-literal
this.collection = this.constructor['smartdataCollection'];
// tslint:disable-next-line: no-string-literal
} else if (typeof this.constructor['smartdataDelayedDatabase'] === 'function') {
// tslint:disable-next-line: no-string-literal
this.collection = this.constructor['smartdataDelayedDatabase']();
} else {
console.error('Could not determine collection for DbDoc');
}
}
static async getInstances<T>(filterArg): Promise<T[]> {
@ -109,6 +118,7 @@ export class SmartDataDbDoc<T> {
* may lead to data inconsistencies, but is faster
*/
async save() {
// tslint:disable-next-line: no-this-assignment
let self: any = this;
switch (this.creationStatus) {
case 'db':