All files / libs/tenants/assignments/teams/state/src/lib queries.keys.ts

87.5% Statements 28/32
100% Branches 8/8
50% Functions 5/10
87.5% Lines 28/32

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 331x 1x 1x 1x 1x 1x 1x 1x 1x 1x 6x 6x 6x 6x 6x 6x 1x 1x         1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import { type TeamRole } from '@amalia/tenants/assignments/teams/types';
import { type TeamContract } from '@amalia/tenants/teams/types';
import { type UserContract } from '@amalia/tenants/users/types';
 
import { type GetUserTeamAssignmentsOptions } from './api-client/user-team-assignments.api-client';
 
export const teamAssignmentsQueryKeys = {
  all: () => ['team-assignments'] as const,
  users: () => [...teamAssignmentsQueryKeys.all(), 'users'] as const,
  user: (userId: UserContract['id'], options?: GetUserTeamAssignmentsOptions) =>
    [
      ...teamAssignmentsQueryKeys.users(),
      userId,
      options?.effectiveBetween?.start,
      options?.effectiveBetween?.end,
      options?.teamRole,
    ] as const,
  teams: <TRelations extends ('team' | 'user')[] = []>(filters: {
    teamsIds: TeamContract['id'][];
    teamRole?: TeamRole;
    relations?: TRelations;
  }) => [...teamAssignmentsQueryKeys.all(), 'teams', filters] as const,
} as const;
 
export const teamAssignmentsMutationKeys = {
  all: () => ['team-assignments'] as const,
  create: () => [...teamAssignmentsMutationKeys.all(), 'create'] as const,
  update: () => [...teamAssignmentsMutationKeys.all(), 'update'] as const,
  delete: () => [...teamAssignmentsMutationKeys.all(), 'delete'] as const,
  validateBulkImport: () => [...teamAssignmentsMutationKeys.all(), 'validate-bulk-import'] as const,
  confirmBulkImport: () => [...teamAssignmentsMutationKeys.all(), 'confirm-bulk-import'] as const,
} as const;