blocker phase 6, catalog admin
This commit is contained in:
@@ -11,12 +11,26 @@ export const catalogKeys = {
|
||||
|
||||
// Reference data — cached for the whole session, never invalidated by this phase.
|
||||
categories: () => [...catalogKeys.all, 'categories'] as const,
|
||||
/** Prefix shared by every `categoryOptionGroups(id)` key — invalidate this to catch every cached
|
||||
* category when a group/value edit is cross-category (its `serviceCategoryId` is null) or its exact
|
||||
* category set isn't known to the caller. */
|
||||
categoryOptionGroupsAll: () => [...catalogKeys.all, 'option-groups'] as const,
|
||||
categoryOptionGroups: (categoryId?: number | null) =>
|
||||
[...catalogKeys.all, 'option-groups', categoryId ?? null] as const,
|
||||
[...catalogKeys.categoryOptionGroupsAll(), categoryId ?? null] as const,
|
||||
|
||||
// The nurse's offerings — mutable; mutations invalidate the `myVariantsLists()` prefix.
|
||||
variants: () => [...catalogKeys.all, 'variants'] as const,
|
||||
myVariantsLists: () => [...catalogKeys.variants(), 'mine'] as const,
|
||||
myVariants: (params?: PageParams) => [...catalogKeys.myVariantsLists(), params ?? {}] as const,
|
||||
variant: (id: number) => [...catalogKeys.variants(), 'detail', id] as const,
|
||||
|
||||
// Admin catalog management — separate from the public/cached reference-data keys above so a mutation
|
||||
// invalidating one never stales the other's cache entry.
|
||||
admin: () => [...catalogKeys.all, 'admin'] as const,
|
||||
adminCategoryLists: () => [...catalogKeys.admin(), 'categories'] as const,
|
||||
adminCategories: (params?: PageParams) => [...catalogKeys.adminCategoryLists(), params ?? {}] as const,
|
||||
/** Prefix shared by every `adminOptionGroups(id)` key — see `categoryOptionGroupsAll`'s doc for why a
|
||||
* group/value mutation invalidates this prefix instead of a single category id. */
|
||||
adminOptionGroupsAll: () => [...catalogKeys.admin(), 'option-groups'] as const,
|
||||
adminOptionGroups: (categoryId: number) => [...catalogKeys.adminOptionGroupsAll(), categoryId] as const,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user