1
0
mirror of https://github.com/koloml/furbooru-tagging-assistant.git synced 2025-12-23 23:02:58 +00:00

Getter for the type of the entity

This commit is contained in:
2025-07-27 18:27:19 +04:00
parent 0781742dab
commit 69dc645de2

View File

@@ -24,18 +24,22 @@ export default abstract class StorageEntity<SettingsType extends Object = {}> {
return this.#settings;
}
get type() {
return (this.constructor as typeof StorageEntity)._entityName;
}
public static readonly _entityName: keyof App.EntityNamesMap | "entity" = "entity";
async save() {
await EntitiesController.updateEntity(
(this.constructor as typeof StorageEntity)._entityName,
this.type,
this
);
}
async delete() {
await EntitiesController.deleteEntity(
(this.constructor as typeof StorageEntity)._entityName,
this.type,
this.id
);
}