PhoenixKitProjects.Labels (PhoenixKitProjects v0.21.1)

Copy Markdown View Source

Per-project labels (Phase C): registry CRUD (managed in the project's Modules panel) + assignment tagging through the V7 join table. Rides the labels feature flag at the CALLER layer, like every context here.

Summary

Functions

Creates a label in a project.

Deletes a label (join rows cascade).

Label lists per assignment uuid for a displayed set (one query).

A project's labels, position-then-name ordered.

Replaces an assignment's labels with label_uuids — whitelisted to the ASSIGNMENT'S OWN project's registry (a cross-project label uuid is silently dropped, not an error: stale panel state must not block a save).

Functions

create(project, attrs, opts \\ [])

@spec create(map(), map(), keyword()) ::
  {:ok, PhoenixKitProjects.Schemas.Label.t()} | {:error, Ecto.Changeset.t()}

Creates a label in a project.

delete(label, opts \\ [])

@spec delete(
  PhoenixKitProjects.Schemas.Label.t(),
  keyword()
) :: :ok | {:error, term()}

Deletes a label (join rows cascade).

labels_for_assignments(uuids)

@spec labels_for_assignments([binary()]) :: %{
  required(binary()) => [PhoenixKitProjects.Schemas.Label.t()]
}

Label lists per assignment uuid for a displayed set (one query).

list_for_project(project_uuid)

@spec list_for_project(binary()) :: [PhoenixKitProjects.Schemas.Label.t()]

A project's labels, position-then-name ordered.

set_assignment_labels(assignment, label_uuids)

@spec set_assignment_labels(map(), [binary()]) :: :ok

Replaces an assignment's labels with label_uuids — whitelisted to the ASSIGNMENT'S OWN project's registry (a cross-project label uuid is silently dropped, not an error: stale panel state must not block a save).