Skip to content

Commit

Permalink
fix: 누락된 studyInfoApi 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hamo-o committed Aug 27, 2024
1 parent b311b42 commit c72181a
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions apps/admin/apis/study/studyInfoApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { fetcher } from "@wow-class/utils";
import { mentorApiPath } from "constants/apiPath";
import { tags } from "constants/tags";
import type { AnnouncementApiResponseDto } from "types/dtos/announcement";
import type { AssignmentApiResponseDto } from "types/dtos/assignmentList";
import type { SessionApiResponseDto } from "types/dtos/sessionList";
import type { StudyBasicInfoApiResponseDto } from "types/dtos/studyBasicInfo";
import type { StudyAnnouncementType } from "types/entities/study";

export const studyInfoApi = {
getStudyBasicInfo: async (studyId: number) => {
const response = await fetcher.get<StudyBasicInfoApiResponseDto>(
`/common/studies/${studyId}`,
{
next: { tags: [tags.studyBasicInfo] },
cache: "force-cache",
}
);
return response.data;
},
getAssignmentList: async (studyId: number) => {
const response = await fetcher.get<AssignmentApiResponseDto[]>(
`${mentorApiPath.assignments}?studyId=${studyId}`,
{
next: { tags: [tags.assignments] },
cache: "force-cache",
}
);
return response.data;
},
cancelAssignment: async (studyDetailId: number) => {
const response = await fetcher.patch(
`/mentor/study-details/${studyDetailId}/assignments/cancel`,
{}
);

return { success: response.ok };
},
getSessionList: async (studyId: number) => {
const response = await fetcher.get<SessionApiResponseDto[]>(
`${mentorApiPath.sessions}?study=${studyId}`,
{
next: { tags: [tags.sessions] },
cache: "force-cache",
}
);
return response.data;
},
publishStudyAnnouncement: async (
studyId: number,
announcement: StudyAnnouncementType
) => {
const response = await fetcher.post(
`/mentor/studies/${studyId}/announcements`,
announcement
);
return { success: response.ok };
},
getStudyAnnouncement: async (studyId: number) => {
const response = await fetcher.get<AnnouncementApiResponseDto[]>(
`/common/studies/${studyId}/announcements`,
{
next: { tags: [tags.announcements] },
cache: "force-cache",
}
);
return response.data;
},
modifyStudyAnnouncement: async (
studyAnnouncementId: number,
announcement: StudyAnnouncementType
) => {
const response = await fetcher.put(
`/mentor/studies/announcements/${studyAnnouncementId}`,
announcement
);
return { success: response.ok };
},
deleteStudyAnnouncement: async (studyAnnouncementId: number) => {
const response = await fetcher.delete(
`/mentor/studies/announcements/${studyAnnouncementId}`
);
return { success: response.ok };
},
};

0 comments on commit c72181a

Please sign in to comment.