mirror of
https://github.com/koloml/furbooru-tagging-assistant.git
synced 2025-12-24 07:12:57 +00:00
Moving readAll static method to base class
This commit is contained in:
@@ -40,7 +40,11 @@ export default abstract class StorageEntity<SettingsType extends Object = {}> {
|
||||
);
|
||||
}
|
||||
|
||||
static async readAll(): Promise<Array<any>> {
|
||||
throw new Error("Not implemented");
|
||||
public static async readAll<Type extends StorageEntity<any>>(this: new (...args: any[]) => Type): Promise<Type[]> {
|
||||
return await EntitiesController.readAllEntities(
|
||||
// Voodoo magic, once again.
|
||||
((this as any) as typeof StorageEntity)._entityName,
|
||||
this
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,16 +23,6 @@ export default class MaintenanceProfile extends StorageEntity<MaintenanceProfile
|
||||
|
||||
public static readonly _entityName = "profiles";
|
||||
|
||||
/**
|
||||
* Read all maintenance profiles from the storage.
|
||||
*/
|
||||
static async readAll(): Promise<MaintenanceProfile[]> {
|
||||
return await EntitiesController.readAllEntities(
|
||||
this._entityName,
|
||||
MaintenanceProfile
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe to the changes and receive the new list of profiles when they change.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user