19 lines
667 B
Python
19 lines
667 B
Python
from typing import List
|
|
|
|
from sqlalchemy import Boolean, Unicode
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from sqlalchemy.sql import expression as sql
|
|
|
|
from crudkit.core.base import Base, CRUDMixin
|
|
|
|
class Brand(Base, CRUDMixin):
|
|
__tablename__ = "brand"
|
|
|
|
name: Mapped[str] = mapped_column(Unicode(255), nullable=False, index=True)
|
|
|
|
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='brand')
|
|
|
|
is_deleted: Mapped[Boolean] = mapped_column(Boolean, nullable=False, default=False, server_default=sql.false())
|
|
|
|
def __repr__(self) -> str:
|
|
return f"<Brand(id={self.id}, name={repr(self.name)})>"
|