PhoenixKit.Modules.Storage.EtcherAdapter (phoenix_kit v1.7.117)

Copy Markdown View Source

Persistence helper for the MediaBrowser's annotation flow.

Etcher 0.3 dropped the Etcher.Storage behaviour entirely — annotations now live inside the host <Fresco.canvas>'s extensions.etcher blob and the library doesn't reach into the consumer's DB anymore. PhoenixKit still needs to persist its annotations (they're per-file, not per-canvas- file-on-disk), so this module survives as a thin helper module called from the MediaBrowser LV's etcher:annotations-changed event handler — not as a behaviour implementation.

The four public functions (create/1, list_for/2, update/2, delete/1) keep their pre-0.3 signatures so the diff in MediaBrowser stays small. None of them are @impl annotations anymore; they're just plain helpers wrapping the PhoenixKit.Annotations context.

Etcher's generic API is keyed by target_type + target_uuid so the library can annotate any kind of resource. In PhoenixKit the only target is a media File, so this adapter requires target_type == "file" and maps target_uuid to file_uuid.

Comment threads

An annotation's discussion thread is not created at draw time — it's instantiated lazily when the user posts the first comment on the annotation. The comments are anchored to the file (resource_type = "file", resource_uuid = file_uuid) with metadata.annotation_uuid carrying the back-reference, so they appear in the file's main thread alongside non-annotated discussion. No comment_uuid column on annotations is needed.

Summary

Functions

create(attrs)

delete(uuid)

list_for(target_type, target_uuid)

update(uuid, attrs)