Automated Action 10f64177dc Create REST API with FastAPI and SQLite
- Set up FastAPI application with CORS and authentication
- Implement user registration and login with JWT tokens
- Create SQLAlchemy models for users and items
- Add CRUD endpoints for item management
- Configure Alembic for database migrations
- Add health check endpoint
- Include comprehensive API documentation
- Set up proper project structure with routers and schemas
2025-07-17 16:54:25 +00:00

16 lines
658 B
Python

from sqlalchemy import Column, Integer, String, Text, ForeignKey, DateTime
from sqlalchemy.orm import relationship
from datetime import datetime
from app.db.base import Base
class Item(Base):
__tablename__ = "items"
id = Column(Integer, primary_key=True, index=True)
title = Column(String, index=True, nullable=False)
description = Column(Text, nullable=True)
owner_id = Column(Integer, ForeignKey("users.id"), nullable=False)
created_at = Column(DateTime, default=datetime.utcnow)
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
owner = relationship("User", back_populates="items")