1
0
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:
2024-11-30 04:22:43 +04:00
parent 59c958ab32
commit 9f61f99548
2 changed files with 6 additions and 12 deletions

View File

@@ -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
)
}
}

View File

@@ -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.
*