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