Skip to content

in db table sent_files rename column filename to placeholder - #5035

Open
rparke wants to merge 3 commits into
mainfrom
rp-rename-column-sent-files
Open

rparke wants to merge 3 commits into
mainfrom
rp-rename-column-sent-files

Conversation

@rparke

@rparke rparke commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

to make this as generic as possible we should only care about the placeholder name. Filenames are "optional" when sending via the API, but are set automatically when sent via admin. We should record both cases and therefore use the templates placeholder to identify the file instead of filename.

@rparke

rparke commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Ignore the squawk error - it's unhappy with a column rename. This shouldn't break anything because there isn't even a SQLAlchemy model wrapping this table.

to make this as generic as possible we should only care about the placeholder name. Filenames are "optional" when sending via the API, but are set automatically when sent via admin. We should record both cases and therefore use the templates placeholder to identify the file instead of filename.
to aid in searching, we should record the filename (optionally). This would be set by default for files sent using the UI, and set optionally if a user has specified it via the API
@rparke
rparke force-pushed the rp-rename-column-sent-files branch from e6d044a to 5bdfdb7 Compare October 29, 2026 16:41
@CrystalPea

Copy link
Copy Markdown
Contributor

We had a good convo with Richard, about what would be passed to the placeholder column. I thought it worth sharing on the PR page:

So if I had the this template:
Screenshot 2026-10-29 at 15 34 50

and this template email file:
Screenshot 2026-10-29 at 15 38 15

and I would send an API request like:

from notifications_python_client import prepare_upload

with open("file.pdf", "rb") as f:
    ...
    personalisation={
      "first_name": "Amala",
      "appointment_date": "1 January 2018 at 1:00pm",
      "link_to_file": prepare_upload(f, filename="Amala_invite.pdf"),
    }

  response = notifications_client.send_email_notification(
      email_address="amala@example.com",
      template_id="9d751e0e-f929-4891-82a1-a3e1c3c18ee3",
      personalisation=personalisation
  )

placeholder column would be populated with:

  • tamagotchi.jpeg for the file uploaded via UI
  • link_to_file for the file provided in the API request

filename column would be:

  • tamagotchi.jpeg for the file uploaded via UI
  • Amala_invite.pdf for the file provided in the API request (if we didn't set the filename in that request, the filename would be set to None here.

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