-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from JNU-econovation/revert-105-main
Revert "[FE/FEAT] API 요청 구현"
- Loading branch information
Showing
15 changed files
with
181 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { sortMembers } from "../utils/sort"; | ||
import { | ||
attendStatus, | ||
getAllMembersResponse, | ||
getMembersByStatusResponse, | ||
updateMembersRequest, | ||
updateMembersResponse, | ||
} from "./types/member"; | ||
import { https } from "."; | ||
import API from "@/src/constants/API"; | ||
|
||
export const getAllMembers = async (programId: string) => { | ||
const { data } = await https<getAllMembersResponse>({ | ||
url: API.MEMBER.GET_ALL_MEMBERS + `/${programId}`, | ||
method: "GET", | ||
}); | ||
|
||
return sortMembers(data.data); | ||
}; | ||
|
||
export const getMembersByStatus = async ( | ||
programId: number, | ||
attendStatus: attendStatus, | ||
) => { | ||
const { data } = await https<getMembersByStatusResponse>({ | ||
url: API.MEMBER.GET_MEMBER_LIST_BY_STATUS(programId), | ||
method: "GET", | ||
params: { attendStatus }, | ||
}); | ||
|
||
return data.data; | ||
}; | ||
|
||
export const updateMembers = async ( | ||
programId: string, | ||
body: updateMembersRequest, | ||
) => { | ||
const { data } = await https<updateMembersResponse>({ | ||
url: API.MEMBER.UPDATE_ATTENDSTATUS + `/${programId}`, | ||
method: "POST", | ||
data: body, | ||
}); | ||
return data.data; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,53 @@ | ||
/** | ||
* 프로그램 정보 조회 | ||
*/ | ||
|
||
import { AttendStatus } from "../types/member"; | ||
import { | ||
ProgramCategory, | ||
ProgramInfo, | ||
ProgramListInfo, | ||
ProgramStatus, | ||
} from "../types/program"; | ||
createProgramRequest, | ||
createProgramResponse, | ||
getProgramDetailResponse, | ||
getProgramListResponse, | ||
updateProgramRequest, | ||
} from "./types/program"; | ||
import { https } from "."; | ||
import API from "@/src/constants/API"; | ||
|
||
interface GetProgramByIdResponse { | ||
data: ProgramInfo; | ||
} | ||
|
||
export const getProgramById = async (programId: string) => { | ||
const { data } = await https<GetProgramByIdResponse>({ | ||
url: `programs/${programId}`, | ||
export const createProgram = async (body: createProgramRequest) => { | ||
const { data } = await https<createProgramResponse>({ | ||
url: API.PROGRAM, | ||
method: "POST", | ||
data: body, | ||
}); | ||
return data.data; | ||
}; | ||
|
||
/** | ||
* 프로그램 리스트 조회 | ||
*/ | ||
export const updateProgram = async ( | ||
programId: string, | ||
body: updateProgramRequest, | ||
) => { | ||
const { data } = await https({ | ||
url: API.PROGRAM + `/${programId}`, | ||
method: "PUT", | ||
data: body, | ||
}); | ||
return data.data; | ||
}; | ||
|
||
interface GetProgramListResponse { | ||
data: ProgramListInfo[]; | ||
} | ||
export const getProgramList = async ( | ||
category: ProgramCategory, | ||
programStatus: ProgramStatus, | ||
programStatus: string, | ||
size: number, | ||
page: number, | ||
) => { | ||
const { data } = await https<GetProgramListResponse>({ | ||
url: "programs", | ||
const { data } = await https<getProgramListResponse>({ | ||
url: API.PROGRAM, | ||
method: "GET", | ||
params: { | ||
category, | ||
programStatus, | ||
size, | ||
page, | ||
}, | ||
params: { programStatus, size, page }, | ||
}); | ||
return data.data; | ||
}; | ||
|
||
/** | ||
* 프로그램 삭제 | ||
*/ | ||
|
||
export const deleteProgram = async (programId: string) => { | ||
const { data } = await https({ | ||
url: `programs/${programId}`, | ||
method: "DELETE", | ||
}); | ||
return data.data; | ||
}; | ||
|
||
/** | ||
* 프로그램 생성 및 대상자 선정 | ||
*/ | ||
|
||
interface PostProgramRequest extends Omit<ProgramInfo, "programId"> { | ||
members: { memberId: string }[]; | ||
} | ||
|
||
export const postProgram = async (body: PostProgramRequest) => { | ||
const { data } = await https({ | ||
url: "programs", | ||
method: "POST", | ||
data: body, | ||
export const getProgramDetail = async (programId: string) => { | ||
const { data } = await https<getProgramDetailResponse>({ | ||
url: API.PROGRAM + `/${programId}`, | ||
method: "GET", | ||
}); | ||
return data.data; | ||
}; | ||
|
||
/** | ||
* 프로그램 수정 및 참여 대상자/참여 상태 수정 | ||
*/ | ||
|
||
interface PatchProgramRequest extends Omit<ProgramInfo, "programId"> { | ||
members: { | ||
memberId: string; | ||
beforeAttendStatus: AttendStatus; | ||
afterAttendStatus: AttendStatus; | ||
}[]; | ||
} | ||
|
||
export const patchProgram = async ( | ||
programId: string, | ||
body: PatchProgramRequest, | ||
) => { | ||
const { data } = await https({ | ||
url: `programs/${programId}`, | ||
method: "PATCH", | ||
data: body, | ||
}); | ||
return data.data; | ||
}; |
Oops, something went wrong.