feat(role): add role_code across schema and APIs
This commit is contained in:
@@ -10,10 +10,14 @@ from app.db.base import Base
|
||||
|
||||
class Role(Base):
|
||||
__tablename__ = "roles"
|
||||
__table_args__ = (UniqueConstraint("system_id", "name", name="uq_roles_system_name"),)
|
||||
__table_args__ = (
|
||||
UniqueConstraint("system_id", "name", name="uq_roles_system_name"),
|
||||
UniqueConstraint("system_id", "role_code", name="uq_roles_system_role_code"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(UUID(as_uuid=False), primary_key=True, default=lambda: str(uuid4()))
|
||||
role_key: Mapped[str] = mapped_column(String(128), unique=True, nullable=False, index=True)
|
||||
role_code: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
|
||||
system_id: Mapped[str] = mapped_column(UUID(as_uuid=False), ForeignKey("systems.id", ondelete="CASCADE"), nullable=False)
|
||||
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
description: Mapped[str | None] = mapped_column(String(1024))
|
||||
|
||||
Reference in New Issue
Block a user