28 lines
776 B
Python
28 lines
776 B
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from uuid import uuid4
|
|
|
|
from sqlalchemy import Boolean, DateTime, String
|
|
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
|
|
|
|
|
class Base(DeclarativeBase):
|
|
pass
|
|
|
|
|
|
class UserModel(Base):
|
|
__tablename__ = "users"
|
|
|
|
id: Mapped[str] = mapped_column(
|
|
String(320), primary_key=True, default=lambda: str(uuid4())
|
|
)
|
|
full_name: Mapped[str] = mapped_column(String(200), nullable=False)
|
|
email: Mapped[str] = mapped_column(
|
|
String(320), unique=True, index=True, nullable=False
|
|
)
|
|
is_active: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), nullable=False
|
|
)
|