feat: 풀스택 할일관리 앱 구현 (통합 모달 + 간트차트)
- Backend: FastAPI + MongoDB + Redis (카테고리, 할일 CRUD, 파일 첨부, 검색, 대시보드) - Frontend: Next.js 15 + Tailwind + React Query + Zustand - 통합 TodoModal: 생성/수정 모달 통합, 탭 구조 (기본/태그와 첨부) - 간트차트: 카테고리별 할일 타임라인 시각화 - TodoCard: 제목/카테고리/우선순위/태그/첨부 한줄 표시 - Docker Compose 배포 (Frontend:3010, Backend:8010, MongoDB:27021, Redis:6391) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
29
backend/app/models/common.py
Normal file
29
backend/app/models/common.py
Normal file
@ -0,0 +1,29 @@
|
||||
from typing import Annotated, Any
|
||||
from bson import ObjectId
|
||||
from pydantic import BaseModel, BeforeValidator
|
||||
|
||||
|
||||
def validate_object_id(v: Any) -> str:
|
||||
"""ObjectId <-> str 변환을 위한 유효성 검증기"""
|
||||
if isinstance(v, ObjectId):
|
||||
return str(v)
|
||||
if isinstance(v, str) and ObjectId.is_valid(v):
|
||||
return v
|
||||
raise ValueError(f"Invalid ObjectId: {v}")
|
||||
|
||||
|
||||
PyObjectId = Annotated[str, BeforeValidator(validate_object_id)]
|
||||
|
||||
|
||||
class ErrorResponse(BaseModel):
|
||||
"""표준 에러 응답"""
|
||||
detail: str
|
||||
|
||||
|
||||
class PaginatedResponse(BaseModel):
|
||||
"""페이지네이션 응답 래퍼"""
|
||||
items: list[Any]
|
||||
total: int
|
||||
page: int
|
||||
limit: int
|
||||
total_pages: int
|
||||
Reference in New Issue
Block a user