Merge remote-tracking branch 'origin/iipbs/as/dev' into iipbs/as/dev

This commit is contained in:
2026-05-21 13:13:36 +09:00
31 changed files with 1093 additions and 166 deletions
@@ -0,0 +1,70 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageResponse } from "@/shared/model";
import type {
CklstArtcl,
CklstArtclId,
CklstArtclSaveRequest,
CklstArtclSearchParams,
CklstArtclService,
CklstArtclUpdateRequest,
} from "../model/cklst-artcl-interface";
async function findPage(params: CklstArtclSearchParams): Promise<PageResponse<CklstArtcl>> {
const response = await client.get<PageResponse<CklstArtcl>>(
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL,
{ params },
);
return response.data;
}
async function findByCklstSn(cklstSn: number): Promise<CklstArtcl[]> {
const response = await client.get<CklstArtcl[]>(
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/by-cklst/${cklstSn}`,
);
return response.data;
}
async function findById(cklstArtclSn: number, cklstSn: number): Promise<CklstArtcl> {
const response = await client.get<CklstArtcl>(
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/${cklstArtclSn}/${cklstSn}`,
);
return response.data;
}
async function create(body: CklstArtclSaveRequest): Promise<CklstArtclId> {
const response = await client.post<CklstArtclId>(
ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL,
body,
);
return response.data;
}
async function update(
cklstArtclSn: number,
cklstSn: number,
body: CklstArtclUpdateRequest,
): Promise<CklstArtclId> {
const response = await client.put<CklstArtclId>(
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/${cklstArtclSn}/${cklstSn}`,
body,
);
return response.data;
}
async function remove(cklstArtclSn: number, cklstSn: number): Promise<CklstArtclId> {
const response = await client.delete<CklstArtclId>(
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL}/${cklstArtclSn}/${cklstSn}`,
);
return response.data;
}
export const cklstArtclService = {
findPage,
findByCklstSn,
findById,
create,
update,
remove,
} satisfies CklstArtclService;
@@ -0,0 +1,48 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageResponse } from "@/shared/model";
import type {
CklstMng,
CklstMngSaveRequest,
CklstMngSearchParams,
CklstMngService,
} from "../model/cklst-mng-interface";
async function findPage(params: CklstMngSearchParams): Promise<PageResponse<CklstMng>> {
const response = await client.get<PageResponse<CklstMng>>(ENDPOINT.AS_CHECKLIST_SERVICE.CKLST, {
params,
});
return response.data;
}
async function findById(cklstSn: number): Promise<CklstMng> {
const response = await client.get<CklstMng>(`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/${cklstSn}`);
return response.data;
}
async function create(body: CklstMngSaveRequest): Promise<number> {
const response = await client.post<number>(ENDPOINT.AS_CHECKLIST_SERVICE.CKLST, body);
return response.data;
}
async function update(cklstSn: number, body: CklstMngSaveRequest): Promise<number> {
const response = await client.put<number>(
`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/${cklstSn}`,
body,
);
return response.data;
}
async function remove(cklstSn: number): Promise<number> {
const response = await client.delete<number>(`${ENDPOINT.AS_CHECKLIST_SERVICE.CKLST}/${cklstSn}`);
return response.data;
}
export const cklstMngService = {
findPage,
findById,
create,
update,
remove,
} satisfies CklstMngService;
+167
View File
@@ -0,0 +1,167 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { ENDPOINT } from "@/shared/config";
import type {
CklstArtclSaveRequest,
CklstArtclSearchParams,
CklstArtclUpdateRequest,
} from "../model/cklst-artcl-interface";
import type { CklstMngSaveRequest, CklstMngSearchParams } from "../model/cklst-mng-interface";
import { cklstArtclService } from "./cklst-artcl-service";
import { cklstMngService } from "./cklst-mng-service";
const cklstMngBaseKey = [ENDPOINT.AS_CHECKLIST_SERVICE.CKLST] as const;
const cklstArtclBaseKey = [ENDPOINT.AS_CHECKLIST_SERVICE.CKLST_ARTCL] as const;
export function useCklstMngPage(params: CklstMngSearchParams) {
return useQuery({
queryKey: [...cklstMngBaseKey, "page", params],
queryFn: () => cklstMngService.findPage(params),
});
}
export function useCklstMng(cklstSn: number | null | undefined) {
return useQuery({
queryKey: [...cklstMngBaseKey, cklstSn],
queryFn: () => cklstMngService.findById(cklstSn!),
enabled: cklstSn != null,
});
}
export function useCreateCklstMng() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (body: CklstMngSaveRequest) => cklstMngService.create(body),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: cklstMngBaseKey });
},
});
}
export function useUpdateCklstMng() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({ cklstSn, body }: { cklstSn: number; body: CklstMngSaveRequest }) =>
cklstMngService.update(cklstSn, body),
onSuccess: (_data, { cklstSn }) => {
queryClient.invalidateQueries({ queryKey: cklstMngBaseKey });
queryClient.invalidateQueries({
queryKey: [...cklstMngBaseKey, cklstSn],
});
},
});
}
export function useDeleteCklstMng() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (cklstSn: number) => cklstMngService.remove(cklstSn),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: cklstMngBaseKey });
},
});
}
export function useCklstArtclPage(params: CklstArtclSearchParams) {
const { cklstSn } = params;
return useQuery({
queryKey: [...cklstArtclBaseKey, "page", params],
queryFn: () => cklstArtclService.findPage(params),
enabled: cklstSn != null,
});
}
export function useCklstArtclList(cklstSn: number | null | undefined) {
return useQuery({
queryKey: [...cklstArtclBaseKey, "by-cklst", cklstSn],
queryFn: () => cklstArtclService.findByCklstSn(cklstSn!),
enabled: cklstSn != null,
});
}
export function useCklstArtcl(params: {
cklstArtclSn: number | null | undefined;
cklstSn: number | null | undefined;
}) {
const { cklstArtclSn, cklstSn } = params;
return useQuery({
queryKey: [...cklstArtclBaseKey, cklstArtclSn, cklstSn],
queryFn: () => cklstArtclService.findById(cklstArtclSn!, cklstSn!),
enabled: cklstArtclSn != null && cklstSn != null,
});
}
export function useCreateCklstArtcl() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (body: CklstArtclSaveRequest) => cklstArtclService.create(body),
onSuccess: (_data, { cklstSn }) => {
queryClient.invalidateQueries({ queryKey: cklstArtclBaseKey });
queryClient.invalidateQueries({
queryKey: [...cklstArtclBaseKey, "page", { cklstSn }],
});
queryClient.invalidateQueries({
queryKey: [...cklstArtclBaseKey, "by-cklst", cklstSn],
});
},
});
}
export function useUpdateCklstArtcl() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
cklstArtclSn,
cklstSn,
body,
}: {
cklstArtclSn: number;
cklstSn: number;
body: CklstArtclUpdateRequest;
}) => cklstArtclService.update(cklstArtclSn, cklstSn, body),
onSuccess: (_data, { cklstArtclSn, cklstSn }) => {
queryClient.invalidateQueries({ queryKey: cklstArtclBaseKey });
queryClient.invalidateQueries({
queryKey: [...cklstArtclBaseKey, cklstArtclSn, cklstSn],
});
queryClient.invalidateQueries({
queryKey: [...cklstArtclBaseKey, "page", { cklstSn }],
});
queryClient.invalidateQueries({
queryKey: [...cklstArtclBaseKey, "by-cklst", cklstSn],
});
},
});
}
export function useDeleteCklstArtcl() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
cklstArtclSn,
cklstSn,
}: {
cklstArtclSn: number;
cklstSn: number;
}) => cklstArtclService.remove(cklstArtclSn, cklstSn),
onSuccess: (_data, { cklstSn }) => {
queryClient.invalidateQueries({ queryKey: cklstArtclBaseKey });
queryClient.invalidateQueries({
queryKey: [...cklstArtclBaseKey, "page", { cklstSn }],
});
queryClient.invalidateQueries({
queryKey: [...cklstArtclBaseKey, "by-cklst", cklstSn],
});
},
});
}
+29
View File
@@ -0,0 +1,29 @@
export { cklstArtclService } from "./api/cklst-artcl-service";
export { cklstMngService } from "./api/cklst-mng-service";
export {
useCklstArtcl,
useCklstArtclList,
useCklstArtclPage,
useCklstMng,
useCklstMngPage,
useCreateCklstArtcl,
useCreateCklstMng,
useDeleteCklstArtcl,
useDeleteCklstMng,
useUpdateCklstArtcl,
useUpdateCklstMng,
} from "./api/queries";
export type {
CklstArtcl,
CklstArtclId,
CklstArtclSaveRequest,
CklstArtclSearchParams,
CklstArtclService,
CklstArtclUpdateRequest,
} from "./model/cklst-artcl-interface";
export type {
CklstMng,
CklstMngSaveRequest,
CklstMngSearchParams,
CklstMngService,
} from "./model/cklst-mng-interface";
@@ -0,0 +1,48 @@
import type { PageableParams, PageResponse } from "@/shared/model";
export interface CklstArtclId {
cklstArtclSn: number;
cklstSn: number;
}
export interface CklstArtcl {
cklstArtclSn: number;
cklstSn: number;
cklstArtclNm?: string;
useYn?: "Y" | "N";
rgtr?: string;
rgtrNm?: string;
mdfr?: string;
regDt?: string;
mdfcnDt?: string;
}
export interface CklstArtclSearchParams extends PageableParams {
cklstSn?: number;
cklstArtclNm?: string;
useYn?: "Y" | "N";
}
export interface CklstArtclSaveRequest {
cklstSn: number;
cklstArtclNm?: string;
useYn?: "Y" | "N";
}
export interface CklstArtclUpdateRequest {
cklstArtclNm?: string;
useYn?: "Y" | "N";
}
export interface CklstArtclService {
findPage(params: CklstArtclSearchParams): Promise<PageResponse<CklstArtcl>>;
findByCklstSn(cklstSn: number): Promise<CklstArtcl[]>;
findById(cklstArtclSn: number, cklstSn: number): Promise<CklstArtcl>;
create(body: CklstArtclSaveRequest): Promise<CklstArtclId>;
update(
cklstArtclSn: number,
cklstSn: number,
body: CklstArtclUpdateRequest,
): Promise<CklstArtclId>;
remove(cklstArtclSn: number, cklstSn: number): Promise<CklstArtclId>;
}
@@ -0,0 +1,36 @@
import type { PageableParams, PageResponse } from "@/shared/model";
export interface CklstMng {
cklstSn: number;
cklstNm: string;
taskSeComCd: string;
useYn?: "Y" | "N";
docSeComCd?: string;
rgtr?: string;
rgtrNm?: string;
mdfr?: string;
regDt?: string;
mdfcnDt?: string;
}
export interface CklstMngSearchParams extends PageableParams {
cklstNm?: string;
taskSeComCd?: string;
useYn?: "Y" | "N";
docSeComCd?: string;
}
export interface CklstMngSaveRequest {
cklstNm: string;
taskSeComCd: string;
useYn?: "Y" | "N";
docSeComCd?: string;
}
export interface CklstMngService {
findPage(params: CklstMngSearchParams): Promise<PageResponse<CklstMng>>;
findById(cklstSn: number): Promise<CklstMng>;
create(body: CklstMngSaveRequest): Promise<number>;
update(cklstSn: number, body: CklstMngSaveRequest): Promise<number>;
remove(cklstSn: number): Promise<number>;
}
@@ -1,4 +1,4 @@
import { client } from "@/shared/api/client";
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { Code, CodeService } from "../model/code-interface";
@@ -9,9 +9,7 @@ async function getList(upCd: string): Promise<Code[]> {
}
async function getListByUseYn(upCd: string, useYn: string): Promise<Code[]> {
const response = await client.get<Code[]>(
`${ENDPOINT.CMS_SERVICE.CODE}/${upCd}/${useYn}`,
);
const response = await client.get<Code[]>(`${ENDPOINT.CMS_SERVICE.CODE}/${upCd}/${useYn}`);
return response.data;
}
@@ -1,4 +1,4 @@
import { client } from "@/shared/api/client";
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageResponse } from "@/shared/model";
@@ -11,17 +11,14 @@ import type {
} from "../model/elapr-apln-interface";
async function findPage(params: ElaprAplnListParams): Promise<PageResponse<ElaprApln>> {
const response = await client.get<PageResponse<ElaprApln>>(
ENDPOINT.AS_ELAPR_SERVICE.ELAPR_APLN,
{ params },
);
const response = await client.get<PageResponse<ElaprApln>>(ENDPOINT.AS_ELAPR_SERVICE.ELAPR_APLN, {
params,
});
return response.data;
}
async function findById(aplnId: string): Promise<ElaprApln> {
const response = await client.get<ElaprApln>(
`${ENDPOINT.AS_ELAPR_SERVICE.ELAPR_APLN}/${aplnId}`,
);
const response = await client.get<ElaprApln>(`${ENDPOINT.AS_ELAPR_SERVICE.ELAPR_APLN}/${aplnId}`);
return response.data;
}
@@ -1,4 +1,4 @@
import { client } from "@/shared/api/client";
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageResponse } from "@/shared/model";
@@ -26,17 +26,11 @@ async function findById(elaprTmpltId: string): Promise<ElaprTmplt> {
}
async function create(body: ElaprTmpltSaveRequest): Promise<ElaprTmplt> {
const response = await client.post<ElaprTmplt>(
ENDPOINT.AS_ELAPR_SERVICE.ELAPR_TMPLT,
body,
);
const response = await client.post<ElaprTmplt>(ENDPOINT.AS_ELAPR_SERVICE.ELAPR_TMPLT, body);
return response.data;
}
async function update(
elaprTmpltId: string,
body: ElaprTmpltUpdateRequest,
): Promise<ElaprTmplt> {
async function update(elaprTmpltId: string, body: ElaprTmpltUpdateRequest): Promise<ElaprTmplt> {
const response = await client.put<ElaprTmplt>(
`${ENDPOINT.AS_ELAPR_SERVICE.ELAPR_TMPLT}/${elaprTmpltId}`,
body,