init
This commit is contained in:
27
app/infrastructure/db/sqlalchemy/models.py
Normal file
27
app/infrastructure/db/sqlalchemy/models.py
Normal file
@@ -0,0 +1,27 @@
|
||||
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
|
||||
)
|
||||
Reference in New Issue
Block a user