diff --git a/src/components/modal/project/ModalProjectForm.tsx b/src/components/modal/project/ModalProjectForm.tsx index 8b47a655..aba2c8ca 100644 --- a/src/components/modal/project/ModalProjectForm.tsx +++ b/src/components/modal/project/ModalProjectForm.tsx @@ -5,10 +5,11 @@ import type { Project } from '@/types/ProjectType'; type ModalProjectFormProps = { formId: string; + projectId?: Project['projectId']; onSubmit: SubmitHandler; }; -export default function ModalProjectForm({ formId, onSubmit }: ModalProjectFormProps) { +export default function ModalProjectForm({ formId, projectId, onSubmit }: ModalProjectFormProps) { const { handleSubmit } = useForm(); return (
diff --git a/src/components/modal/team/ModalTeamForm.tsx b/src/components/modal/team/ModalTeamForm.tsx index 6407e39e..25d9f884 100644 --- a/src/components/modal/team/ModalTeamForm.tsx +++ b/src/components/modal/team/ModalTeamForm.tsx @@ -5,7 +5,7 @@ import type { Team } from '@/types/TeamType'; type ModalTeamFormProps = { formId: string; - teamId: Team['teamId']; + teamId?: Team['teamId']; onSubmit: SubmitHandler; }; diff --git a/src/components/task/kanban/TaskItemList.tsx b/src/components/task/kanban/TaskItemList.tsx index 56c93f87..43a9e4d4 100644 --- a/src/components/task/kanban/TaskItemList.tsx +++ b/src/components/task/kanban/TaskItemList.tsx @@ -23,9 +23,9 @@ export default function TaskItemList({ statusId, colorCode, tasks }: TaskItemLis {...taskDropProvided.droppableProps} > {tasks.map((task) => { - const { taskId, name, order } = task; + const { taskId, name, sortOrder } = task; const draggableId = generatePrefixId(taskId, DND_DRAGGABLE_PREFIX.TASK); - const index = order - 1; + const index = sortOrder - 1; return ; })} {taskDropProvided.placeholder} diff --git a/src/mocks/mockData.ts b/src/mocks/mockData.ts index 4b39cbce..3fdebbe0 100644 --- a/src/mocks/mockData.ts +++ b/src/mocks/mockData.ts @@ -460,8 +460,6 @@ export const PROJECT_DUMMY: Project[] = [ content: '상담용 챗봇을 만드는 프로젝트', startDate: null, endDate: null, - createAt: new Date('2023-11-01'), - updateAt: new Date('2023-11-01'), }, { projectId: 2, @@ -470,8 +468,6 @@ export const PROJECT_DUMMY: Project[] = [ content: '팀원을 모아 프로젝트를 진행하며, 진척도를 관리하는 프로젝트', startDate: new Date('2024-05-15 00:00:00'), endDate: new Date('2024-09-01 00:00:00'), - createAt: new Date('2024-05-15'), - updateAt: new Date('2024-05-15'), }, { projectId: 3, @@ -480,8 +476,6 @@ export const PROJECT_DUMMY: Project[] = [ content: '이벤트/모임을 등록하여 참여자를 모집하는 프로젝트', startDate: new Date('2023-06-05 00:00:00'), endDate: new Date('2023-09-12 00:00:00'), - createAt: new Date('2023-06-05'), - updateAt: new Date('2023-06-05'), }, ] as const; @@ -569,7 +563,7 @@ export const TASK_DUMMY: Task[] = [ name: 'task 상태 추가 모달 작업하기', sortOrder: 1, statusId: 6, - userId: 1, + userId: [1], content: '', files: [], startDate: '2024-06-22', @@ -580,7 +574,7 @@ export const TASK_DUMMY: Task[] = [ name: 'project layout 작성하기', sortOrder: 2, statusId: 6, - userId: 3, + userId: [3], content: '', files: [], startDate: '2024-06-18', @@ -591,7 +585,7 @@ export const TASK_DUMMY: Task[] = [ name: 'tailwindcss 설정하기', sortOrder: 3, statusId: 6, - userId: 9, + userId: [9], content: '', files: [], startDate: '2024-06-14', @@ -603,7 +597,7 @@ export const TASK_DUMMY: Task[] = [ name: 'API 명세서 작성하기', sortOrder: 2, statusId: 5, - userId: 1, + userId: [1], content: '', files: [], startDate: '2024-06-27', @@ -614,7 +608,7 @@ export const TASK_DUMMY: Task[] = [ name: 'DnD 기술 조사하기', sortOrder: 1, statusId: 5, - userId: 3, + userId: [3], content: `# AITalk\n## 주제\nDnD 기술 조사하기\n\n※\`DnD\`란 Drag and Drop의 약자다\n\n## 라이브러리 선정\n[react-beautiful-dnd](https://github.com/atlassian/react-beautiful-dnd) 등과 같이 다양한 라이브러리 중 어느 것을 선정할 것인가?`, files: [], startDate: '2024-06-27', @@ -626,7 +620,7 @@ export const TASK_DUMMY: Task[] = [ name: '할일 추가 모달 구현하기', sortOrder: 1, statusId: 4, - userId: 1, + userId: [1], content: '', files: [], startDate: '2024-06-26', @@ -637,7 +631,7 @@ export const TASK_DUMMY: Task[] = [ name: 'ID 찾기 페이지 작성하기', sortOrder: 2, statusId: 4, - userId: 3, + userId: [3], content: '', files: [], startDate: '2024-07-03', @@ -648,7 +642,7 @@ export const TASK_DUMMY: Task[] = [ name: 'DnD 구현하기', sortOrder: 3, statusId: 4, - userId: 9, + userId: [9], content: '', files: [], startDate: '2024-06-30', @@ -668,7 +662,8 @@ export const TASK_SPECIAL_DUMMY: TaskListWithStatus[] = [ taskId: 6, name: '할일 추가 모달 구현하기', sortOrder: 1, - userId: 1, + statusId: 1, + userId: [1], content: '', files: [], startDate: '2024-06-26', @@ -678,7 +673,8 @@ export const TASK_SPECIAL_DUMMY: TaskListWithStatus[] = [ taskId: 7, name: 'ID 찾기 페이지 작성하기', sortOrder: 2, - userId: 3, + statusId: 1, + userId: [3], content: '', files: [], startDate: '2024-07-03', @@ -688,7 +684,8 @@ export const TASK_SPECIAL_DUMMY: TaskListWithStatus[] = [ taskId: 8, name: 'DnD 구현하기', sortOrder: 3, - userId: 9, + statusId: 1, + userId: [9], content: '', files: [], startDate: '2024-06-30', @@ -706,7 +703,8 @@ export const TASK_SPECIAL_DUMMY: TaskListWithStatus[] = [ taskId: 5, name: 'DnD 기술 조사하기', sortOrder: 1, - userId: 3, + statusId: 2, + userId: [3], content: `# AITalk\n## 주제\nDnD 기술 조사하기\n\n※\`DnD\`란 Drag and Drop의 약자다\n\n## 라이브러리 선정\n[react-beautiful-dnd](https://github.com/atlassian/react-beautiful-dnd) 등과 같이 다양한 라이브러리 중 어느 것을 선정할 것인가?`, files: [], startDate: '2024-06-27', @@ -716,7 +714,8 @@ export const TASK_SPECIAL_DUMMY: TaskListWithStatus[] = [ taskId: 4, name: 'API 명세서 작성하기', sortOrder: 2, - userId: 1, + statusId: 2, + userId: [1], content: '', files: [], startDate: '2024-06-27', @@ -734,7 +733,8 @@ export const TASK_SPECIAL_DUMMY: TaskListWithStatus[] = [ taskId: 1, name: 'task 상태 추가 모달 작업하기', sortOrder: 1, - userId: 1, + statusId: 3, + userId: [1], content: '', files: [], startDate: '2024-06-22', @@ -744,7 +744,8 @@ export const TASK_SPECIAL_DUMMY: TaskListWithStatus[] = [ taskId: 2, name: 'project layout 작성하기', sortOrder: 2, - userId: 3, + statusId: 3, + userId: [3], content: '', files: [], startDate: '2024-06-18', @@ -754,7 +755,8 @@ export const TASK_SPECIAL_DUMMY: TaskListWithStatus[] = [ taskId: 3, name: 'tailwindcss 설정하기', sortOrder: 3, - userId: 9, + statusId: 3, + userId: [9], content: '', files: [], startDate: '2024-06-14', diff --git a/src/pages/project/CalendarPage.tsx b/src/pages/project/CalendarPage.tsx index eac90acb..3bae9fd2 100644 --- a/src/pages/project/CalendarPage.tsx +++ b/src/pages/project/CalendarPage.tsx @@ -18,9 +18,9 @@ function getCalendarTask(statusTasks: TaskListWithStatus[]) { const calendarTasks: TaskWithStatus[] = []; statusTasks.forEach((statusTask) => { - const { statusId, name: statusName, colorCode, sortOrder: statusOrder, tasks } = statusTask; + const { name: statusName, colorCode, sortOrder: statusOrder, tasks } = statusTask; tasks.forEach((task) => { - calendarTasks.push({ statusId, statusName, colorCode, statusOrder, ...task }); + calendarTasks.push({ statusName, colorCode, statusOrder, ...task }); }); }); diff --git a/src/pages/project/KanbanPage.tsx b/src/pages/project/KanbanPage.tsx index 2fc366f7..71d30a0e 100644 --- a/src/pages/project/KanbanPage.tsx +++ b/src/pages/project/KanbanPage.tsx @@ -13,10 +13,10 @@ function createChangedStatus(statusTasks: TaskListWithStatus[], dropResult: Drop if (!destination) throw Error('Error: DnD destination is null'); const newStatusTasks = deepClone(statusTasks); - const stausTask = newStatusTasks[source.index]; + const statusTask = newStatusTasks[source.index]; newStatusTasks.splice(source.index, 1); - newStatusTasks.splice(destination.index, 0, stausTask); + newStatusTasks.splice(destination.index, 0, statusTask); newStatusTasks.forEach((status, index) => (status.sortOrder = index + 1)); return newStatusTasks; diff --git a/src/types/ProjectStatusType.tsx b/src/types/ProjectStatusType.tsx index ce1c019d..b474723e 100644 --- a/src/types/ProjectStatusType.tsx +++ b/src/types/ProjectStatusType.tsx @@ -1,4 +1,3 @@ -// ToDo: API 설계 완료시 데이터 타입 변경할 것 export type ProjectStatus = { statusId: number; projectId: number; @@ -7,6 +6,6 @@ export type ProjectStatus = { sortOrder: number; }; -export type ProjectStatusForm = Pick; +export type ProjectStatusForm = Pick; export type UsableColor = Pick & { isUsable: boolean }; diff --git a/src/types/ProjectType.tsx b/src/types/ProjectType.tsx index bb2864a5..80d69f91 100644 --- a/src/types/ProjectType.tsx +++ b/src/types/ProjectType.tsx @@ -6,6 +6,4 @@ export type Project = { content: string; startDate: Date | null; endDate: Date | null; - createAt: Date; - updateAt: Date; }; diff --git a/src/types/TaskType.tsx b/src/types/TaskType.tsx index 39e69969..071b024e 100644 --- a/src/types/TaskType.tsx +++ b/src/types/TaskType.tsx @@ -9,12 +9,11 @@ type StatusKeyMapping = { sortOrder: 'statusOrder'; }; -// ToDo: API 설계 완료시 데이터 타입 변경할 것 export type Task = { taskId: number; - name: string; - userId: number; + userId: number[]; statusId: number; + name: string; content: string; startDate: string; endDate: string; @@ -22,15 +21,8 @@ export type Task = { sortOrder: number; }; -// ToDo: Task 추가 모달 작업시 같이 정의할 것 -export type TaskForm = { - name: string; - content: string; - userId: number[]; - startDate: string; - endDate: string; - statusId: number; -}; +export type TaskForm = Omit; + +export type TaskWithStatus = RenameKeys, StatusKeyMapping> & Task; -export type TaskWithStatus = RenameKeys, StatusKeyMapping> & Omit; -export type TaskListWithStatus = Omit & { tasks: Omit[] }; +export type TaskListWithStatus = Omit & { tasks: Task[] };