role.py 686 B

12345678910111213141516
  1. from uuid import uuid4
  2. from core_db import AuditMixin, Base, VersionMixin
  3. from sqlalchemy import JSON, String, Text
  4. from sqlalchemy.orm import Mapped, mapped_column
  5. class Role(Base, AuditMixin, VersionMixin):
  6. __tablename__ = "auth_role"
  7. id: Mapped[str] = mapped_column(String(36), primary_key=True, default=lambda: str(uuid4()))
  8. code: Mapped[str] = mapped_column(String(128), index=True)
  9. name: Mapped[str] = mapped_column(String(128))
  10. description: Mapped[str | None] = mapped_column(Text, nullable=True)
  11. status: Mapped[str] = mapped_column(String(32), default="active", index=True)
  12. permissions_json: Mapped[list[str]] = mapped_column(JSON, default=list)