gitignore

This commit is contained in:
2024-03-11 18:07:01 +00:00
parent 83bea97f41
commit fb7e64f738
22 changed files with 114 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
from .base import Base
from .user import User
from .base_model import Base
from .user_model import UserModel
__all__ = (
"Base",
"User",
"UserModel",
)

View File

@@ -5,6 +5,8 @@ from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
class Base(DeclarativeBase):
__abstract__ = True
id: Mapped[uuid.UUID] = mapped_column(
UUID(as_uuid=True),
primary_key=True,

View File

@@ -1,12 +1,12 @@
from sqlalchemy import Boolean, Column, String
from sqlalchemy.orm import Mapped
from api.schemas.user_schema import UserSchema
from api.schemas import UserReadDTO
from .base import Base
from . import Base
class User(Base):
class UserModel(Base):
__tablename__ = "users"
name: Mapped[str]
@@ -22,8 +22,8 @@ class User(Base):
f"is_active={self.is_active})>"
)
def to_read_model(self) -> UserSchema:
return UserSchema(
def to_read_model(self) -> UserReadDTO:
return UserReadDTO(
id=self.id,
name=self.name,
)