diff --git a/lib/DatabaseModel.ts b/lib/DatabaseModel.ts index 344fb9b..a933f6c 100644 --- a/lib/DatabaseModel.ts +++ b/lib/DatabaseModel.ts @@ -16,19 +16,13 @@ export abstract class DatabaseModel { this.data.id = val; } - public static async get ( - id: number, - constructor: new () => T - ): Promise { - const dbm = (new constructor); - dbm.id = id; - await dbm.read (); - return dbm; + public constructor (id) { + this.id = id; } public abstract get(key: string): string|number|boolean; public abstract set(key: string, value: string|number|boolean); - public abstract read(): Promise; - public abstract write(): Promise; + public abstract async read(): Promise; + public abstract async write(): Promise; }