PhoenixKitStaff.Schemas.Person (PhoenixKitStaff v0.3.0)

Copy Markdown View Source

A person on staff. Always linked to a PhoenixKit user (decision A for MVP); the user_uuid FK is required.

All profile fields beyond the required user_uuid and status are optional — fill in whatever's relevant.

Summary

Functions

Best human label for a staff person, in priority order

Splits a comma-separated skills string into a list, trimming blanks.

Translated label for a status value (for UI display).

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

Types

t()

@type t() :: %PhoenixKitStaff.Schemas.Person{
  __meta__: term(),
  bio: String.t() | nil,
  date_of_birth: Date.t() | nil,
  emergency_contact_name: String.t() | nil,
  emergency_contact_phone: String.t() | nil,
  emergency_contact_relationship: String.t() | nil,
  employment_end_date: Date.t() | nil,
  employment_start_date: Date.t() | nil,
  employment_type: String.t() | nil,
  inserted_at: DateTime.t() | nil,
  job_title: String.t() | nil,
  name: String.t() | nil,
  notes: String.t() | nil,
  personal_email: String.t() | nil,
  personal_phone: String.t() | nil,
  primary_department:
    PhoenixKitStaff.Schemas.Department.t()
    | Ecto.Association.NotLoaded.t()
    | nil,
  primary_department_uuid: UUIDv7.t() | nil,
  skills: String.t() | nil,
  status: String.t() | nil,
  team_memberships:
    [PhoenixKitStaff.Schemas.TeamMembership.t()]
    | Ecto.Association.NotLoaded.t(),
  translations: translations_map(),
  updated_at: DateTime.t() | nil,
  user: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t() | nil,
  user_uuid: UUIDv7.t() | nil,
  uuid: UUIDv7.t() | nil,
  work_location: String.t() | nil,
  work_phone: String.t() | nil
}

translations_map()

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

Functions

changeset(person, attrs)

@spec changeset(t() | Ecto.Changeset.t(t()), map()) :: Ecto.Changeset.t(t())

display_name(person)

@spec display_name(t()) :: String.t()

Best human label for a staff person, in priority order:

  1. the explicit name column (the staff profile owns identity),
  2. the linked user's first_name/last_name,
  3. the linked user's email,
  4. a generic "Unnamed" fallback.

Used by every people-listing surface (people list, org overview, birthdays, show page) so the display is consistent. Expects :user to be preloaded for the email/user-name fallbacks; an unloaded association just skips to the generic fallback.

employment_type_label(other)

employment_types()

localized_bio(p, lang)

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

localized_job_title(p, lang)

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

localized_notes(p, lang)

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

localized_skills(p, lang)

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

skill_list(skills)

Splits a comma-separated skills string into a list, trimming blanks.

status_label(other)

Translated label for a status value (for UI display).

statuses()

translatable_fields()

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

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