Skip to content

Templates contract update: field layout and PDF upload#598

Merged
marcvergees merged 2 commits into
fireform-core:developmentfrom
chetanr25:contract/template-layout
Jul 1, 2026
Merged

Templates contract update: field layout and PDF upload#598
marcvergees merged 2 commits into
fireform-core:developmentfrom
chetanr25:contract/template-layout

Conversation

@chetanr25

Copy link
Copy Markdown
Collaborator

Templates contract update: field layout and PDF upload

What changed

  • Each field now has a layout block: page, x, y, width, height, and text settings (font, size, color, align).
  • New endpoint POST /api/v1/templates/pdf to upload the blank PDF before a template is created.
  • Renamed canonical to incident_mapping to match naming used elsewhere.
  • Added static_text for fixed labels that do not come from incident data.

Why layout is nested in the field

The old contract described a field's meaning but not where its value prints on the form. The website editor is visual: the user draws a box on the PDF and it records the box corners. That position data had nowhere to live.

Nesting layout keeps a field's meaning and its position in one record, so the two never have to be matched back up after fields are added, removed, or reordered.

Why upload is a separate step

Box coordinates only make sense against a real PDF, so the PDF has to exist first. The flow is: upload PDF, editor renders pages, user draws boxes, then create the template with those coordinates. The upload returns a file reference and each page size in PDF points, which the editor needs to align its canvas.

Keeping upload out of template creation lets create stay plain JSON and lets file storage change later without touching it.

NOTE: This PR is consisting of only the api contracts for review and building the service is out of this PR's scope

Part of: #549 and #541

@chetanr25 chetanr25 marked this pull request as ready for review June 30, 2026 12:37
@marcvergees marcvergees merged commit 9ee41af into fireform-core:development Jul 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants