PhoenixKitProjects.Schemas.Task (PhoenixKitProjects v0.2.1)

Copy Markdown View Source

Reusable task template with title, description, estimated duration, and optional default assignee.

Summary

Types

t()

JSONB map of secondary-language overrides for translatable fields. Same shape as Project.translations_map — primary stays in the dedicated columns, this map only carries non-primary overrides.

Functions

Same fallback semantics as localized_title/2 — for description.

Returns the task's title in the requested language, falling back to the primary title column when the language has no override (or the override is empty/nil).

Converts a duration to hours under a given calendar mode.

DB-column field names that participate in the translations JSONB.

Types

t()

@type t() :: %PhoenixKitProjects.Schemas.Task{
  __meta__: term(),
  default_assigned_department:
    PhoenixKitStaff.Schemas.Department.t()
    | Ecto.Association.NotLoaded.t()
    | nil,
  default_assigned_department_uuid: UUIDv7.t() | nil,
  default_assigned_person:
    PhoenixKitStaff.Schemas.Person.t() | Ecto.Association.NotLoaded.t() | nil,
  default_assigned_person_uuid: UUIDv7.t() | nil,
  default_assigned_team:
    PhoenixKitStaff.Schemas.Team.t() | Ecto.Association.NotLoaded.t() | nil,
  default_assigned_team_uuid: UUIDv7.t() | nil,
  description: String.t() | nil,
  estimated_duration: integer() | nil,
  estimated_duration_unit: String.t() | nil,
  inserted_at: DateTime.t() | nil,
  position: integer() | nil,
  title: String.t() | nil,
  translations: translations_map(),
  updated_at: DateTime.t() | nil,
  uuid: UUIDv7.t() | nil
}

translations_map()

@type translations_map() :: %{
  optional(String.t()) => %{optional(String.t()) => String.t()}
}

JSONB map of secondary-language overrides for translatable fields. Same shape as Project.translations_map — primary stays in the dedicated columns, this map only carries non-primary overrides.

Functions

changeset(task, attrs)

duration_units()

format_duration(n, unit)

localized_description(t, lang)

@spec localized_description(t(), String.t() | nil) :: String.t() | nil

Same fallback semantics as localized_title/2 — for description.

localized_title(t, lang)

@spec localized_title(t(), String.t() | nil) :: String.t() | nil

Returns the task's title in the requested language, falling back to the primary title column when the language has no override (or the override is empty/nil).

to_hours(n, unit, counts_weekends)

Converts a duration to hours under a given calendar mode.

translatable_fields()

@spec translatable_fields() :: [String.t()]

DB-column field names that participate in the translations JSONB.