Skip to content
Snippets Groups Projects
Commit 2694b105 authored by michael.minelli's avatar michael.minelli
Browse files

Model abstract class

parent 8e95d845
Branches
Tags
No related merge requests found
type Constructor<T> = new (...args: any[]) => T;
abstract class Model extends Object {
static tableName: string = null;
static createFromSql<T extends Object>(this: Constructor<T>, obj: any): T {
const result = new this();
Object.getOwnPropertyNames(obj).forEach(property => {
if (result.hasOwnProperty(property)) {
(result as any)[property] = obj[property];
}
});
return result;
}
public abstract toJsonObject(lightVersion: boolean): Promise<Object>
}
export default Model;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment