261019_01_ENH: 리스트 비동기 작업 동시 실행 제한 및 진행 상태 UI 개선, 미사용 참조 정리
This commit is contained in:
@@ -3,22 +3,18 @@ import {qk} from "@/query/key/keys";
|
||||
import {nextApi} from "@/lib/http-client";
|
||||
import {
|
||||
listHeader,
|
||||
ListEventHistDownloadRequest,
|
||||
ListEventHistory,
|
||||
ListEventInsertRequest,
|
||||
ListFilter,
|
||||
ListReserve,
|
||||
ListReserveRequest,
|
||||
ListResetRequest,
|
||||
ListSearchRequest,
|
||||
ListSearchWithFullResult,
|
||||
ListUpdateHistory,
|
||||
ListUpdateRequest,
|
||||
ListUploadHistory,
|
||||
ListUploadRequest,
|
||||
} from "@/types/list";
|
||||
import type { ExcelUploadResult, PageResponse } from "@kri/common";
|
||||
import {LIST_EXCEL_TIMEOUT_MS, ListHeaderAssignConst} from "@/const/listConst";
|
||||
import type { PageResponse } from "@kri/common";
|
||||
import {ListHeaderAssignConst} from "@/const/listConst";
|
||||
import {ResultCodeType} from "@/types/project";
|
||||
|
||||
export function useListHeaderQuery(prjctIdx: number, enabled: boolean) {
|
||||
@@ -187,28 +183,6 @@ export function useListUploadHistoryQuery(prjctIdx: number, enabled: boolean) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useUploadListExcelMutation(prjctIdx: number) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: ({ file, request }: { file: File; request: ListUploadRequest }) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
formData.append("request", new Blob([JSON.stringify(request)], { type: "application/json" }));
|
||||
return nextApi.postForm<ExcelUploadResult>(`/list/excel-upload/${prjctIdx}`, formData, {
|
||||
timeoutMs: LIST_EXCEL_TIMEOUT_MS,
|
||||
});
|
||||
},
|
||||
onSuccess: async () => {
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: qk.listHeader(prjctIdx) }),
|
||||
queryClient.invalidateQueries({ queryKey: qk.listUploadHistory(prjctIdx) }),
|
||||
queryClient.invalidateQueries({ queryKey: ["list", "search-filter"] }),
|
||||
]);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateListHeaderMutation(prjctIdx: number) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
@@ -220,17 +194,6 @@ export function useUpdateListHeaderMutation(prjctIdx: number) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useResetListMutation(prjctIdx: number) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (request: ListResetRequest) => nextApi.del<number>(`/list/${prjctIdx}`, { json: request }),
|
||||
onSuccess: async () => {
|
||||
await queryClient.invalidateQueries({ queryKey: ["list"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useUpdateListMutation(prjctIdx: number) {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
@@ -275,40 +238,6 @@ export function useDeleteListEventMutation(prjctIdx: number, sid: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadListMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: ({ listFilter, includeResult }: { listFilter: ListFilter; includeResult: boolean }) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/excel-download/${prjctIdx}?includeResult=${includeResult}`, listFilter, {
|
||||
expectBinary: true,
|
||||
timeoutMs: LIST_EXCEL_TIMEOUT_MS,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadListUpdateHistoryMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: (listFilter: ListFilter) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/excel-download-update/${prjctIdx}`, listFilter, { expectBinary: true }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadListEventHistoryMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: ({ includeResult, ...request }: ListEventHistDownloadRequest & { includeResult: boolean }) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/event-history-download/${prjctIdx}?includeResult=${includeResult}`, request, {
|
||||
expectBinary: true,
|
||||
timeoutMs: LIST_EXCEL_TIMEOUT_MS,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadListItemFileMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: (listFilter: ListFilter) =>
|
||||
nextApi.post<ArrayBuffer>(`/list/item-file-download/${prjctIdx}`, listFilter, { expectBinary: true }),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDownloadUploadHistoryFileMutation(prjctIdx: number) {
|
||||
return useMutation({
|
||||
mutationFn: (listUploadLogId: string) =>
|
||||
|
||||
Reference in New Issue
Block a user