Introduce series management functionality and repository updates

- Added `series-world.repo.ts` to handle database operations related to series worlds and their elements.
- Implemented `series-sync.repo.ts` for managing synchronization between books and series.
- Expanded `spell.ipc.ts` data models to include `seriesSpellId` for spell synchronization.
- Refactored `insertSpellTag` method in `spelltag.repo.ts` for improved error handling and logic clarity.
This commit is contained in:
natreex
2026-01-26 19:57:56 -05:00
parent 2359638cb0
commit cec5830360
35 changed files with 5483 additions and 203 deletions

View File

@@ -20,6 +20,7 @@ export interface SpellProps {
components: string | null;
limitations: string | null;
notes: string | null;
seriesSpellId: string | null;
}
export interface SpellListItem {
@@ -27,6 +28,7 @@ export interface SpellListItem {
name: string;
description: string;
tags: SpellTagProps[];
seriesSpellId?: string | null;
}
export interface SpellListResponse {
@@ -193,6 +195,7 @@ export default class Spell {
name: decryptedName,
description: truncatedDescription,
tags: resolvedTags,
seriesSpellId: spell.series_spell_id || null,
};
});
@@ -240,6 +243,7 @@ export default class Spell {
components: spell.components ? System.decryptDataWithUserKey(spell.components, userKey) : null,
limitations: spell.limitations ? System.decryptDataWithUserKey(spell.limitations, userKey) : null,
notes: spell.notes ? System.decryptDataWithUserKey(spell.notes, userKey) : null,
seriesSpellId: spell.series_spell_id || null,
};
}
@@ -259,7 +263,7 @@ export default class Spell {
* @param lang - The language for error messages ('fr' or 'en')
* @returns The created spell props
*/
static addSpell(userId: string, bookId: string, name: string, description: string, appearance: string, tags: string[], powerLevel: string | null, components: string | null, limitations: string | null, notes: string | null, existingSpellId?: string, lang: 'fr' | 'en' = 'fr'): SpellProps {
static addSpell(userId: string, bookId: string, name: string, description: string, appearance: string, tags: string[], powerLevel: string | null, components: string | null, limitations: string | null, notes: string | null, existingSpellId?: string, lang: 'fr' | 'en' = 'fr', seriesSpellId: string | null = null): SpellProps {
const userKey: string = getUserEncryptionKey(userId);
const spellId: string = existingSpellId || System.createUniqueId();
@@ -287,6 +291,7 @@ export default class Spell {
encryptedLimitations,
encryptedNotes,
lang,
seriesSpellId,
);
return {
@@ -299,6 +304,7 @@ export default class Spell {
components,
limitations,
notes,
seriesSpellId,
};
}
@@ -317,7 +323,7 @@ export default class Spell {
* @param lang - The language for error messages ('fr' or 'en')
* @returns True if the update was successful
*/
static updateSpell(userId: string, spellId: string, name: string, description: string, appearance: string, tags: string[], powerLevel: string | null, components: string | null, limitations: string | null, notes: string | null, lang: 'fr' | 'en' = 'fr'): boolean {
static updateSpell(userId: string, spellId: string, name: string, description: string, appearance: string, tags: string[], powerLevel: string | null, components: string | null, limitations: string | null, notes: string | null, lang: 'fr' | 'en' = 'fr', seriesSpellId: string | null = null): boolean {
const userKey: string = getUserEncryptionKey(userId);
const encryptedName: string = System.encryptDataWithUserKey(name, userKey);
@@ -343,6 +349,7 @@ export default class Spell {
encryptedLimitations,
encryptedNotes,
lang,
seriesSpellId,
);
}