|
1 | 1 | 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'; |
6 | 3 |
|
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 | +}; |
19 | 8 |
|
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 | +}; |
54 | 13 |
|
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 | + ), |
57 | 23 | ]; |
0 commit comments