inventory/inventory/models/brand.py
2025-09-05 16:15:50 -05:00

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)})>"