PhoenixKitCatalogue.Schemas.Pdf (PhoenixKitCatalogue v0.2.0)

Copy Markdown View Source

Per-upload row in the catalogue's PDF library.

Thin layer on top of phoenix_kit_files (core's storage). One row per "user uploaded this name". Two uploads of identical content with different filenames produce two rows sharing one file_uuid (and one extraction, and one set of cached page rows).

Lifecycle (status column, workspace soft-delete convention): "active" — visible in the library "trashed" — moved to trash; trashed_at set; rows hidden by

          default but recoverable.

The file_uuid FK is ON DELETE RESTRICT — core's prune cannot remove a file referenced by any catalogue row. Catalogue's permanent-delete flow checks the per-file refcount and only hands off to core's Storage.trash_file/1 when no PDF row remains.

Summary

Types

t()

@type t() :: %PhoenixKitCatalogue.Schemas.Pdf{
  __meta__: term(),
  byte_size: term(),
  extraction: term(),
  file_uuid: term(),
  inserted_at: term(),
  original_filename: term(),
  status: term(),
  trashed_at: term(),
  updated_at: term(),
  uuid: term()
}

Functions

changeset(pdf, attrs)

@spec changeset(
  t()
  | %PhoenixKitCatalogue.Schemas.Pdf{
      __meta__: term(),
      byte_size: term(),
      extraction: term(),
      file_uuid: term(),
      inserted_at: term(),
      original_filename: term(),
      status: term(),
      trashed_at: term(),
      updated_at: term(),
      uuid: term()
    },
  map()
) :: Ecto.Changeset.t(t())

restore_changeset(pdf)

@spec restore_changeset(t()) :: Ecto.Changeset.t(t())

statuses()

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

trash_changeset(pdf)

@spec trash_changeset(t()) :: Ecto.Changeset.t(t())