feat: 체크리스트 이미지 미리보기 기능 구현
- 체크리스트 섹션에 이미지 썸네일 미리보기 추가 (16x16) - 대시보드 상단 체크리스트 카드에 이미지 미리보기 기능 추가 - 이미지 클릭 시 전체 화면 모달로 확대 보기 - 백엔드 image_url 컬럼을 TEXT 타입으로 변경하여 Base64 이미지 지원 - 파일 업로드를 이미지만 지원하도록 단순화 (file_url, file_name 제거) - 422 validation 오류 해결 및 상세 로깅 추가 - 체크리스트 렌더링 누락 문제 해결
This commit is contained in:
@@ -2,12 +2,19 @@
|
||||
Todo-Project 메인 애플리케이션
|
||||
- 간결함 원칙: 애플리케이션 설정 및 라우터 등록만 담당
|
||||
"""
|
||||
from fastapi import FastAPI
|
||||
from fastapi import FastAPI, Request, HTTPException
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.exceptions import RequestValidationError
|
||||
from fastapi.responses import JSONResponse
|
||||
import logging
|
||||
|
||||
from .core.config import settings
|
||||
from .api.routes import auth, todos, calendar
|
||||
from .core.database import AsyncSessionLocal
|
||||
from .models.todo import Todo
|
||||
from .models.user import User
|
||||
from datetime import datetime, timedelta
|
||||
from sqlalchemy import select
|
||||
|
||||
# 로깅 설정
|
||||
logging.basicConfig(
|
||||
@@ -34,6 +41,19 @@ app.add_middleware(
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# Validation 오류 핸들러
|
||||
@app.exception_handler(RequestValidationError)
|
||||
async def validation_exception_handler(request: Request, exc: RequestValidationError):
|
||||
logger.error(f"Validation 오류 - URL: {request.url}")
|
||||
logger.error(f"Validation 오류 상세: {exc.errors()}")
|
||||
return JSONResponse(
|
||||
status_code=422,
|
||||
content={
|
||||
"detail": "요청 데이터 검증 실패",
|
||||
"errors": exc.errors()
|
||||
}
|
||||
)
|
||||
|
||||
# 라우터 등록
|
||||
app.include_router(auth.router, prefix="/api/auth", tags=["auth"])
|
||||
app.include_router(todos.router, prefix="/api", tags=["todos"])
|
||||
@@ -60,13 +80,26 @@ async def health_check():
|
||||
}
|
||||
|
||||
|
||||
# 애플리케이션 시작 시 실행
|
||||
async def create_sample_data():
|
||||
"""샘플 데이터 생성 - 비활성화됨"""
|
||||
# 더미 데이터 생성 완전히 비활성화
|
||||
logger.info("샘플 데이터 생성이 비활성화되었습니다.")
|
||||
return
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup_event():
|
||||
"""애플리케이션 시작 시 초기화"""
|
||||
logger.info("🚀 Todo-Project API 시작")
|
||||
logger.info(f"📊 환경: {settings.ENVIRONMENT}")
|
||||
logger.info(f"🔗 데이터베이스: {settings.DATABASE_URL}")
|
||||
|
||||
# 데이터베이스 초기화
|
||||
from .core.database import init_db
|
||||
await init_db()
|
||||
|
||||
# 샘플 데이터 생성 비활성화
|
||||
logger.info("샘플 데이터 생성이 비활성화되었습니다.")
|
||||
|
||||
|
||||
# 애플리케이션 종료 시 실행
|
||||
|
||||
Reference in New Issue
Block a user