
- Created user model with SQLAlchemy ORM - Implemented authentication with JWT tokens (access and refresh tokens) - Added password hashing with bcrypt - Created API endpoints for registration, login, and user management - Set up Alembic for database migrations - Added health check endpoint - Created role-based access control (standard users and superusers) - Added comprehensive documentation
15 lines
558 B
Python
15 lines
558 B
Python
from sqlalchemy import Boolean, Column, String
|
|
|
|
from app.db.base import Base
|
|
from app.db.base_model import BaseModel
|
|
|
|
|
|
class User(Base, BaseModel):
|
|
"""User model for authentication"""
|
|
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
username = Column(String, unique=True, index=True, nullable=False)
|
|
hashed_password = Column(String, nullable=False)
|
|
full_name = Column(String, nullable=True)
|
|
is_active = Column(Boolean, default=True, nullable=False)
|
|
is_superuser = Column(Boolean, default=False, nullable=False) |