feat(postcard): sample values, file hashes, index sync and the draft editor

- sample.<path> header keys and a parse-tree walker that fills every other
  variable with a visible [path] placeholder, nested fields and range
  targets included
- every file entry carries the sha256 of its CRLF-normalized text; the
  catalog lists its files (Templates, Layouts, Partials) for admin code
- SyncIndex upserts one index row per file and never touches the override
  columns of a customized row; ResetOverride returns a row to its file
- Editor validates, previews and test-sends a template, layout or partial
  draft through the render path of Send and reports field and rule
- pact.RowStateCustomized and pact.RowStateOutdated

Plan 35-01, task 4.
This commit is contained in:
Jakub Zych
2026-11-13 10:57:05 +01:00
parent 5df1ec27cf
commit 495319ee21
11 changed files with 2128 additions and 42 deletions

View File

@@ -1059,6 +1059,12 @@ const (
RowStateNegative RowState = "negative"
// RowStateDisabled marks an inactive record.
RowStateDisabled RowState = "disabled"
// RowStateCustomized marks a record whose shipped content an
// administrator has replaced, such as a mail template with an override.
RowStateCustomized RowState = "customized"
// RowStateOutdated marks a customized record whose shipped content has
// changed since it was customized.
RowStateOutdated RowState = "outdated"
)
// ListRowStates optionally marks the rows of an admin list with states. The
@@ -1066,7 +1072,7 @@ const (
// order, and the list's database handle: a list does not run in a
// transaction, so cabana.TxFromContext reports none here. The result is
// index-aligned with records; a row may carry several states and a nil entry
// means none. Values outside the three RowState constants are dropped.
// means none. Values outside the five RowState constants are dropped.
type ListRowStates interface {
ListRowStates(ctx context.Context, db *gorm.DB, records []any) ([][]RowState, error)
}