This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
DesignCnstnBizCstSaveRequestDto,
|
||||
DesignCnstnBizCstSearchDto,
|
||||
@@ -35,26 +33,52 @@ import { designCnstnEsntlAtchFileService } from "./design-cnstn-esntl-atch-file-
|
||||
import { designCnstnMngService } from "./design-cnstn-mng-service";
|
||||
import { designCnstnRvwOpnnService } from "./design-cnstn-rvw-opnn-service";
|
||||
|
||||
export const designCnstnMngBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN] as const;
|
||||
export const designCnstnBizCstBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_CST] as const;
|
||||
export const designCnstnBizSclBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_SCL] as const;
|
||||
export const designCnstnEsntlAtchFileBaseKey = [
|
||||
ENDPOINT.AS_SERVICE.DESIGN_CNSTN_ESNTL_ATCH_FILE,
|
||||
] as const;
|
||||
export const designCnstnRvwOpnnBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN_RVW_OPNN] as const;
|
||||
export const designCnstnKeys = {
|
||||
all: ["design-cnstn"] as const,
|
||||
list: () => [...designCnstnKeys.all, "list"] as const,
|
||||
detail: (id: string) => [...designCnstnKeys.all, "detail", id] as const,
|
||||
};
|
||||
|
||||
export const designCnstnBizCstKeys = {
|
||||
all: ["design-cnstn-biz-cst"] as const,
|
||||
list: () => [...designCnstnBizCstKeys.all, "list"] as const,
|
||||
detail: (docNo: string, acntgSeCd: string) =>
|
||||
[...designCnstnBizCstKeys.all, "detail", docNo, acntgSeCd] as const,
|
||||
};
|
||||
|
||||
export const designCnstnBizSclKeys = {
|
||||
all: ["design-cnstn-biz-scl"] as const,
|
||||
list: () => [...designCnstnBizSclKeys.all, "list"] as const,
|
||||
detail: (docNo: string, cnstpSeCd: string) =>
|
||||
[...designCnstnBizSclKeys.all, "detail", docNo, cnstpSeCd] as const,
|
||||
};
|
||||
|
||||
export const designCnstnEsntlAtchFileKeys = {
|
||||
all: ["design-cnstn-esntl-atch-file"] as const,
|
||||
list: () => [...designCnstnEsntlAtchFileKeys.all, "list"] as const,
|
||||
detail: (docNo: string, esntlAtchFileId: string) =>
|
||||
[...designCnstnEsntlAtchFileKeys.all, "detail", docNo, esntlAtchFileId] as const,
|
||||
};
|
||||
|
||||
export const designCnstnRvwOpnnKeys = {
|
||||
all: ["design-cnstn-rvw-opnn"] as const,
|
||||
list: () => [...designCnstnRvwOpnnKeys.all, "list"] as const,
|
||||
detail: (docNo: string, rvwOpnnSn: number) =>
|
||||
[...designCnstnRvwOpnnKeys.all, "detail", docNo, rvwOpnnSn] as const,
|
||||
};
|
||||
|
||||
/* ─── DesignCnstnMng ─── */
|
||||
|
||||
export function useDesignCnstnMngPage(params: DesignCnstnMngSearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...designCnstnMngBaseKey, "findPage", params],
|
||||
queryKey: [...designCnstnKeys.list(), params],
|
||||
queryFn: () => designCnstnMngService.findPage(params),
|
||||
});
|
||||
}
|
||||
|
||||
export function useDesignCnstnMng(id: string | null | undefined) {
|
||||
return useQuery({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||
queryKey: designCnstnKeys.detail(id!),
|
||||
queryFn: () => designCnstnMngService.findById(id!),
|
||||
enabled: Boolean(id),
|
||||
});
|
||||
@@ -65,7 +89,7 @@ export function useSaveDesignCnstnMng() {
|
||||
return useMutation({
|
||||
mutationFn: (body: DesignCnstnMngSaveRequestDto) => designCnstnMngService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -75,7 +99,7 @@ export function useSaveApplyDesignCnstnMng() {
|
||||
return useMutation({
|
||||
mutationFn: (body: DesignCnstnApplySaveRequestDto) => designCnstnMngService.saveApply(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -86,9 +110,9 @@ export function useUpdateDesignCnstnMng() {
|
||||
mutationFn: ({ id, body }: { id: string; body: DesignCnstnMngUpdateRequestDto }) =>
|
||||
designCnstnMngService.update(id, body),
|
||||
onSuccess: (_data, { id }) => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||
queryKey: designCnstnKeys.detail(id),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -100,9 +124,9 @@ export function useTechReviewDesignCnstnMng() {
|
||||
mutationFn: ({ id, body }: { id: string; body: DesignCnstnApplySaveRequestDto }) =>
|
||||
designCnstnMngService.techReview(id, body),
|
||||
onSuccess: (_data, { id }) => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||
queryKey: designCnstnKeys.detail(id),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -113,7 +137,7 @@ export function useDeleteDesignCnstnMng() {
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => designCnstnMngService.delete(id),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -122,7 +146,7 @@ export function useDeleteDesignCnstnMng() {
|
||||
|
||||
export function useDesignCnstnBizCstPage(params: DesignCnstnBizCstSearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...designCnstnBizCstBaseKey, "findPage", params],
|
||||
queryKey: [...designCnstnBizCstKeys.list(), params],
|
||||
queryFn: () => designCnstnBizCstService.findPage(params),
|
||||
});
|
||||
}
|
||||
@@ -132,7 +156,7 @@ export function useDesignCnstnBizCst(
|
||||
acntgSeCd: string | null | undefined,
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: [...designCnstnBizCstBaseKey, "findById", designCnstnDocNo, acntgSeCd],
|
||||
queryKey: designCnstnBizCstKeys.detail(designCnstnDocNo!, acntgSeCd!),
|
||||
queryFn: () => designCnstnBizCstService.findById(designCnstnDocNo!, acntgSeCd!),
|
||||
enabled: Boolean(designCnstnDocNo && acntgSeCd),
|
||||
});
|
||||
@@ -143,8 +167,8 @@ export function useSaveDesignCnstnBizCst() {
|
||||
return useMutation({
|
||||
mutationFn: (body: DesignCnstnBizCstSaveRequestDto) => designCnstnBizCstService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizCstBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizCstKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -162,11 +186,11 @@ export function useUpdateDesignCnstnBizCst() {
|
||||
body: DesignCnstnBizCstUpdateRequestDto;
|
||||
}) => designCnstnBizCstService.update(designCnstnDocNo, acntgSeCd, body),
|
||||
onSuccess: (_data, { designCnstnDocNo, acntgSeCd }) => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizCstBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizCstKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnBizCstBaseKey, "findById", designCnstnDocNo, acntgSeCd],
|
||||
queryKey: designCnstnBizCstKeys.detail(designCnstnDocNo, acntgSeCd),
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -182,8 +206,8 @@ export function useDeleteDesignCnstnBizCst() {
|
||||
acntgSeCd: string;
|
||||
}) => designCnstnBizCstService.delete(designCnstnDocNo, acntgSeCd),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizCstBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizCstKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -192,7 +216,7 @@ export function useDeleteDesignCnstnBizCst() {
|
||||
|
||||
export function useDesignCnstnBizSclPage(params: DesignCnstnBizSclSearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...designCnstnBizSclBaseKey, "findPage", params],
|
||||
queryKey: [...designCnstnBizSclKeys.list(), params],
|
||||
queryFn: () => designCnstnBizSclService.findPage(params),
|
||||
});
|
||||
}
|
||||
@@ -202,7 +226,7 @@ export function useDesignCnstnBizScl(
|
||||
cnstpSeCd: string | null | undefined,
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: [...designCnstnBizSclBaseKey, "findById", designCnstnDocNo, cnstpSeCd],
|
||||
queryKey: designCnstnBizSclKeys.detail(designCnstnDocNo!, cnstpSeCd!),
|
||||
queryFn: () => designCnstnBizSclService.findById(designCnstnDocNo!, cnstpSeCd!),
|
||||
enabled: Boolean(designCnstnDocNo && cnstpSeCd),
|
||||
});
|
||||
@@ -213,8 +237,8 @@ export function useSaveDesignCnstnBizScl() {
|
||||
return useMutation({
|
||||
mutationFn: (body: DesignCnstnBizSclSaveRequestDto) => designCnstnBizSclService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizSclBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizSclKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -232,11 +256,11 @@ export function useUpdateDesignCnstnBizScl() {
|
||||
body: DesignCnstnBizSclUpdateRequestDto;
|
||||
}) => designCnstnBizSclService.update(designCnstnDocNo, cnstpSeCd, body),
|
||||
onSuccess: (_data, { designCnstnDocNo, cnstpSeCd }) => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizSclBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizSclKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnBizSclBaseKey, "findById", designCnstnDocNo, cnstpSeCd],
|
||||
queryKey: designCnstnBizSclKeys.detail(designCnstnDocNo, cnstpSeCd),
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -252,8 +276,8 @@ export function useDeleteDesignCnstnBizScl() {
|
||||
cnstpSeCd: string;
|
||||
}) => designCnstnBizSclService.delete(designCnstnDocNo, cnstpSeCd),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizSclBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnBizSclKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -262,7 +286,7 @@ export function useDeleteDesignCnstnBizScl() {
|
||||
|
||||
export function useDesignCnstnEsntlAtchFilePage(params: DesignCnstnEsntlAtchFileSearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...designCnstnEsntlAtchFileBaseKey, "findPage", params],
|
||||
queryKey: [...designCnstnEsntlAtchFileKeys.list(), params],
|
||||
queryFn: () => designCnstnEsntlAtchFileService.findPage(params),
|
||||
});
|
||||
}
|
||||
@@ -272,14 +296,8 @@ export function useDesignCnstnEsntlAtchFile(
|
||||
esntlAtchFileId: string | null | undefined,
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: [
|
||||
...designCnstnEsntlAtchFileBaseKey,
|
||||
"findById",
|
||||
designCnstnDocNo,
|
||||
esntlAtchFileId,
|
||||
],
|
||||
queryFn: () =>
|
||||
designCnstnEsntlAtchFileService.findById(designCnstnDocNo!, esntlAtchFileId!),
|
||||
queryKey: designCnstnEsntlAtchFileKeys.detail(designCnstnDocNo!, esntlAtchFileId!),
|
||||
queryFn: () => designCnstnEsntlAtchFileService.findById(designCnstnDocNo!, esntlAtchFileId!),
|
||||
enabled: Boolean(designCnstnDocNo && esntlAtchFileId),
|
||||
});
|
||||
}
|
||||
@@ -290,8 +308,8 @@ export function useSaveDesignCnstnEsntlAtchFile() {
|
||||
mutationFn: (body: DesignCnstnEsntlAtchFileSaveRequestDto) =>
|
||||
designCnstnEsntlAtchFileService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -309,16 +327,11 @@ export function useUpdateDesignCnstnEsntlAtchFile() {
|
||||
body: DesignCnstnEsntlAtchFileUpdateRequestDto;
|
||||
}) => designCnstnEsntlAtchFileService.update(designCnstnDocNo, esntlAtchFileId, body),
|
||||
onSuccess: (_data, { designCnstnDocNo, esntlAtchFileId }) => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [
|
||||
...designCnstnEsntlAtchFileBaseKey,
|
||||
"findById",
|
||||
designCnstnDocNo,
|
||||
esntlAtchFileId,
|
||||
],
|
||||
queryKey: designCnstnEsntlAtchFileKeys.detail(designCnstnDocNo, esntlAtchFileId),
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -334,8 +347,8 @@ export function useDeleteDesignCnstnEsntlAtchFile() {
|
||||
esntlAtchFileId: string;
|
||||
}) => designCnstnEsntlAtchFileService.delete(designCnstnDocNo, esntlAtchFileId),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -344,7 +357,7 @@ export function useDeleteDesignCnstnEsntlAtchFile() {
|
||||
|
||||
export function useDesignCnstnRvwOpnnPage(params: DesignCnstnRvwOpnnSearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...designCnstnRvwOpnnBaseKey, "findPage", params],
|
||||
queryKey: [...designCnstnRvwOpnnKeys.list(), params],
|
||||
queryFn: () => designCnstnRvwOpnnService.findPage(params),
|
||||
});
|
||||
}
|
||||
@@ -354,7 +367,7 @@ export function useDesignCnstnRvwOpnn(
|
||||
rvwOpnnSn: number | null | undefined,
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: [...designCnstnRvwOpnnBaseKey, "findById", designCnstnDocNo, rvwOpnnSn],
|
||||
queryKey: designCnstnRvwOpnnKeys.detail(designCnstnDocNo!, rvwOpnnSn!),
|
||||
queryFn: () => designCnstnRvwOpnnService.findById(designCnstnDocNo!, rvwOpnnSn!),
|
||||
enabled: Boolean(designCnstnDocNo && rvwOpnnSn != null),
|
||||
});
|
||||
@@ -365,8 +378,8 @@ export function useSaveDesignCnstnRvwOpnn() {
|
||||
return useMutation({
|
||||
mutationFn: (body: DesignCnstnRvwOpnnSaveRequestDto) => designCnstnRvwOpnnService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -384,11 +397,11 @@ export function useUpdateDesignCnstnRvwOpnn() {
|
||||
body: DesignCnstnRvwOpnnUpdateRequestDto;
|
||||
}) => designCnstnRvwOpnnService.update(designCnstnDocNo, rvwOpnnSn, body),
|
||||
onSuccess: (_data, { designCnstnDocNo, rvwOpnnSn }) => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnRvwOpnnBaseKey, "findById", designCnstnDocNo, rvwOpnnSn],
|
||||
queryKey: designCnstnRvwOpnnKeys.detail(designCnstnDocNo, rvwOpnnSn),
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -404,8 +417,8 @@ export function useDeleteDesignCnstnRvwOpnn() {
|
||||
rvwOpnnSn: number;
|
||||
}) => designCnstnRvwOpnnService.delete(designCnstnDocNo, rvwOpnnSn),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnKeys.all });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ export { designCnstnEsntlAtchFileService } from "./api/design-cnstn-esntl-atch-f
|
||||
export { designCnstnMngService } from "./api/design-cnstn-mng-service";
|
||||
export { designCnstnRvwOpnnService } from "./api/design-cnstn-rvw-opnn-service";
|
||||
export {
|
||||
designCnstnBizCstBaseKey,
|
||||
designCnstnBizSclBaseKey,
|
||||
designCnstnEsntlAtchFileBaseKey,
|
||||
designCnstnMngBaseKey,
|
||||
designCnstnRvwOpnnBaseKey,
|
||||
designCnstnBizCstKeys,
|
||||
designCnstnBizSclKeys,
|
||||
designCnstnEsntlAtchFileKeys,
|
||||
designCnstnKeys,
|
||||
designCnstnRvwOpnnKeys,
|
||||
useDeleteDesignCnstnBizCst,
|
||||
useDeleteDesignCnstnBizScl,
|
||||
useDeleteDesignCnstnEsntlAtchFile,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
DocPrgrsUpdateRequestDto,
|
||||
FnrsCnsltnApplySaveRequestDto,
|
||||
@@ -12,18 +10,22 @@ import type {
|
||||
|
||||
import { fnrsCnsltnMngService } from "./fnrs-cnsltn-service";
|
||||
|
||||
export const fnrsCnsltnMngBaseKey = [ENDPOINT.AS_SERVICE.FNRS_CNSLTN_MNG] as const;
|
||||
export const fnrsCnsltnKeys = {
|
||||
all: ["fnrs-cnsltn"] as const,
|
||||
list: () => [...fnrsCnsltnKeys.all, "list"] as const,
|
||||
detail: (id: string) => [...fnrsCnsltnKeys.all, "detail", id] as const,
|
||||
};
|
||||
|
||||
export function useFnrsCnsltnMngPage(params: FnrsCnsltnMngSearchDto) {
|
||||
return useQuery({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findPage", params],
|
||||
queryKey: [...fnrsCnsltnKeys.list(), params],
|
||||
queryFn: () => fnrsCnsltnMngService.findPage(params),
|
||||
});
|
||||
}
|
||||
|
||||
export function useFnrsCnsltnMng(fnrsCnsltnDocNo: string | null | undefined) {
|
||||
return useQuery({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", fnrsCnsltnDocNo],
|
||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo!),
|
||||
queryFn: () => fnrsCnsltnMngService.findById(fnrsCnsltnDocNo!),
|
||||
enabled: Boolean(fnrsCnsltnDocNo),
|
||||
});
|
||||
@@ -34,7 +36,7 @@ export function useSaveFnrsCnsltnMng() {
|
||||
return useMutation({
|
||||
mutationFn: (body: FnrsCnsltnMngSaveRequestDto) => fnrsCnsltnMngService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -44,7 +46,7 @@ export function useSaveApplyFnrsCnsltnMng() {
|
||||
return useMutation({
|
||||
mutationFn: (body: FnrsCnsltnApplySaveRequestDto) => fnrsCnsltnMngService.saveApply(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -60,9 +62,9 @@ export function useUpdateFnrsCnsltnMng() {
|
||||
body: FnrsCnsltnMngUpdateRequestDto;
|
||||
}) => fnrsCnsltnMngService.update(fnrsCnsltnDocNo, body),
|
||||
onSuccess: (_data, { fnrsCnsltnDocNo }) => {
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", fnrsCnsltnDocNo],
|
||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -74,9 +76,9 @@ export function useTechReviewFnrsCnsltnMng() {
|
||||
mutationFn: ({ id, body }: { id: string; body: FnrsCnsltnApplySaveRequestDto }) =>
|
||||
fnrsCnsltnMngService.techReview(id, body),
|
||||
onSuccess: (_data, { id }) => {
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", id],
|
||||
queryKey: fnrsCnsltnKeys.detail(id),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -88,9 +90,9 @@ export function useSubmitSupplementFnrsCnsltnMng() {
|
||||
mutationFn: ({ id, body }: { id: string; body: FnrsCnsltnApplySaveRequestDto }) =>
|
||||
fnrsCnsltnMngService.submitSupplement(id, body),
|
||||
onSuccess: (_data, { id }) => {
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", id],
|
||||
queryKey: fnrsCnsltnKeys.detail(id),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -102,9 +104,9 @@ export function useSubmitReqSupplementFnrsCnsltnMng() {
|
||||
mutationFn: ({ id, body }: { id: string; body: FnrsCnsltnApplySaveRequestDto }) =>
|
||||
fnrsCnsltnMngService.submitReqSupplement(id, body),
|
||||
onSuccess: (_data, { id }) => {
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", id],
|
||||
queryKey: fnrsCnsltnKeys.detail(id),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -115,7 +117,7 @@ export function useDeleteFnrsCnsltnMng() {
|
||||
return useMutation({
|
||||
mutationFn: (fnrsCnsltnDocNo: string) => fnrsCnsltnMngService.remove(fnrsCnsltnDocNo),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -125,7 +127,7 @@ export function useChangePrgrsSttsComCd() {
|
||||
return useMutation({
|
||||
mutationFn: (body: DocPrgrsUpdateRequestDto) => fnrsCnsltnMngService.changePrgrsSttsComCd(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export { fnrsCnsltnMngService } from "./api/fnrs-cnsltn-service";
|
||||
export { fnrsCnsltnMngBaseKey } from "./api/queries";
|
||||
export { fnrsCnsltnKeys } from "./api/queries";
|
||||
export {
|
||||
useChangePrgrsSttsComCd,
|
||||
useDeleteFnrsCnsltnMng,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
SewerBscPlanApplySaveRequestDto,
|
||||
SewerBscPlanSaveRequestDto,
|
||||
@@ -13,18 +11,26 @@ import type {
|
||||
|
||||
import { sewerBscPlanService } from "./sewer-bsc-plan-service";
|
||||
|
||||
export const sewerBscPlanBaseKey = [ENDPOINT.AS_SERVICE.SEWER_BSC_PLAN] as const;
|
||||
export const sewerBscPlanKeys = {
|
||||
all: ["sewer-bsc-plan"] as const,
|
||||
list: () => [...sewerBscPlanKeys.all, "list"] as const,
|
||||
detail: (id: string) => [...sewerBscPlanKeys.all, "detail", id] as const,
|
||||
details: (id: string, chgCycl?: number) =>
|
||||
chgCycl == null
|
||||
? ([...sewerBscPlanKeys.all, "details", id] as const)
|
||||
: ([...sewerBscPlanKeys.all, "details", id, chgCycl] as const),
|
||||
};
|
||||
|
||||
export function useSewerBscPlanPage(params: SewerBscPlanSearchRequestDto) {
|
||||
return useQuery({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findPage", params],
|
||||
queryKey: [...sewerBscPlanKeys.list(), params],
|
||||
queryFn: () => sewerBscPlanService.findPage(params),
|
||||
});
|
||||
}
|
||||
|
||||
export function useSewerBscPlan(sewerBscPlanDocNo: string | null | undefined) {
|
||||
return useQuery({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findById", sewerBscPlanDocNo],
|
||||
queryKey: sewerBscPlanKeys.detail(sewerBscPlanDocNo!),
|
||||
queryFn: () => sewerBscPlanService.findById(sewerBscPlanDocNo!),
|
||||
enabled: Boolean(sewerBscPlanDocNo),
|
||||
});
|
||||
@@ -35,7 +41,7 @@ export function useSewerBscPlanDetails(
|
||||
chgCycl: number | null | undefined,
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findDetails", sewerBscPlanDocNo, chgCycl],
|
||||
queryKey: sewerBscPlanKeys.details(sewerBscPlanDocNo!, chgCycl ?? undefined),
|
||||
queryFn: () => sewerBscPlanService.findDetails(sewerBscPlanDocNo!, chgCycl!),
|
||||
enabled: Boolean(sewerBscPlanDocNo) && chgCycl != null,
|
||||
});
|
||||
@@ -46,7 +52,7 @@ export function useSaveSewerBscPlan() {
|
||||
return useMutation({
|
||||
mutationFn: (body: SewerBscPlanSaveRequestDto) => sewerBscPlanService.save(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -62,9 +68,9 @@ export function useUpdateSewerBscPlan() {
|
||||
body: SewerBscPlanUpdateRequestDto;
|
||||
}) => sewerBscPlanService.update(sewerBscPlanDocNo, body),
|
||||
onSuccess: (_data, { sewerBscPlanDocNo }) => {
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findById", sewerBscPlanDocNo],
|
||||
queryKey: sewerBscPlanKeys.detail(sewerBscPlanDocNo),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -75,7 +81,7 @@ export function useDeleteSewerBscPlan() {
|
||||
return useMutation({
|
||||
mutationFn: (sewerBscPlanDocNo: string) => sewerBscPlanService.delete(sewerBscPlanDocNo),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -85,7 +91,7 @@ export function useSaveApplySewerBscPlan() {
|
||||
return useMutation({
|
||||
mutationFn: (body: SewerBscPlanApplySaveRequestDto) => sewerBscPlanService.saveApply(body),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -96,9 +102,9 @@ export function useSubmitSupplementSewerBscPlan() {
|
||||
mutationFn: ({ id, body }: { id: string; body: SewerBscPlanApplySaveRequestDto }) =>
|
||||
sewerBscPlanService.submitSupplement(id, body),
|
||||
onSuccess: (_data, { id }) => {
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findById", id],
|
||||
queryKey: sewerBscPlanKeys.detail(id),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -117,9 +123,9 @@ export function useSubmitReqSupplementSewerBscPlan() {
|
||||
body: SewerBscPlanApplySaveRequestDto;
|
||||
}) => sewerBscPlanService.submitReqSupplement(id, chgCycl, body),
|
||||
onSuccess: (_data, { id }) => {
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findById", id],
|
||||
queryKey: sewerBscPlanKeys.detail(id),
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -131,9 +137,9 @@ export function useTechReviewSewerBscPlan() {
|
||||
mutationFn: ({ id, body }: { id: string; body: SewerBscPlanApplySaveRequestDto }) =>
|
||||
sewerBscPlanService.techReview(id, body),
|
||||
onSuccess: (_data, { id }) => {
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findById", id],
|
||||
queryKey: sewerBscPlanKeys.detail(id),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export { sewerBscPlanBaseKey } from "./api/queries";
|
||||
export { sewerBscPlanKeys } from "./api/queries";
|
||||
export {
|
||||
useDeleteSewerBscPlan,
|
||||
useSaveApplySewerBscPlan,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import {
|
||||
type DesignCnstnApplySaveRequestDto,
|
||||
designCnstnMngBaseKey,
|
||||
designCnstnKeys,
|
||||
type DesignCnstnMngDetResponseDto,
|
||||
designCnstnMngService,
|
||||
} from "@/entities/design-cnstn";
|
||||
@@ -134,7 +134,7 @@ function FloatingActionButtons({
|
||||
onSuccess: () => {
|
||||
if (successMessage) alert(successMessage);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", designCnstnDocNo],
|
||||
queryKey: designCnstnKeys.detail(designCnstnDocNo),
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
@@ -168,7 +168,7 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "신청 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
}
|
||||
|
||||
async function handleDelClick() {
|
||||
@@ -306,7 +306,7 @@ function FloatingActionButtons({
|
||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||
onSuccess={() => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", designCnstnDocNo],
|
||||
queryKey: designCnstnKeys.detail(designCnstnDocNo),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -35,7 +35,7 @@ function DesignEditPage({ id }: DesignEditPageProps) {
|
||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
return <DesignFormPage id={id} mode="edit" initialData={data} />;
|
||||
return <DesignFormPage mode="edit" initialData={data} />;
|
||||
}
|
||||
|
||||
export { DesignEditPage };
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import {
|
||||
type DesignCnstnApplySaveRequestDto,
|
||||
designCnstnMngBaseKey,
|
||||
designCnstnKeys,
|
||||
type DesignCnstnMngDetResponseDto,
|
||||
designCnstnMngService,
|
||||
} from "@/entities/design-cnstn";
|
||||
@@ -37,7 +37,6 @@ import { PROGRESS_STATUS_COLUMNS } from "../model/columns";
|
||||
import { BasicInfoFormSection } from "./sections/basic-info-form-section";
|
||||
|
||||
interface DesignFormPageProps {
|
||||
id?: string;
|
||||
mode: "create" | "edit";
|
||||
initialData?: DesignCnstnMngDetResponseDto;
|
||||
createDefaults?: {
|
||||
@@ -48,7 +47,7 @@ interface DesignFormPageProps {
|
||||
};
|
||||
}
|
||||
|
||||
function DesignFormPage({ id, mode, initialData, createDefaults }: DesignFormPageProps) {
|
||||
function DesignFormPage({ mode, initialData, createDefaults }: DesignFormPageProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const router = useRouter();
|
||||
const { confirm } = useConfirm();
|
||||
@@ -102,12 +101,8 @@ function DesignFormPage({ id, mode, initialData, createDefaults }: DesignFormPag
|
||||
if (!designCnstnDocNo) return;
|
||||
|
||||
alert("저장되었습니다.");
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
router.push(`/design-cnstn/${designCnstnDocNo}/edit`);
|
||||
if (isEditMode && id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("저장 실패:", error);
|
||||
alert("저장 중 오류가 발생했습니다.");
|
||||
@@ -130,13 +125,8 @@ function DesignFormPage({ id, mode, initialData, createDefaults }: DesignFormPag
|
||||
if (!designCnstnDocNo) return;
|
||||
|
||||
alert("신청 완료되었습니다.");
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.all });
|
||||
router.push(`/design-cnstn/${designCnstnDocNo}`);
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
|
||||
if (id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...designCnstnMngBaseKey, "findById", id],
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("신청 실패:", error);
|
||||
alert("신청 중 오류가 발생했습니다.");
|
||||
@@ -164,6 +154,7 @@ function DesignFormPage({ id, mode, initialData, createDefaults }: DesignFormPag
|
||||
setIsSubmitting(true);
|
||||
await designCnstnMngService.delete(docNo);
|
||||
alert("삭제되었습니다.");
|
||||
queryClient.invalidateQueries({ queryKey: designCnstnKeys.list() });
|
||||
router.push("/design-cnstn");
|
||||
} catch (error) {
|
||||
console.error("삭제 실패:", error);
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
import {
|
||||
type DocPrgrsUpdateRequestDto,
|
||||
type FnrsCnsltnApplySaveRequestDto,
|
||||
fnrsCnsltnMngBaseKey,
|
||||
fnrsCnsltnKeys,
|
||||
type FnrsCnsltnMngDetResponseDto,
|
||||
fnrsCnsltnMngService,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
@@ -145,7 +145,7 @@ function FloatingActionButtons({
|
||||
onSuccess: () => {
|
||||
if (successMessage) alert(successMessage);
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", fnrsCnsltnDocNo],
|
||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
@@ -201,7 +201,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "신청 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleDelClick() {
|
||||
@@ -224,7 +223,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "고시되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleEnvoSbmsnClick() {
|
||||
@@ -238,7 +236,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "제출되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleRjctClick() {
|
||||
@@ -252,7 +249,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "반려되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleSncnAprvClick() {
|
||||
@@ -266,7 +262,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "인가승인되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
function getReviewOpinionFormData() {
|
||||
@@ -314,7 +309,6 @@ function FloatingActionButtons({
|
||||
request: payload,
|
||||
successMessage: "기술검토 의뢰가 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleElaprTmpltConfirm({ aplnRows }: ElaprTmpltPickerConfirmPayload) {
|
||||
@@ -512,7 +506,7 @@ function FloatingActionButtons({
|
||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||
onSuccess={() => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", fnrsCnsltnDocNo],
|
||||
queryKey: fnrsCnsltnKeys.detail(fnrsCnsltnDocNo),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -35,7 +35,7 @@ function FnrsEditPage({ id }: FnrsEditPageProps) {
|
||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
return <FnrsFormPage id={id} mode="edit" initialData={data} />;
|
||||
return <FnrsFormPage mode="edit" initialData={data} />;
|
||||
}
|
||||
|
||||
export { FnrsEditPage };
|
||||
|
||||
@@ -13,7 +13,7 @@ import { useAcntgSeMngTree } from "@/entities/acntg";
|
||||
import { useEsntlAtchFileMngTree } from "@/entities/esntl";
|
||||
import {
|
||||
type FnrsCnsltnApplySaveRequestDto,
|
||||
fnrsCnsltnMngBaseKey,
|
||||
fnrsCnsltnKeys,
|
||||
type FnrsCnsltnMngDetResponseDto,
|
||||
fnrsCnsltnMngService,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
@@ -48,7 +48,6 @@ import { PROGRESS_STATUS_COLUMNS } from "../model/columns";
|
||||
|
||||
import { BasicInfoFormSection } from "./sections/basic-info-form-section";
|
||||
interface FnrsFormPageProps {
|
||||
id?: string;
|
||||
mode: "create" | "edit";
|
||||
initialData?: FnrsCnsltnMngDetResponseDto;
|
||||
createDefaults?: {
|
||||
@@ -59,7 +58,7 @@ interface FnrsFormPageProps {
|
||||
};
|
||||
}
|
||||
|
||||
function FnrsFormPage({ id, mode, initialData, createDefaults }: FnrsFormPageProps) {
|
||||
function FnrsFormPage({ mode, initialData, createDefaults }: FnrsFormPageProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const router = useRouter();
|
||||
const { confirm } = useConfirm();
|
||||
@@ -172,10 +171,7 @@ function FnrsFormPage({ id, mode, initialData, createDefaults }: FnrsFormPagePro
|
||||
|
||||
alert("보완완료 처리되었습니다.");
|
||||
router.push(`/fnrs-cnsltn/${docNo}`);
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", docNo],
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("보완완료 실패:", error);
|
||||
alert("보완완료 처리 중 오류가 발생했습니다.");
|
||||
@@ -194,11 +190,7 @@ function FnrsFormPage({ id, mode, initialData, createDefaults }: FnrsFormPagePro
|
||||
|
||||
alert("저장되었습니다.");
|
||||
router.push(`/fnrs-cnsltn/${fnrsCnsltnDocNo}/edit`);
|
||||
if (isEditMode && id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", id],
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("저장 실패:", error);
|
||||
alert("저장 중 오류가 발생했습니다.");
|
||||
@@ -227,12 +219,7 @@ function FnrsFormPage({ id, mode, initialData, createDefaults }: FnrsFormPagePro
|
||||
|
||||
alert("신청 완료되었습니다.");
|
||||
router.push(`/fnrs-cnsltn/${fnrsCnsltnDocNo}`);
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
if (id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", id],
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("신청 실패:", error);
|
||||
alert("신청 중 오류가 발생했습니다.");
|
||||
|
||||
@@ -35,7 +35,7 @@ function InstlEditPage({ id }: InstlEditPageProps) {
|
||||
return <div className="mt-6 text-xl">수정 대상을 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
return <InstlFormPage id={id} mode="edit" initialData={data} />;
|
||||
return <InstlFormPage mode="edit" initialData={data} />;
|
||||
}
|
||||
|
||||
export { InstlEditPage };
|
||||
|
||||
@@ -40,7 +40,6 @@ import { PROGRESS_STATUS_COLUMNS } from "../model/columns";
|
||||
|
||||
import { BasicInfoFormSection } from "./sections/basic-info-form-section";
|
||||
interface InstlFormPageProps {
|
||||
id?: string;
|
||||
mode: "create" | "edit";
|
||||
initialData?: InstlSncnMngDetResponse;
|
||||
createDefaults?: {
|
||||
@@ -51,7 +50,7 @@ interface InstlFormPageProps {
|
||||
};
|
||||
}
|
||||
|
||||
function InstlFormPage({ id, mode, initialData, createDefaults }: InstlFormPageProps) {
|
||||
function InstlFormPage({ mode, initialData, createDefaults }: InstlFormPageProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const router = useRouter();
|
||||
const { confirm } = useConfirm();
|
||||
@@ -139,8 +138,7 @@ function InstlFormPage({ id, mode, initialData, createDefaults }: InstlFormPageP
|
||||
|
||||
alert("보완완료 처리되었습니다.");
|
||||
router.push(`/instl-sncn/${docNo}`);
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.list() });
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.detail(docNo) });
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("보완완료 실패:", error);
|
||||
alert("보완완료 처리 중 오류가 발생했습니다.");
|
||||
@@ -159,9 +157,7 @@ function InstlFormPage({ id, mode, initialData, createDefaults }: InstlFormPageP
|
||||
|
||||
alert("저장되었습니다.");
|
||||
router.push(`/instl-sncn/${instlSncnDocNo}/edit`);
|
||||
if (isEditMode && id) {
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.detail(id) });
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("저장 실패:", error);
|
||||
alert("저장 중 오류가 발생했습니다.");
|
||||
@@ -190,10 +186,7 @@ function InstlFormPage({ id, mode, initialData, createDefaults }: InstlFormPageP
|
||||
|
||||
alert("신청 완료되었습니다.");
|
||||
router.push(`/instl-sncn/${instlSncnDocNo}`);
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.list() });
|
||||
if (id) {
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.detail(id) });
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: instlSncnKeys.all });
|
||||
} catch (error) {
|
||||
console.error("신청 실패:", error);
|
||||
alert("신청 중 오류가 발생했습니다.");
|
||||
|
||||
@@ -22,8 +22,8 @@ import {
|
||||
import { instlSncnService } from "@/entities/instl-sncn";
|
||||
import {
|
||||
type SewerBscPlanApplySaveRequestDto,
|
||||
sewerBscPlanBaseKey,
|
||||
type SewerBscPlanDetResponseDto,
|
||||
sewerBscPlanKeys,
|
||||
sewerBscPlanService,
|
||||
} from "@/entities/sewer-bsc-plan";
|
||||
import { SplmntDmndDialog, type SplmntDmndDialogConfirmPayload } from "@/widgets/pbadms-sprt";
|
||||
@@ -127,13 +127,6 @@ function FloatingActionButtons({
|
||||
return actionButtons.some((button) => button === action);
|
||||
}
|
||||
|
||||
async function invalidateDetail() {
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findDetails", sewerBscPlanDocNo, chgCycl],
|
||||
});
|
||||
await queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
}
|
||||
|
||||
async function executeAction({
|
||||
action,
|
||||
request,
|
||||
@@ -156,7 +149,7 @@ function FloatingActionButtons({
|
||||
queryClient,
|
||||
onSuccess: () => {
|
||||
if (successMessage) alert(successMessage);
|
||||
void invalidateDetail();
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
},
|
||||
onError: (error) => {
|
||||
let errorMessage = "";
|
||||
@@ -428,7 +421,7 @@ function FloatingActionButtons({
|
||||
elaprDocNo={docNo}
|
||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||
onSuccess={() => {
|
||||
void invalidateDetail();
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
@@ -506,7 +499,7 @@ async function handleDmndSplmnt(
|
||||
context.chgCycl,
|
||||
context.request,
|
||||
);
|
||||
await context.queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
await context.queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
context.router.replace(`/sewer-bsc-plan/${result.sewerBscPlanDocNo}?chgCycl=${result.chgCycl}`);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
|
||||
@@ -13,8 +13,8 @@ import { useAcntgSeMngTree } from "@/entities/acntg";
|
||||
import { useEsntlAtchFileMngTree } from "@/entities/esntl";
|
||||
import {
|
||||
SewerBscPlanApplySaveResponseDto,
|
||||
sewerBscPlanBaseKey,
|
||||
type SewerBscPlanDetResponseDto,
|
||||
sewerBscPlanKeys,
|
||||
sewerBscPlanService,
|
||||
} from "@/entities/sewer-bsc-plan";
|
||||
import {
|
||||
@@ -123,11 +123,7 @@ function SewerBscPlanFormPage({
|
||||
|
||||
alert("저장되었습니다.");
|
||||
router.push(`/sewer-bsc-plan/${result.sewerBscPlanDocNo}/edit?chgCycl=${result.chgCycl}`);
|
||||
if (isEditMode && id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...sewerBscPlanBaseKey, "findDetails", id],
|
||||
});
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
} catch (error) {
|
||||
console.error("저장 실패:", error);
|
||||
alert("저장 중 오류가 발생했습니다.");
|
||||
@@ -166,7 +162,7 @@ function SewerBscPlanFormPage({
|
||||
|
||||
alert("신청 완료되었습니다.");
|
||||
router.push(`/sewer-bsc-plan/${result.sewerBscPlanDocNo}?chgCycl=${result.chgCycl ?? 1}`);
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
} catch (error) {
|
||||
console.error("신청 실패:", error);
|
||||
alert("신청 중 오류가 발생했습니다.");
|
||||
@@ -203,7 +199,7 @@ function SewerBscPlanFormPage({
|
||||
alert("보완완료 처리되었습니다.");
|
||||
const chgCycl = data.sewerBscPlanDtl.chgCycl ?? initialData?.detDto?.chgCycl ?? 1;
|
||||
router.push(`/sewer-bsc-plan/${docNo}?chgCycl=${chgCycl}`);
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanBaseKey });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.all });
|
||||
} catch (error) {
|
||||
console.error("보완완료 실패:", error);
|
||||
alert("보완완료 처리 중 오류가 발생했습니다.");
|
||||
@@ -232,7 +228,7 @@ function SewerBscPlanFormPage({
|
||||
await sewerBscPlanService.delete(docNo);
|
||||
alert("삭제되었습니다.");
|
||||
router.push("/sewer-bsc-plan");
|
||||
queryClient.invalidateQueries({ queryKey: [...sewerBscPlanBaseKey, "findPage"] });
|
||||
queryClient.invalidateQueries({ queryKey: sewerBscPlanKeys.list() });
|
||||
} catch (error) {
|
||||
console.error("삭제 실패:", error);
|
||||
alert("삭제 중 오류가 발생했습니다.");
|
||||
|
||||
Reference in New Issue
Block a user