diff --git a/src/dtos/task.dto.js b/src/dtos/task.dto.js index 6354aa8..92bb042 100644 --- a/src/dtos/task.dto.js +++ b/src/dtos/task.dto.js @@ -7,7 +7,7 @@ export const createTaskRequestDTO = (data) => { status: "PENDING", subTasks: (data.subTasks || []).map(st => ({ title: st.title, - endDate: new Date(st.deadline) + endDate: st.endDate ? new Date(st.endDate) : new Date() })), references: data.references || [] }; @@ -21,7 +21,7 @@ export const updateTaskRequestDTO = (data) => { type: data.type === "팀" ? "TEAM" : (data.type === "개인" ? "PERSONAL" : undefined), subTasks: (data.subTasks || []).map(st => ({ title: st.title, - endDate: new Date(st.deadline), + endDate: st.endDate ? new Date(st.endDate) : new Date(), status: st.status || "PENDING" })), references: data.references || [] @@ -89,7 +89,7 @@ export const taskListResponseDTO = (tasks) => { type: task.type === "TEAM" ? "TEAM" : "INDIVIDUAL", deadline: task.deadline.toISOString().split('T')[0].replace(/-/g, '.'), dDay: dDay, - progressRate: task.progressRate // 서비스에서 계산된 값 사용 + progressRate: task.progress // 서비스에서 계산된 값 사용 }; }); }; diff --git a/src/repositories/task.repository.js b/src/repositories/task.repository.js index 3335e5d..490b064 100644 --- a/src/repositories/task.repository.js +++ b/src/repositories/task.repository.js @@ -62,7 +62,13 @@ class TaskRepository { async findAllTasks({ userId, type, folderId, sort }) { console.log("userid:", userId); const query = { - where: {}, + where: { + members: { + some: { + userId: userId + } + } + }, include: { folder: true, subTasks: true, @@ -98,7 +104,7 @@ class TaskRepository { if (!sort || sort === 'PRIORITY') { return processedTasks.sort((a, b) => a.myRank - b.myRank); - } else if (sort === 'PROGRASSRATE') { + } else if (sort === 'PROGRESSRATE') { return processedTasks.sort((a, b) => b.progress - a.progress); }