mirror of
https://github.com/koloml/furbooru-tagging-assistant.git
synced 2025-12-23 23:02:58 +00:00
Added initial version of tag group entity with tags & prefixes
This commit is contained in:
2
src/app.d.ts
vendored
2
src/app.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// See https://kit.svelte.dev/docs/types#app
|
||||
// for information about these interfaces
|
||||
import MaintenanceProfile from "$entities/MaintenanceProfile.ts";
|
||||
import type TagGroup from "$entities/TagGroup.ts";
|
||||
|
||||
declare global {
|
||||
namespace App {
|
||||
@@ -24,6 +25,7 @@ declare global {
|
||||
|
||||
interface EntityNamesMap {
|
||||
profiles: MaintenanceProfile;
|
||||
groups: TagGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
src/lib/extension/entities/TagGroup.ts
Normal file
19
src/lib/extension/entities/TagGroup.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import StorageEntity from "$lib/extension/base/StorageEntity.ts";
|
||||
|
||||
export interface TagGroupSettings {
|
||||
name: string;
|
||||
tags: string[];
|
||||
prefixes: string[];
|
||||
}
|
||||
|
||||
export default class TagGroup extends StorageEntity<TagGroupSettings> {
|
||||
constructor(id: string, settings: Partial<TagGroupSettings>) {
|
||||
super(id, {
|
||||
name: settings.name || '',
|
||||
tags: settings.tags || [],
|
||||
prefixes: settings.prefixes || [],
|
||||
});
|
||||
}
|
||||
|
||||
static _entityName = 'groups';
|
||||
}
|
||||
@@ -13,6 +13,15 @@ const entitiesExporters: ExportersMap = {
|
||||
tags: entity.settings.tags,
|
||||
}
|
||||
},
|
||||
groups: entity => {
|
||||
return {
|
||||
v: 1,
|
||||
id: entity.id,
|
||||
name: entity.settings.name,
|
||||
tags: entity.settings.tags,
|
||||
prefixes: entity.settings.prefixes,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export function exportEntityToObject(entityInstance: StorageEntity<any>, entityName: string): Record<string, any> {
|
||||
|
||||
Reference in New Issue
Block a user