feat: 그룹 인터페이스 및 서비스 생성
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type {
|
||||
GroupService,
|
||||
GroupSearchParams,
|
||||
GroupList,
|
||||
GroupDetailResponse,
|
||||
GroupSaveData,
|
||||
GroupUpdateData,
|
||||
} from "../model/groups-interface";
|
||||
|
||||
export class GroupsApiService implements GroupService {
|
||||
// 그룹 목록 조회
|
||||
public async findPageGroup(params: GroupSearchParams): Promise<GroupList> {
|
||||
const response = await client.get<GroupList>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUPS}`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// 그룹 단건 조회
|
||||
public async findById(id: number): Promise<GroupDetailResponse> {
|
||||
const response = await client.get<GroupDetailResponse>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUPS}/${id}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// 그룹 저장
|
||||
public async saveGroup(data: GroupSaveData): Promise<GroupDetailResponse> {
|
||||
const response = await client.post<GroupDetailResponse>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUPS}`,
|
||||
data,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// 그룹 수정
|
||||
public async updateGroup(
|
||||
id: number,
|
||||
data: GroupUpdateData,
|
||||
): Promise<GroupDetailResponse> {
|
||||
const response = await client.put<GroupDetailResponse>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUPS}/${id}`,
|
||||
data,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
// 그룹 삭제
|
||||
public async deleteGroup(id: number): Promise<boolean> {
|
||||
const response = await client.delete<boolean>(
|
||||
`${ENDPOINT.CMS_SERVICE.GROUPS}/${id}`,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user