Files
Todo-Project/backend/src/main.py
Hyungi Ahn 761757c12e Initial commit: Todo Project with dashboard, classification center, and upload functionality
- 📱 PWA 지원: 홈화면 추가 가능한 Progressive Web App
- 🎨 M-Project 색상 스키마: 하늘색, 주황색, 회색, 흰색 일관된 디자인
- 📊 대시보드: 데스크톱 캘린더 뷰 + 모바일 일일 뷰 반응형 디자인
- 📥 분류 센터: Gmail 스타일 받은편지함으로 스마트 분류 시스템
- 🤖 AI 분류 제안: 키워드 기반 자동 분류 제안 및 일괄 처리
- 📷 업로드 모달: 데스크톱(파일 선택) + 모바일(카메라/갤러리) 최적화
- 🏷️ 3가지 분류: Todo(시작일), 캘린더(마감일), 체크리스트(무기한)
- 📋 체크리스트: 진행률 표시 및 완료 토글 기능
- 🔄 시놀로지 연동 준비: 메일플러스 연동을 위한 구조 설계
- 📱 반응형 UI: 모든 페이지 모바일 최적화 완료
2025-09-19 08:52:49 +09:00

96 lines
2.4 KiB
Python

"""
Todo-Project 메인 애플리케이션
- 간결함 원칙: 애플리케이션 설정 및 라우터 등록만 담당
"""
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import logging
from .core.config import settings
from .api.routes import auth, todos, calendar
# 로깅 설정
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
logger = logging.getLogger(__name__)
# FastAPI 앱 생성
app = FastAPI(
title="Todo-Project API",
description="간결한 Todo 관리 시스템 with 캘린더 연동",
version="1.0.0",
docs_url="/docs",
redoc_url="/redoc"
)
# CORS 설정
app.add_middleware(
CORSMiddleware,
allow_origins=settings.ALLOWED_ORIGINS,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# 라우터 등록
app.include_router(auth.router, prefix="/api/auth", tags=["auth"])
app.include_router(todos.router, prefix="/api", tags=["todos"])
app.include_router(calendar.router, prefix="/api", tags=["calendar"])
@app.get("/")
async def root():
"""루트 엔드포인트"""
return {
"message": "Todo-Project API",
"version": "1.0.0",
"docs": "/docs"
}
@app.get("/health")
async def health_check():
"""헬스 체크"""
return {
"status": "healthy",
"service": "todo-project",
"version": "1.0.0"
}
# 애플리케이션 시작 시 실행
@app.on_event("startup")
async def startup_event():
"""애플리케이션 시작 시 초기화"""
logger.info("🚀 Todo-Project API 시작")
logger.info(f"📊 환경: {settings.ENVIRONMENT}")
logger.info(f"🔗 데이터베이스: {settings.DATABASE_URL}")
# 애플리케이션 종료 시 실행
@app.on_event("shutdown")
async def shutdown_event():
"""애플리케이션 종료 시 정리"""
logger.info("🛑 Todo-Project API 종료")
# 캘린더 서비스 연결 정리
try:
from .integrations.calendar import get_calendar_router
calendar_router = get_calendar_router()
await calendar_router.close_all()
logger.info("📅 캘린더 서비스 연결 정리 완료")
except Exception as e:
logger.error(f"캘린더 서비스 정리 중 오류: {e}")
if __name__ == "__main__":
import uvicorn
uvicorn.run(
"main:app",
host="0.0.0.0",
port=settings.PORT,
reload=settings.DEBUG
)