Skip to content

Commit 371b45b

Browse files
committed
refactor: 대시보드 지원자 목록 목업 데이터를 핸들러 로직과 분리
1 parent d5af885 commit 371b45b

File tree

2 files changed

+73
-52
lines changed

2 files changed

+73
-52
lines changed

src/app/mocks/handler/dashboard.ts

Lines changed: 18 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,23 @@
11
import { http, HttpResponse } from 'msw';
2-
import type {
3-
DashboardSummary,
4-
ApplicantsApiResponse,
5-
} from '@/pages/admin/Dashboard/types/dashboard';
2+
import { dashboardRepository } from '@/app/mocks/repositories/dashboard';
63

7-
export const dashboardHandlers = [
8-
// 대시보드 요약 정보
9-
http.get('/api/clubs/:clubId/dashboard', () => {
10-
const response: DashboardSummary = {
11-
totalApplicantCount: 45,
12-
pendingApplicationCount: 12,
13-
startDay: '2024-03-01',
14-
endDay: '2024-03-31',
15-
};
16-
17-
return HttpResponse.json(response, { status: 200 });
18-
}),
4+
const getDashboardSummaryResolver = () => {
5+
const summary = dashboardRepository.getDashboardSummary();
6+
return HttpResponse.json(summary, { status: 200 });
7+
};
198

20-
// 지원자 목록 (서류/면접)
21-
http.get('/api/clubs/:clubId/dashboard/applicants', () => {
22-
const response: ApplicantsApiResponse = {
23-
applicants: [
24-
{
25-
applicantId: 1,
26-
name: '김철수',
27-
studentId: '202401',
28-
department: '컴퓨터공학과',
29-
phoneNumber: '010-1234-5678',
30-
email: 'test1@example.com',
31-
status: 'PENDING',
32-
},
33-
{
34-
applicantId: 2,
35-
name: '이영희',
36-
studentId: '202402',
37-
department: '경영학과',
38-
phoneNumber: '010-2345-6789',
39-
email: 'test2@example.com',
40-
status: 'APPROVED',
41-
},
42-
{
43-
applicantId: 3,
44-
name: '박민수',
45-
studentId: '202403',
46-
department: '전자공학과',
47-
phoneNumber: '010-3456-7890',
48-
email: 'test3@example.com',
49-
status: 'REJECTED',
50-
},
51-
],
52-
message: null,
53-
};
9+
const getApplicantsResolver = () => {
10+
const applicants = dashboardRepository.getApplicants();
11+
return HttpResponse.json(applicants, { status: 200 });
12+
};
5413

55-
return HttpResponse.json(response, { status: 200 });
56-
}),
14+
export const dashboardHandlers = [
15+
http.get(
16+
import.meta.env.VITE_API_BASE_URL + '/clubs/:clubId/dashboard',
17+
getDashboardSummaryResolver,
18+
),
19+
http.get(
20+
import.meta.env.VITE_API_BASE_URL + '/clubs/:clubId/dashboard/applicants',
21+
getApplicantsResolver,
22+
),
5723
];
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import type {
2+
DashboardSummary,
3+
ApplicantsApiResponse,
4+
ApplicantData,
5+
} from '@/pages/admin/Dashboard/types/dashboard';
6+
7+
const MOCK_DASHBOARD_SUMMARY: DashboardSummary = {
8+
totalApplicantCount: 45,
9+
pendingApplicationCount: 12,
10+
startDay: '2024-03-01',
11+
endDay: '2024-03-31',
12+
};
13+
14+
const MOCK_APPLICANTS: ApplicantData[] = [
15+
{
16+
applicantId: 1,
17+
name: '김철수',
18+
studentId: '202401',
19+
department: '컴퓨터공학과',
20+
phoneNumber: '010-1234-5678',
21+
email: 'test1@example.com',
22+
status: 'PENDING',
23+
},
24+
{
25+
applicantId: 2,
26+
name: '이영희',
27+
studentId: '202402',
28+
department: '경영학과',
29+
phoneNumber: '010-2345-6789',
30+
email: 'test2@example.com',
31+
status: 'APPROVED',
32+
},
33+
{
34+
applicantId: 3,
35+
name: '박민수',
36+
studentId: '202403',
37+
department: '전자공학과',
38+
phoneNumber: '010-3456-7890',
39+
email: 'test3@example.com',
40+
status: 'REJECTED',
41+
},
42+
];
43+
44+
export const dashboardRepository = {
45+
getDashboardSummary: (): DashboardSummary => {
46+
return MOCK_DASHBOARD_SUMMARY;
47+
},
48+
49+
getApplicants: (): ApplicantsApiResponse => {
50+
return {
51+
applicants: MOCK_APPLICANTS,
52+
message: null,
53+
};
54+
},
55+
};

0 commit comments

Comments
 (0)