PhoenixKitStaff.Teams (PhoenixKitStaff v0.2.0)

Copy Markdown View Source

CRUD for teams.

Summary

Functions

Returns a changeset for the given team.

Total number of teams.

Inserts a team and broadcasts :team_created.

Deletes a team and broadcasts :team_deleted.

Fetches a team by uuid, or nil if not found.

Fetches a team by uuid. Raises if not found.

Lists teams. Accepts :preload and :department_uuid to filter by department.

Updates a team and broadcasts :team_updated.

Functions

change(team, attrs \\ %{})

Returns a changeset for the given team.

count()

@spec count() :: non_neg_integer()

Total number of teams.

create(attrs)

Inserts a team and broadcasts :team_created.

delete(team)

Deletes a team and broadcasts :team_deleted.

get(uuid, opts \\ [])

@spec get(
  UUIDv7.t() | String.t(),
  keyword()
) :: PhoenixKitStaff.Schemas.Team.t() | nil

Fetches a team by uuid, or nil if not found.

get!(uuid, opts \\ [])

Fetches a team by uuid. Raises if not found.

list(opts \\ [])

Lists teams. Accepts :preload and :department_uuid to filter by department.

update(team, attrs)

Updates a team and broadcasts :team_updated.