PhoenixKit.Annotations.Annotation (phoenix_kit v1.7.113)

Copy Markdown View Source

Ecto schema for phoenix_kit_annotations.

Stores user-drawn shapes (rectangle, circle, polygon, freehand) tied to a PhoenixKit.Modules.Storage.File via file_uuid. All geometry is in image-pixel coordinates; Fresco's coordinate adapter rescales for pan/zoom at render time.

Comment thread linkage

An annotation's discussion lives in phoenix_kit_comments anchored to the file (resource_type = "file", resource_uuid = file_uuid) with metadata.annotation_uuid carrying the back-reference. This lets annotation-rooted comments appear in the file's main comments thread alongside non-annotated discussion. There is no comment_uuid column on annotations — the relationship is one-directional from the comment side, and a thread is created lazily when the first comment is posted.

Summary

Functions

Fields the Etcher storage adapter is allowed to take from event payloads. Single source of truth so the adapter's whitelist doesn't drift from the schema's @cast_fields. file_uuid is excluded — the adapter sets it server-side from the Etcher target_uuid.

List of allowed kind strings.

Types

t()

@type t() :: %PhoenixKit.Annotations.Annotation{
  __meta__: term(),
  creator_uuid: UUIDv7.t() | nil,
  file_uuid: UUIDv7.t(),
  geometry: map(),
  inserted_at: DateTime.t() | nil,
  kind: String.t(),
  metadata: map() | nil,
  position: integer(),
  style: map() | nil,
  title: String.t() | nil,
  updated_at: DateTime.t() | nil,
  uuid: UUIDv7.t() | nil
}

Functions

adapter_writable_fields()

@spec adapter_writable_fields() :: [atom()]

Fields the Etcher storage adapter is allowed to take from event payloads. Single source of truth so the adapter's whitelist doesn't drift from the schema's @cast_fields. file_uuid is excluded — the adapter sets it server-side from the Etcher target_uuid.

kinds()

List of allowed kind strings.