feat: 오늘의 할일 완료 항목 표시 개선
- 오늘 마감 할일은 완료해도 취소선으로 표시하며 유지 - 날짜가 지난 할일만 필터링하여 숨김 - 미완료 항목을 먼저 표시하도록 정렬 순서 변경 - 백엔드와 Flutter Mock 데이터 로직 동기화
This commit is contained in:
@@ -36,18 +36,24 @@ router.get("/", async (req, res) => {
|
||||
|
||||
router.get("/today", async (req, res) => {
|
||||
try {
|
||||
const { start } = getDayRange();
|
||||
// Show incomplete todos that are:
|
||||
// 1. Due today or later (not overdue)
|
||||
// 2. Have no due date set
|
||||
const { start, end } = getDayRange();
|
||||
// Show todos that are:
|
||||
// 1. Due today (between start and end of today) - both completed and incomplete
|
||||
// 2. Due in the future (not yet due) - only incomplete
|
||||
// 3. Have no due date set - only incomplete
|
||||
// Filter out: overdue todos (due date before today)
|
||||
const todos = await Todo.find({
|
||||
completed: false,
|
||||
$or: [
|
||||
{ dueDate: { $gte: start } },
|
||||
{ dueDate: { $exists: false } },
|
||||
{ dueDate: null }
|
||||
// Today's todos (completed or not) - show with strikethrough if completed
|
||||
{ dueDate: { $gte: start, $lte: end } },
|
||||
// Future todos - only incomplete
|
||||
{ dueDate: { $gt: end }, completed: false },
|
||||
// No due date - only incomplete
|
||||
{ dueDate: { $exists: false }, completed: false },
|
||||
{ dueDate: null, completed: false }
|
||||
]
|
||||
}).sort({
|
||||
completed: 1, // Incomplete first
|
||||
dueDate: 1,
|
||||
createdAt: -1,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user