PhoenixKitCalendar.Schemas.Event (PhoenixKitCalendar v0.1.0)

Copy Markdown View Source

A calendar event on a user's personal calendar.

Time model

Mirrors phoenix_live_calendar (and iCal RFC 5545): ends are EXCLUSIVE ([start, end)).

  • Timed events (all_day: false) use starts_at/ends_at (UTC).
  • All-day events (all_day: true) use starts_on/ends_on (dates) — proper date semantics, no UTC-midnight ambiguity. A single-day all-day event on July 10 stores starts_on: 2026-07-10, ends_on: 2026-07-11.

The changeset nils out the inactive pair when all_day flips, so form toggling never trips the DB CHECK (calendar_event_time_shape).

Ownership

owner_uuid is deliberately NOT castable — it is set once by PhoenixKitCalendar.Events.create_event/4 from an explicitly authorized argument and is immutable afterwards. Accepting it from form params would let any calendar user create events on someone else's calendar or move events between calendars.

Summary

Functions

Changeset for create/update. owner_uuid is not castable — see the moduledoc.

Allowed color classes (daisyUI backgrounds the calendar can style).

Allowed status values.

Types

t()

@type t() :: %PhoenixKitCalendar.Schemas.Event{
  __meta__: term(),
  all_day: term(),
  color: term(),
  description: term(),
  ends_at: term(),
  ends_on: term(),
  inserted_at: term(),
  location: term(),
  location_uuid: term(),
  owner_uuid: term(),
  starts_at: term(),
  starts_on: term(),
  status: term(),
  title: term(),
  updated_at: term(),
  uuid: term()
}

Functions

changeset(event, attrs)

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

Changeset for create/update. owner_uuid is not castable — see the moduledoc.

colors()

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

Allowed color classes (daisyUI backgrounds the calendar can style).

statuses()

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

Allowed status values.