Skip to content

angee.tags.schema

GraphQL schema contributions for Angee tags.

Exposed on the admin console. :class:Tag gets ordinary CRUD; the polymorphic :class:TagAssignment edge is not an ordinary resource insert, so it is written through the authored tag / untag mutations and read through the authored tag_assignments query — all thin dispatchers into :class:~angee.tags.models.TagAssignmentManager, which owns the edge protocol: target and tags resolve under the calling actor (nobody tags a row they cannot read), and only the gate-less edge insert/delete elevates. The mutations are additionally gated on the tags_admin role.

TagsAdminPermission

python
class TagsAdminPermission(RolePermission)

Allow actors who reach the tags_admin role.

Platform admins (angee/role:admin) are implicit members through the role's member union in permissions.zed.

TagType

python
@strawberry_django.type(Tag)
class TagType(AngeeNode)

Admin projection of one tag in the vocabulary.

TagAssignmentType

python
@strawberry_django.type(TagAssignment)
class TagAssignmentType(AngeeNode)

Admin projection of one polymorphic tag edge, with its target addressed publicly.

target_type

python
@strawberry_django.field(only=["content_type_id", "object_id"])
def target_type() -> str

Return the target row's REBAC resource type (e.g. parties/party).

target_id

python
@strawberry_django.field(only=["content_type_id", "object_id"])
def target_id() -> PublicID

Return the target row's public id.

TagQuery

python
@strawberry.type
class TagQuery()

Reads for a target row's tag assignments.

tag_assignments

python
@strawberry.field(name="tag_assignments")
def tag_assignments(target_type: str,
                    target_id: PublicID) -> list[TagAssignmentType]

Return the tag assignments on one target row, REBAC-scoped by tag reach.

TagMutation

python
@strawberry.type
class TagMutation()

Authored writes for the polymorphic tag edge (not an ordinary resource insert).

tag

python
@strawberry.mutation(name="tag", permission_classes=_TAGS_ADMIN_CLASSES)
def tag(target_type: str, target_id: PublicID,
        tag_ids: list[PublicID]) -> list[TagAssignmentType]

Attach each tag in tag_ids to the target row (idempotent per edge).

untag

python
@strawberry.mutation(name="untag", permission_classes=_TAGS_ADMIN_CLASSES)
def untag(target_type: str, target_id: PublicID,
          tag_ids: list[PublicID]) -> bool

Detach each tag in tag_ids from the target row.

Released under the AGPL-3.0 License.