Simple Task Management API
개요
사용자가 할 일을 등록하고 관리할 수 있는 간단한 API를 설계하세요.
요구사항
할 일(Task) 관리
새로운 할 일 생성
할 일 목록 조회
특정 할 일 상세 조회
할 일 수정 (제목, 내용, 상태 변경)
할 일 삭제
할 일 상태
TODO
,IN_PROGRESS
,DONE
중 하나의 상태를 가짐기본값은
TODO
1. 엔드포인트 설계
새로운 할 일 생성(POST) - /tasks
할 일 목록 조회(GET) - /tasks?page={page}&size={size}
특정 할 일 상세 조회 (GET)- /tasks/{taskId}
할 일 수정 (제목, 내용, 상태 변경) (PATCH) - /tasks/{taskId}
할 일 삭제(DELETE) - /tasks/{taskId}
2. 요청/응답 설계
새로운 할 일 생성(POST) - /tasks
Req
POST /tasks
Content-type: application/json
{
"title": "task1",
"description": "description1"
}
Res
HTTP/1.1 201 Created
Content-type: application/json
{
"taskId": 1,
"title": "task1",
"description": "description1"
"status": "TODO"
"createdAt": "2025-03-19",
"modifiedAt": "2025-03-19"
}
할 일 목록 조회(GET) - /tasks?page={page}&size={size}
Req
GET /tasks?page=1&size=10
Res
HTTP/1.1 200 OK
Content-type: application/json
[
"totalTasks": 25,
"totalPages": 3,
"currentPage": 1,
"pageSize": 10,
"tasks":
{
"taskId": 1,
"title": "task1",
"description": "description1",
"status": "TODO"
"createdAt": "2025-03-19",
"modifiedAt": "2025-03-19"
},...
]
특정 할 일 상세 조회 (GET)- /tasks/{taskId}
Req GET /tasks/1 Res (success) HTTP/1.1 200 OK Content-type: application/json { "taskId": 1, "title": "task1", "description": "description1" "status": "TODO" "createdAt": "2025-03-19", "modifiedAt": "2025-03-19" } Res (fail) HTTP/1.1 404 Not Found Content-type: application/json { "message": "cannot find task" }
할 일 수정 (제목, 내용, 상태 변경) (PATCH) - /tasks/{taskId}
Req PATCH /tasks/1 Content-type: application/json { "title": "task2", "description": "description2", "status": "IN_PROGRESS" } Res (success) HTTP/1.1 200 OK Content-type: application/json { "taskId": 1, "title": "task2", "description": "description2" "status": "IN_PROGRESS" "createdAt": "2025-03-19", "modifiedAt": "2025-03-20" } Res (fail) HTTP/1.1 404 Not Found Content-type: application/json { "message": "cannot find task" }
할 일 삭제(DELETE) - /tasks/{taskId}
Req DELETE /tasks/1 Res (success) HTTP/1.1 204 No content Res (fail) HTTP/1.1 404 Not Found Content-type: application/json { "message": "cannot find task" }
3. DB 스키마 설계
user
id. BIGINT, PK. 유저 id
task
id. BIGINT, PK. 할일 id
user_id. BIGINT, FK, 유저 id
title. VARCHAR(255). 제목
description. TEXT. 설명
status. VARCHAR(255), Enum("TODO", "IN_PROGRESS", "DONE"). 상태
created_at. DATETIME. 생성일
modified_at. DATETIME. 수정일
4. 아키텍처 설계
API 서버(Spring Boot)
사용자 요청 처리
DB와 Redis 캐시 연동
데이터베이스 (MySQL)
사용자, 작업 정보 저장
캐시 서버 (Redis)
GET /tasks/{taskId}
와 같이 특정 작업 조회 API에 대해서만 캐싱 적용.
Last updated