adapters: add update methods for characters, weapons, and summons
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 <noreply@anthropic.com>
This commit is contained in:
parent
7a86790670
commit
179cc13725
1 changed files with 42 additions and 0 deletions
|
|
@ -548,6 +548,20 @@ export class EntityAdapter extends BaseAdapter {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing character record
|
||||
* Requires editor role (>= 7)
|
||||
*/
|
||||
async updateCharacter(id: string, payload: Partial<CreateCharacterPayload>): Promise<Character> {
|
||||
const result = await this.request<Character>(`/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<CreateSummonPayload>): Promise<Summon> {
|
||||
const result = await this.request<Summon>(`/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<CreateWeaponPayload>): Promise<Weapon> {
|
||||
const result = await this.request<Weapon>(`/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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue