add raidId and metrics to party adapter
This commit is contained in:
parent
0a45b13e71
commit
22d3ac625f
5 changed files with 39 additions and 6 deletions
|
|
@ -117,13 +117,14 @@ describe('PartyAdapter', () => {
|
|||
})
|
||||
|
||||
const result = await adapter.update({
|
||||
id: 'uuid-123',
|
||||
shortcode: 'ABC123',
|
||||
name: 'Updated Party'
|
||||
})
|
||||
|
||||
expect(result).toEqual(updatedParty)
|
||||
expect(global.fetch).toHaveBeenCalledWith(
|
||||
'https://api.example.com/parties/ABC123',
|
||||
'https://api.example.com/parties/uuid-123',
|
||||
expect.objectContaining({
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify({
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export interface CreatePartyParams {
|
|||
description?: string | undefined
|
||||
visibility?: 'public' | 'private' | 'unlisted' | undefined
|
||||
jobId?: string | undefined
|
||||
raidId?: string | undefined
|
||||
raidId?: string | null | undefined
|
||||
guidebookId?: string | undefined
|
||||
extras?: Record<string, any> | undefined
|
||||
}
|
||||
|
|
@ -30,7 +30,24 @@ export interface CreatePartyParams {
|
|||
* Parameters for updating a party
|
||||
*/
|
||||
export interface UpdatePartyParams extends CreatePartyParams {
|
||||
/** Party UUID (required for API update) */
|
||||
id: string
|
||||
/** Party shortcode (for cache invalidation) */
|
||||
shortcode: string
|
||||
// Battle settings
|
||||
fullAuto?: boolean
|
||||
autoGuard?: boolean
|
||||
autoSummon?: boolean
|
||||
chargeAttack?: boolean
|
||||
// Performance metrics (null to clear)
|
||||
clearTime?: number | null
|
||||
buttonCount?: number | null
|
||||
chainCount?: number | null
|
||||
summonCount?: number | null
|
||||
// Video (null to clear)
|
||||
videoUrl?: string | null
|
||||
// Raid (null to clear)
|
||||
raidId?: string | null
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -119,10 +136,11 @@ export class PartyAdapter extends BaseAdapter {
|
|||
|
||||
/**
|
||||
* Updates a party
|
||||
* Note: API expects UUID for update, not shortcode
|
||||
*/
|
||||
async update(params: UpdatePartyParams): Promise<Party> {
|
||||
const { shortcode, ...updateParams } = params
|
||||
const response = await this.request<{ party: Party }>(`/parties/${shortcode}`, {
|
||||
const { id, shortcode, ...updateParams } = params
|
||||
const response = await this.request<{ party: Party }>(`/parties/${id}`, {
|
||||
method: 'PATCH',
|
||||
body: {
|
||||
party: updateParams
|
||||
|
|
|
|||
|
|
@ -120,6 +120,8 @@ const MinimalScalarsSchema = z
|
|||
buttonCount: z.number().nullish().optional(),
|
||||
chainCount: z.number().nullish().optional(),
|
||||
turnCount: z.number().nullish().optional(),
|
||||
summonCount: z.number().nullish().optional(),
|
||||
videoUrl: z.string().nullish().optional(),
|
||||
visibility: z.enum(['public', 'private', 'unlisted']).nullish().optional()
|
||||
})
|
||||
.partial()
|
||||
|
|
@ -373,6 +375,10 @@ export const PartySchemaRaw = z.object({
|
|||
button_count: z.number().nullish(),
|
||||
turn_count: z.number().nullish(),
|
||||
chain_count: z.number().nullish(),
|
||||
summon_count: z.number().nullish(),
|
||||
|
||||
// Video URL
|
||||
video_url: z.string().nullish(),
|
||||
|
||||
// Relations
|
||||
raid_id: z.string().nullish(),
|
||||
|
|
|
|||
|
|
@ -9,12 +9,14 @@
|
|||
noHover?: boolean
|
||||
/** Remove padding for inline edit contexts */
|
||||
noPadding?: boolean
|
||||
/** Remove min-width from value (for compact controls like switches) */
|
||||
compact?: boolean
|
||||
}
|
||||
|
||||
let { label, value, children, noHover = false, noPadding = false }: Props = $props()
|
||||
let { label, value, children, noHover = false, noPadding = false, compact = false }: Props = $props()
|
||||
</script>
|
||||
|
||||
<div class="detail-row" class:no-hover={noHover} class:no-padding={noPadding}>
|
||||
<div class="detail-row" class:no-hover={noHover} class:no-padding={noPadding} class:compact>
|
||||
<span class="label">{label}</span>
|
||||
<span class="value">
|
||||
{#if children}
|
||||
|
|
@ -62,5 +64,9 @@
|
|||
text-align: right;
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
&.compact .value {
|
||||
min-width: unset;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ export interface Party {
|
|||
buttonCount?: number
|
||||
turnCount?: number
|
||||
chainCount?: number
|
||||
summonCount?: number
|
||||
videoUrl?: string
|
||||
visibility?: import('$lib/types/visibility').PartyVisibility
|
||||
element?: number
|
||||
favorited?: boolean
|
||||
|
|
|
|||
Loading…
Reference in a new issue