25 lines
817 B
Python
25 lines
817 B
Python
|
|
from sqlalchemy import String, Text, ForeignKey
|
||
|
|
from sqlalchemy.orm import Mapped, mapped_column, declared_attr
|
||
|
|
|
||
|
|
from .base import Base, bidirectional_relationship
|
||
|
|
from .status import StatusForeignKey
|
||
|
|
from .user import Versioned
|
||
|
|
|
||
|
|
|
||
|
|
class SapNamePool(StatusForeignKey, Versioned, Base):
|
||
|
|
"""SAP Printer Name Pool"""
|
||
|
|
|
||
|
|
code: Mapped[str] = mapped_column(String(12), primary_key=True, sort_order=-1000)
|
||
|
|
description: Mapped[str] = mapped_column(String(256))
|
||
|
|
notes: Mapped[str | None] = mapped_column(Text)
|
||
|
|
|
||
|
|
|
||
|
|
class SapNamePoolForeignKey:
|
||
|
|
"""Foreign Key Mixin for :py:class:`SapNamePool`"""
|
||
|
|
|
||
|
|
sap_name_pool_id: Mapped[str] = mapped_column(ForeignKey("sap_name_pool.id"))
|
||
|
|
|
||
|
|
@declared_attr
|
||
|
|
def sap_name_pool(cls) -> Mapped["SapNamePool"]:
|
||
|
|
return bidirectional_relationship(cls, SapNamePool)
|