From 179cc137253d9724b7a4e126464b830c4b1517cd Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 1 Dec 2025 03:24:15 -0800 Subject: [PATCH] adapters: add update methods for characters, weapons, and summons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add updateCharacter(), updateSummon(), and updateWeapon() methods to entity adapter. Each method uses PATCH and clears the entity cache after successful update. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/lib/api/adapters/entity.adapter.ts | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/lib/api/adapters/entity.adapter.ts b/src/lib/api/adapters/entity.adapter.ts index eea431c4..befcf6a6 100644 --- a/src/lib/api/adapters/entity.adapter.ts +++ b/src/lib/api/adapters/entity.adapter.ts @@ -548,6 +548,20 @@ export class EntityAdapter extends BaseAdapter { }) } + /** + * Updates an existing character record + * Requires editor role (>= 7) + */ + async updateCharacter(id: string, payload: Partial): Promise { + const result = await this.request(`/characters/${id}`, { + method: 'PATCH', + body: { character: payload } + }) + // Invalidate cache for this character + this.clearCache(`/characters/${id}`) + return result + } + /** * Triggers async image download for a character * Requires editor role (>= 7) @@ -637,6 +651,20 @@ export class EntityAdapter extends BaseAdapter { }) } + /** + * Updates an existing summon record + * Requires editor role (>= 7) + */ + async updateSummon(id: string, payload: Partial): Promise { + const result = await this.request(`/summons/${id}`, { + method: 'PATCH', + body: { summon: payload } + }) + // Invalidate cache for this summon + this.clearCache(`/summons/${id}`) + return result + } + /** * Triggers async image download for a summon * Requires editor role (>= 7) @@ -726,6 +754,20 @@ export class EntityAdapter extends BaseAdapter { }) } + /** + * Updates an existing weapon record + * Requires editor role (>= 7) + */ + async updateWeapon(id: string, payload: Partial): Promise { + const result = await this.request(`/weapons/${id}`, { + method: 'PATCH', + body: { weapon: payload } + }) + // Invalidate cache for this weapon + this.clearCache(`/weapons/${id}`) + return result + } + /** * Triggers async image download for a weapon * Requires editor role (>= 7)