69 lines
2.0 KiB
TypeScript
69 lines
2.0 KiB
TypeScript
import { client } from "@/shared/api";
|
|
import { ENDPOINT } from "@/shared/config";
|
|
import type { PageResponse } from "@/shared/model";
|
|
|
|
import type {
|
|
EsntlAtchFileMng,
|
|
EsntlAtchFileMngSaveRequest,
|
|
EsntlAtchFileMngSearchParams,
|
|
EsntlAtchFileMngService,
|
|
EsntlAtchFileMngTreeResponseDto,
|
|
EsntlAtchFileMngTreeSearchParams,
|
|
} from "../model/esntl-interface";
|
|
|
|
async function findTree(
|
|
params: EsntlAtchFileMngTreeSearchParams,
|
|
): Promise<EsntlAtchFileMngTreeResponseDto[]> {
|
|
const response = await client.get<EsntlAtchFileMngTreeResponseDto[]>(
|
|
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/list/tree`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async function findPage(
|
|
params: EsntlAtchFileMngSearchParams,
|
|
): Promise<PageResponse<EsntlAtchFileMng>> {
|
|
const response = await client.get<PageResponse<EsntlAtchFileMng>>(
|
|
ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async function findById(esntlAtchFileId: string): Promise<EsntlAtchFileMng> {
|
|
const response = await client.get<EsntlAtchFileMng>(
|
|
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/${esntlAtchFileId}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async function create(body: EsntlAtchFileMngSaveRequest): Promise<string> {
|
|
const response = await client.post<string>(ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE, body);
|
|
return response.data;
|
|
}
|
|
|
|
async function update(esntlAtchFileId: string, body: EsntlAtchFileMngSaveRequest): Promise<string> {
|
|
const response = await client.put<string>(
|
|
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/${esntlAtchFileId}`,
|
|
body,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async function remove(esntlAtchFileId: string): Promise<string> {
|
|
const response = await client.delete<string>(
|
|
`${ENDPOINT.AS_COMMON_SERVICE.ESNTL_ATCH_FILE}/${esntlAtchFileId}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
export const esntlAtchFileMngService = {
|
|
findTree,
|
|
findPage,
|
|
findById,
|
|
create,
|
|
update,
|
|
remove,
|
|
} satisfies EsntlAtchFileMngService;
|