PhoenixKitBoards.Boards (PhoenixKitBoards v0.2.0)

Copy Markdown View Source

Context for collaborative infinite-canvas boards.

Owns board CRUD (against the host repo via PhoenixKit.RepoHelper), canvas load/save into the data jsonb column, and the small helpers the LiveView + collaboration layer use to read/replace the etcher annotation list.

Summary

Functions

The board's current etcher annotation list (list of shape maps).

A fresh, empty infinite canvas with an initialized (empty) etcher layer.

Create a board with a fresh blank canvas persisted into data.

Delete a board.

Fetch a board by id, or nil.

All boards, newest first.

Load a board's Fresco.Canvas from its data column.

Return canvas with its etcher annotation list replaced by list.

Rename a board.

Replace a board's etcher annotations and persist the canvas into data.

Functions

annotations(canvas)

The board's current etcher annotation list (list of shape maps).

blank_canvas()

A fresh, empty infinite canvas with an initialized (empty) etcher layer.

create_board(attrs \\ %{})

Create a board with a fresh blank canvas persisted into data.

delete_board(board)

Delete a board.

get_board(id)

Fetch a board by id, or nil.

list_boards()

All boards, newest first.

load_canvas(board)

Load a board's Fresco.Canvas from its data column.

put_annotations(canvas, list)

Return canvas with its etcher annotation list replaced by list.

rename_board(board, name)

Rename a board.

save_annotations(board, canvas, annotations)

Replace a board's etcher annotations and persist the canvas into data.

Returns {:ok, canvas, board} with the updated canvas + row.