frontend phase 15
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import type { PageParams } from '@/lib/api/types';
|
||||
import type { AuditFilters, HolidayFilters, SupportAlertFilters } from './types';
|
||||
|
||||
/**
|
||||
* React Query key factory for the admin domain (hierarchical, per the `services/{domain}` pattern). The
|
||||
* **filters + page object keys each list** so every filter/page combination caches independently — paging
|
||||
* or switching a worklist filter never refetches data already held (phase §5). Mutations invalidate the
|
||||
* relevant sub-tree (`config()`/`holidays()`/`audit()`/`supportAlerts()`/`roles()`).
|
||||
*/
|
||||
export const adminKeys = {
|
||||
all: ['admin'] as const,
|
||||
|
||||
config: () => [...adminKeys.all, 'config'] as const,
|
||||
configList: (params: PageParams) => [...adminKeys.config(), 'list', params] as const,
|
||||
configHistory: (key: string, params: PageParams) => [...adminKeys.config(), 'history', key, params] as const,
|
||||
|
||||
holidays: () => [...adminKeys.all, 'holidays'] as const,
|
||||
holidayList: (filters: HolidayFilters, params: PageParams) =>
|
||||
[...adminKeys.holidays(), 'list', filters, params] as const,
|
||||
|
||||
audit: () => [...adminKeys.all, 'audit'] as const,
|
||||
auditList: (filters: AuditFilters, params: PageParams) => [...adminKeys.audit(), 'list', filters, params] as const,
|
||||
|
||||
supportAlerts: () => [...adminKeys.all, 'supportAlerts'] as const,
|
||||
supportAlertList: (filters: SupportAlertFilters, params: PageParams) =>
|
||||
[...adminKeys.supportAlerts(), 'list', filters, params] as const,
|
||||
|
||||
roles: () => [...adminKeys.all, 'roles'] as const,
|
||||
roleList: (userId?: number) => [...adminKeys.roles(), 'list', userId ?? null] as const,
|
||||
};
|
||||
Reference in New Issue
Block a user