PhoenixKitDocumentCreator.Schemas.Template (PhoenixKitDocumentCreator v0.2.10)

Copy Markdown View Source

Schema for document templates.

Templates are now managed as Google Docs in Google Drive. The google_doc_id field links a template record to its Google Doc. Variables use {{ placeholder }} syntax and are substituted via the Google Docs API.

Note: Several fields (content_html, content_css, content_native, header/footer associations) are retained for database compatibility but are no longer used in the Google Docs workflow. A future migration should remove these columns.

Summary

Functions

Focused changeset for setting/clearing the locale tag on a template.

Changeset for upserting from Google Drive sync data.

Types

t()

@type t() :: %PhoenixKitDocumentCreator.Schemas.Template{
  __meta__: term(),
  config: term(),
  content_css: term(),
  content_html: term(),
  content_native: term(),
  created_by_uuid: term(),
  data: term(),
  description: term(),
  folder_id: term(),
  footer: term(),
  footer_uuid: term(),
  google_doc_id: term(),
  header: term(),
  header_uuid: term(),
  inserted_at: term(),
  language: term(),
  name: term(),
  path: term(),
  slug: term(),
  status: term(),
  thumbnail: term(),
  updated_at: term(),
  uuid: term(),
  variables: term()
}

Functions

changeset(template, attrs)

language_changeset(template, attrs)

Focused changeset for setting/clearing the locale tag on a template.

Used by both the create-time language stamp (Documents.create_template/2) and the post-create updater (Documents.update_template_language/3) so both write paths honour validate_length(:language, max: 10) — the prior update_all write skipped this and would surface oversized codes as a Postgrex value too long exception instead of a clean changeset error.

sync_changeset(template, attrs)

Changeset for upserting from Google Drive sync data.