260321:1700 Correct Coresspondence / Doing RFA
This commit is contained in:
@@ -23,6 +23,9 @@ export const drawingKeys = {
|
||||
// --- Queries ---
|
||||
|
||||
export function useDrawings(type: DrawingType, params: DrawingSearchParams) {
|
||||
const shouldEnable =
|
||||
'projectUuid' in params ? Boolean(params.projectUuid) : true;
|
||||
|
||||
return useQuery({
|
||||
queryKey: drawingKeys.list(type, params),
|
||||
queryFn: async () => {
|
||||
@@ -50,6 +53,7 @@ export function useDrawings(type: DrawingType, params: DrawingSearchParams) {
|
||||
type: 'SHOP',
|
||||
title: d.currentRevision?.title || 'Untitled',
|
||||
revision: d.currentRevision?.revisionNumber,
|
||||
currentRevisionUuid: d.currentRevision?.uuid,
|
||||
legacyDrawingNumber: d.currentRevision?.legacyDrawingNumber,
|
||||
}));
|
||||
// Re-wrap to preserve meta
|
||||
@@ -65,6 +69,7 @@ export function useDrawings(type: DrawingType, params: DrawingSearchParams) {
|
||||
type: 'AS_BUILT',
|
||||
title: d.currentRevision?.title || 'Untitled',
|
||||
revision: d.currentRevision?.revisionNumber,
|
||||
currentRevisionUuid: d.currentRevision?.uuid,
|
||||
}));
|
||||
// Re-wrap to preserve meta
|
||||
response = { ...response, data: mappedData };
|
||||
@@ -72,6 +77,7 @@ export function useDrawings(type: DrawingType, params: DrawingSearchParams) {
|
||||
}
|
||||
return response;
|
||||
},
|
||||
enabled: shouldEnable,
|
||||
placeholderData: (previousData) => previousData,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ import type { CreateCorrespondenceTypeDto, UpdateCorrespondenceTypeDto } from '@
|
||||
|
||||
export const referenceDataKeys = {
|
||||
all: ['reference-data'] as const,
|
||||
rfaTypes: (contractId?: number) => [...referenceDataKeys.all, 'rfaTypes', contractId] as const,
|
||||
rfaTypes: (contractId?: number | string) => [...referenceDataKeys.all, 'rfaTypes', contractId] as const,
|
||||
disciplines: (contractId?: number) => [...referenceDataKeys.all, 'disciplines', contractId] as const,
|
||||
correspondenceTypes: () => [...referenceDataKeys.all, 'correspondenceTypes'] as const,
|
||||
};
|
||||
|
||||
// --- RFA Types ---
|
||||
export const useRfaTypes = (contractId?: number) => {
|
||||
export const useRfaTypes = (contractId?: number | string) => {
|
||||
return useQuery({
|
||||
queryKey: referenceDataKeys.rfaTypes(contractId),
|
||||
queryFn: () => masterDataService.getRfaTypes(contractId),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { userService } from '@/lib/services/user.service';
|
||||
import { CreateUserDto, UpdateUserDto, SearchUserDto } from '@/types/user';
|
||||
import { CreateUserDto, UpdateUserDto, SearchUserDto, Role } from '@/types/user';
|
||||
import { toast } from 'sonner';
|
||||
import { getApiErrorMessage } from '@/types/api-error';
|
||||
|
||||
@@ -18,7 +18,7 @@ export function useUsers(params?: SearchUserDto) {
|
||||
}
|
||||
|
||||
export function useRoles() {
|
||||
return useQuery({
|
||||
return useQuery<Role[]>({
|
||||
queryKey: ['roles'],
|
||||
queryFn: () => userService.getRoles(),
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
EvaluateWorkflowDto,
|
||||
GetAvailableActionsDto,
|
||||
} from '@/types/dto/workflow-engine/workflow-engine.dto';
|
||||
import { Workflow } from '@/types/workflow';
|
||||
|
||||
export const workflowKeys = {
|
||||
all: ['workflows'] as const,
|
||||
@@ -14,14 +15,14 @@ export const workflowKeys = {
|
||||
};
|
||||
|
||||
export const useWorkflowDefinitions = () => {
|
||||
return useQuery({
|
||||
return useQuery<Workflow[]>({
|
||||
queryKey: workflowKeys.definitions(),
|
||||
queryFn: () => workflowEngineService.getDefinitions(),
|
||||
});
|
||||
};
|
||||
|
||||
export const useWorkflowDefinition = (id: string | number) => {
|
||||
return useQuery({
|
||||
return useQuery<Workflow>({
|
||||
queryKey: workflowKeys.definition(id),
|
||||
queryFn: () => workflowEngineService.getDefinitionById(id),
|
||||
enabled: !!id,
|
||||
|
||||
Reference in New Issue
Block a user