Automated Action 48f0debd7b Implement user authentication flow with FastAPI
- Set up FastAPI application with SQLite database
- Create User model with email and password fields
- Implement JWT token-based authentication
- Add user registration and login endpoints
- Create protected user profile endpoints
- Configure Alembic for database migrations
- Add password hashing with bcrypt
- Include CORS middleware and health endpoint
- Update README with setup and usage instructions

Environment variables required:
- SECRET_KEY: JWT secret key for token signing
2025-06-27 09:18:50 +00:00

13 lines
546 B
Python

from sqlalchemy import Column, Integer, String, Boolean, DateTime
from sqlalchemy.sql import func
from app.db.base import Base
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True, nullable=False)
hashed_password = Column(String, nullable=False)
is_active = Column(Boolean, default=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())