260316:1117 20260316:1100 Refactor UUID
Build and Deploy / deploy (push) Successful in 9m24s

This commit is contained in:
admin
2026-03-16 11:17:15 +07:00
parent b93cd91325
commit c5c3ed9016
92 changed files with 1726 additions and 620 deletions
+10 -10
View File
@@ -17,7 +17,7 @@ export const drawingKeys = {
lists: () => [...drawingKeys.all, 'list'] as const,
list: (type: DrawingType, params: DrawingSearchParams) => [...drawingKeys.lists(), type, params] as const,
details: () => [...drawingKeys.all, 'detail'] as const,
detail: (type: DrawingType, id: number | string) => [...drawingKeys.details(), type, id] as const,
detail: (type: DrawingType, uuid: string) => [...drawingKeys.details(), type, uuid] as const,
};
// --- Queries ---
@@ -33,7 +33,7 @@ export function useDrawings(type: DrawingType, params: DrawingSearchParams) {
if (response && response.data) {
const mappedData = response.data.map((d: ContractDrawing) => ({
...d,
drawingId: d.id,
uuid: d.uuid,
drawingNumber: d.contractDrawingNo,
type: 'CONTRACT',
}));
@@ -46,7 +46,7 @@ export function useDrawings(type: DrawingType, params: DrawingSearchParams) {
if (response && response.data) {
const mappedData = response.data.map((d: ShopDrawing) => ({
...d,
drawingId: d.id,
uuid: d.uuid,
type: 'SHOP',
title: d.currentRevision?.title || 'Untitled',
revision: d.currentRevision?.revisionNumber,
@@ -61,7 +61,7 @@ export function useDrawings(type: DrawingType, params: DrawingSearchParams) {
if (response && response.data) {
const mappedData = response.data.map((d: AsBuiltDrawing) => ({
...d,
drawingId: d.id,
uuid: d.uuid,
type: 'AS_BUILT',
title: d.currentRevision?.title || 'Untitled',
revision: d.currentRevision?.revisionNumber,
@@ -76,19 +76,19 @@ export function useDrawings(type: DrawingType, params: DrawingSearchParams) {
});
}
export function useDrawing(type: DrawingType, id: number | string) {
export function useDrawing(type: DrawingType, uuid: string) {
return useQuery({
queryKey: drawingKeys.detail(type, id),
queryKey: drawingKeys.detail(type, uuid),
queryFn: async () => {
if (type === 'CONTRACT') {
return contractDrawingService.getById(id);
return contractDrawingService.getByUuid(uuid);
} else if (type === 'SHOP') {
return shopDrawingService.getById(id);
return shopDrawingService.getByUuid(uuid);
} else {
return asBuiltDrawingService.getById(id);
return asBuiltDrawingService.getByUuid(uuid);
}
},
enabled: !!id,
enabled: !!uuid,
});
}