feat: 할 일 완료 항목 정리 기능 추가

오래 쓴 라벨에 완료 항목이 계속 쌓여 카드가 길어지는 문제를 해소한다.

- 목록 상단에 '완료 항목 숨기기' 토글 — 화면에서만 걸러내고 데이터는 유지
- 라벨 메뉴에 '완료 항목 N개 삭제' — 확인 후 일괄 삭제(DELETE labels/:id/done-items)
- 완료 항목이 없으면 두 진입점 모두 노출하지 않는다
- 숨김 상태에서도 진행 집계는 전체 기준을 유지한다

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-21 23:08:50 +09:00
parent d110790385
commit 5303b2e92e
6 changed files with 89 additions and 2 deletions
@@ -84,6 +84,18 @@ export class TodoController {
return this.todoService.createFromTask(dto, user.id);
}
@Delete('labels/:id/done-items')
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: '라벨의 완료된 할 일 일괄 삭제' })
@ApiResponse({ status: 200, description: '삭제 성공' })
@ApiResponse({ status: 404, description: '라벨 없음 (RES_001)' })
clearDoneItems(
@CurrentUser() user: PublicUser,
@Param('id', ParseUUIDPipe) id: string,
): Promise<TodoLabelResponse> {
return this.todoService.clearDoneItems(id, user.id);
}
// ----- 항목 -----
@Post('labels/:labelId/items')
+11
View File
@@ -220,6 +220,17 @@ export class TodoService {
return this.findLabelOrThrow(label.id, ownerId);
}
// 라벨의 완료 항목 일괄 삭제 — 오래 쓴 라벨에 완료 항목이 쌓이는 것을 정리한다.
// 남길 항목이 없어도 라벨 자체는 유지한다(사용자가 명시적으로 지운 게 아니므로).
async clearDoneItems(
labelId: string,
ownerId: string,
): Promise<TodoLabelResponse> {
await this.assertLabelOwned(labelId, ownerId);
await this.itemRepo.delete({ label: { id: labelId }, done: true });
return this.findLabelOrThrow(labelId, ownerId);
}
// ----- 항목 -----
async createItem(