Skip to content

Commit ccc1902

Browse files
authored
[Deploy] 멘토용 스터디 목록 조회 (2.0.4) (#137)
* fix: 스터디 신청 기간 날짜 겹치지 않도록 수정 (#134) * [Fix] 스터디 목록 조회를 멘토용 조회 API로 수정해요. (#136) * fix: 스터디 목록 조회 멘토용으로 수정 * fix: 사용하지 않는 DTO 제거 * chore: unuse 변수 제거 * fix: 코드리뷰 반영
1 parent 1bfe772 commit ccc1902

File tree

7 files changed

+22
-30
lines changed

7 files changed

+22
-30
lines changed

apps/admin/apis/auth/dashboardApi.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { fetcher } from "@wow-class/utils";
2-
import { apiPath, mentorApiPath } from "constants/apiPath";
2+
import { apiPath } from "constants/apiPath";
33
import { tags } from "constants/tags";
44
import type { DashboardApiResponseDto } from "types/dtos/auth";
5-
import type { MyStudyListApiResponseDto } from "types/dtos/studyList";
65

76
export const dashboardApi = {
87
getDashboardInfo: async () => {
@@ -19,14 +18,4 @@ export const dashboardApi = {
1918

2019
return { studyRole, manageRole };
2120
},
22-
getMyStudyList: async () => {
23-
const response = await fetcher.get<MyStudyListApiResponseDto[]>(
24-
mentorApiPath.studyList,
25-
{
26-
next: { tags: [tags.dashboard] },
27-
cache: "force-cache",
28-
}
29-
);
30-
return response.data;
31-
},
3221
};

apps/admin/apis/study/studyApi.ts

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ export const studyApi = {
2424

2525
return response.data;
2626
},
27+
getMyStudyList: async () => {
28+
const response = await fetcher.get<StudyListApiResponseDto[]>(
29+
mentorApiPath.studyList,
30+
{
31+
next: { tags: [tags.myStudyList] },
32+
cache: "force-cache",
33+
}
34+
);
35+
return response.data;
36+
},
2737
getStudyBasicInfo: async (studyId: number) => {
2838
const response = await fetcher.get<StudyBasicInfoApiResponseDto>(
2939
`/common/studies/${studyId}`,

apps/admin/app/studies/_components/StudyList.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import { css } from "@styled-system/css";
22
import { studyApi } from "apis/study/studyApi";
3+
import isAdmin from "utils/isAdmin";
34

45
import EmptyStudyList from "./EmptyStudyList";
56
import StudyListItem from "./StudyListItem";
67

78
const StudyList = async () => {
8-
const studyList = await studyApi.getStudyList();
9+
const adminStatus = await isAdmin();
10+
const studyList = adminStatus
11+
? await studyApi.getStudyList()
12+
: await studyApi.getMyStudyList();
913

1014
if (studyList?.length === 0) {
1115
return <EmptyStudyList />;

apps/admin/app/studies/create-study/@modal/(.)created-study-check/page.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const CreatedStudyCheckModal = () => {
3131

3232
if (result.success) {
3333
await revalidateTagByName(tags.studyList);
34+
await revalidateTagByName(tags.myStudyList);
3435
window.alert("스터디 생성에 성공했어요.");
3536
router.push(`${routerPath.root.href}`);
3637
} else {

apps/admin/components/Navbar.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { css } from "@styled-system/css";
22
import { NavItem } from "@wow-class/ui";
3-
import { dashboardApi } from "apis/auth/dashboardApi";
43
import { studyApi } from "apis/study/studyApi";
54
import { clientUrl } from "constants/url";
65
import Image from "next/image";
@@ -18,9 +17,10 @@ import participantImageUrl from "../public/images/particpant.svg";
1817
*/
1918

2019
const Navbar = async () => {
21-
const studyList = (await isAdmin())
20+
const adminStatus = await isAdmin();
21+
const studyList = adminStatus
2222
? await studyApi.getStudyList()
23-
: await dashboardApi.getMyStudyList();
23+
: await studyApi.getMyStudyList();
2424

2525
const navMenu = [
2626
{

apps/admin/constants/tags.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export const enum tags {
33
assignments = "assignments",
44
curriculums = "curriculums",
55
studyList = "studyList",
6+
myStudyList = "myStudyList",
67
studyBasicInfo = "studyBasicInfo",
78
announcements = "announcements",
89
memberList = "memberList",

apps/admin/types/dtos/studyList.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import type { DayOfWeekType } from "types/entities/dayofweek";
2-
import type {
3-
StudyKoreanType,
4-
StudySemesterType,
5-
StudyType,
6-
} from "types/entities/study";
2+
import type { StudyKoreanType, StudySemesterType } from "types/entities/study";
73
import type { TimeType } from "types/entities/time";
84

95
export interface StudyListApiResponseDto {
@@ -20,12 +16,3 @@ export interface StudyListApiResponseDto {
2016
totalWeek: number;
2117
openingDate: string;
2218
}
23-
24-
export interface MyStudyListApiResponseDto {
25-
studyId: number;
26-
semester: string;
27-
title: string;
28-
studyType: StudyType;
29-
notionLink: string;
30-
mentorName: string;
31-
}

0 commit comments

Comments
 (0)