Skip to content

Commit

Permalink
refactor: 이력서 관리 페이지 msw (#291)
Browse files Browse the repository at this point in the history
* refactor: 불필요한 타입 중복 제거

* refactor: 이력서 리스트, 피드백 이력서 리스트 msw 작성

* fix: 이력서 포지션 타입 string으로 변경
  • Loading branch information
leeminhee119 authored May 15, 2024
1 parent fc0b7da commit a61220c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/molecules/ResumeListItem/ResumeListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Box, Flex, Text } from '@chakra-ui/react';
import { Label } from '~/components/atoms/Label';
import { MemoBox } from '~/components/molecules/MemoBox';
import { ResumeListItem } from '~/types/resume/resumeListItem';
import { MyResume } from '~/types/resume/resumeListItem';

type ResumeListItemProps = {
data: ResumeListItem;
data: MyResume;
};

const ResumeListItem = ({ data: { title, modifiedAt, position, memo } }: ResumeListItemProps) => {
Expand Down
29 changes: 29 additions & 0 deletions src/mocks/handlers/event/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,38 @@ import {
readEventMock3,
} from './event.mock';
import { environments } from '~/config/environments';
import { FeedbackResume } from '~/types/resume/resumeListItem';

const allEvents = new Map();
allEvents.set('0', readEventMock0);
allEvents.set('1', readEventMock1);
allEvents.set('2', readEventMock2);
allEvents.set('3', readEventMock3);

const eventResumesMock: FeedbackResume[] = [
{
resumeTitle: '이력서 버전4',
eventId: 0,
resumeId: 0,
status: 'COMPLETE',
title: '이번 봄은 취업하자! 웹 개발 이력서 봐드립니다.',
mentorName: '손웅정',
startDate: '2024-04-02T12:00:00.000Z',
endDate: '2024-05-02T12:00:00.000Z',
},
{
resumeTitle: 'FE 이력서 버전1',
eventId: 0,
resumeId: 0,
status: 'REJECT',
title: '백엔드 이력서 봐드립니다.',
mentorName: '손웅정',
startDate: '2024-03-02T12:00:00.000Z',
endDate: '2024-04-01T12:00:00.000Z',
rejectMessage: '직무를 잘못 보신 것 같아요! 백엔드만 첨삭합니다.',
},
];

export const handlers = [
http.get(`${environments.baseUrlEnv()}/v1/events`, () => {
return HttpResponse.json(eventListMock);
Expand All @@ -23,4 +48,8 @@ export const handlers = [
const event = allEvents.get(id);
return HttpResponse.json(event);
}),
// 이벤트 참여 이력서
http.get(`${environments.baseUrlEnv()}/v1/mentees/:menteeId/events`, () => {
return HttpResponse.json(eventResumesMock);
}),
];
29 changes: 29 additions & 0 deletions src/mocks/handlers/resume/resume.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
import { HttpResponse, http } from 'msw';
import { environments } from '~/config/environments';
import { MyResume } from '~/types/resume/resumeListItem';

const myResumesMock: MyResume[] = [
{
id: 0,
title: '이력서 버전1',
modifiedAt: '2024-02-25T23:59:59.999Z',
position: 'Front-End',
memo: '',
},
{
id: 0,
title: '이력서 버전2',
modifiedAt: '2024-03-01T23:59:59.999Z',
position: 'Front-End',
memo: '',
},
{
id: 0,
title: '최종 이력서',
modifiedAt: '2024-05-02T23:59:59.999Z',
position: 'Front-End',
memo: '아몬드빼빼로 서합한 이력서',
},
];

const referenceLinkMock = [
{
Expand All @@ -10,8 +35,12 @@ const referenceLinkMock = [
url: 'https://github.com/resumeme/Frontend',
},
];

const MOCK_RESUME_ID = 0;
export const handlers = [
http.get(`${environments.baseUrlEnv()}/v1/resumes`, () => {
return HttpResponse.json(myResumesMock);
}),
http.post(`${environments.baseUrlEnv()}/v1/resumes`, () => {
return HttpResponse.json({ id: MOCK_RESUME_ID });
}),
Expand Down
9 changes: 2 additions & 7 deletions src/types/resume/resumeListItem.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { ResumeStatus } from './status';
import { Position } from '../position';

export type ResumeListItem = {
export type MyResume = {
id: number;
title: string;
modifiedAt: string;
position: string;
memo: string;
};

export type MyResume = ResumeListItem & {
position: Position[];
position: string;
};

export type FeedbackResume = {
Expand Down

0 comments on commit a61220c

Please sign in to comment.