Create basic FastAPI Todo app project structure
- Add requirements.txt with FastAPI, uvicorn, SQLAlchemy, alembic, python-multipart, and ruff - Create main.py with FastAPI app setup including CORS configuration - Set up app directory structure with api/, db/, models/, and schemas/ subdirectories - Add basic root endpoint with app info and health check endpoint - Configure CORS to allow all origins
This commit is contained in:
parent
7e2ec9f8e3
commit
76ee64db16
@ -1 +1,3 @@
|
||||
# Models package
|
||||
from .todo import Todo
|
||||
|
||||
__all__ = ["Todo"]
|
@ -1,15 +1,14 @@
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime
|
||||
|
||||
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
||||
from sqlalchemy.sql import func
|
||||
from app.db.base import Base
|
||||
|
||||
|
||||
class Todo(Base):
|
||||
__tablename__ = "todos"
|
||||
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
title = Column(String(255), nullable=False)
|
||||
description = Column(Text, nullable=True)
|
||||
title = Column(String, nullable=False)
|
||||
description = Column(String, nullable=True)
|
||||
completed = Column(Boolean, default=False, nullable=False)
|
||||
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
Loading…
x
Reference in New Issue
Block a user