Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /mdfarhankc_fastapi-fullauth /fastapi_fullauth /models /sqlalchemy /permission.py
| from uuid import UUID | |
| from sqlalchemy import ForeignKey, String, Uuid | |
| from sqlalchemy.orm import Mapped, mapped_column | |
| from uuid_utils import uuid7 | |
| class PermissionMixin: | |
| """Permission table. Combine with your DeclarativeBase: | |
| class Permission(PermissionMixin, Base): | |
| pass | |
| """ | |
| __tablename__ = "fullauth_permissions" | |
| id: Mapped[UUID] = mapped_column(Uuid, primary_key=True, default=uuid7) | |
| # String(200) + index mirrors the SQLModel mixin; an unbounded VARCHAR | |
| # unique key fails DDL on MySQL. | |
| name: Mapped[str] = mapped_column(String(200), unique=True, index=True, nullable=False) | |
| description: Mapped[str] = mapped_column(String(500), default="") | |
| class RolePermissionMixin: | |
| """Role-permission association. Combine with your DeclarativeBase: | |
| class RolePermission(RolePermissionMixin, Base): | |
| pass | |
| """ | |
| __tablename__ = "fullauth_role_permissions" | |
| role_id: Mapped[UUID] = mapped_column( | |
| Uuid, ForeignKey("fullauth_roles.id", ondelete="CASCADE"), primary_key=True | |
| ) | |
| permission_id: Mapped[UUID] = mapped_column( | |
| Uuid, ForeignKey("fullauth_permissions.id", ondelete="CASCADE"), primary_key=True | |
| ) | |
Xet Storage Details
- Size:
- 1.2 kB
- Xet hash:
- 3003697aaefbff2e38daa518858081867415a77791775ebec3b4b961a5b038c7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.