simplification

This commit is contained in:
Timo Hocker 2020-05-02 20:03:14 +02:00
parent de5c397ed3
commit d504f892c0

View File

@ -16,19 +16,13 @@ export abstract class DatabaseModel {
this.data.id = val;
}
public static async get<T extends DatabaseModel> (
id: number,
constructor: new () => T
): Promise<T> {
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<void>;
public abstract write(): Promise<void>;
public abstract async read(): Promise<void>;
public abstract async write(): Promise<void>;
}