fix
This commit is contained in:
parent
400b68daf0
commit
433b2b5b27
@ -10,6 +10,7 @@ import { Persistent } from './Persistent';
|
||||
export abstract class ControlModel extends Persistent {
|
||||
public constructor (obj?: Record<string, string|number|boolean>) {
|
||||
super ();
|
||||
this.define_properties ();
|
||||
for (const prop of Object.keys (this.properties)) {
|
||||
if ([
|
||||
'string',
|
||||
@ -43,4 +44,5 @@ export abstract class ControlModel extends Persistent {
|
||||
}
|
||||
|
||||
public abstract verify(): void;
|
||||
protected abstract define_properties(): void;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ export abstract class DatabaseModel extends Persistent {
|
||||
public constructor (id?: number) {
|
||||
super ();
|
||||
this.properties.id = 'number';
|
||||
this.define_properties ();
|
||||
for (const prop of Object.keys (this.properties)) {
|
||||
if ([
|
||||
'string',
|
||||
@ -45,4 +46,5 @@ export abstract class DatabaseModel extends Persistent {
|
||||
public abstract async read(): Promise<boolean>;
|
||||
public abstract async write(): Promise<boolean>;
|
||||
public abstract async delete(): Promise<boolean>;
|
||||
protected abstract define_properties(): void;
|
||||
}
|
||||
|
@ -2,13 +2,7 @@ import { Assignable, Serializable } from './interfaces';
|
||||
|
||||
export abstract class Persistent implements Assignable, Serializable {
|
||||
private _data: Record<string, unknown> = {};
|
||||
protected readonly properties: Record<string, string>;
|
||||
|
||||
public constructor () {
|
||||
this.properties = this.define_properties ();
|
||||
}
|
||||
|
||||
protected abstract define_properties(): Record<string, string>;
|
||||
protected readonly properties: Record<string, string> = {};
|
||||
|
||||
public assign (a: Assignable): void {
|
||||
this.assign_object (a.to_object ());
|
||||
|
Loading…
x
Reference in New Issue
Block a user