Skip to content

Add attachments and links to session feedback - #80

Merged
VidsterBroyo merged 1 commit into
mainfrom
feat/session-feedback-attachment
Nov 30, 2026
Merged

VidsterBroyo merged 1 commit into
mainfrom
feat/session-feedback-attachment

Conversation

@VidsterBroyo

@VidsterBroyo VidsterBroyo commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Notion ticket link

Ticket

Stack 3 of 3. This builds on #79.

Implementation description

  • Files: a session_feedback_attachments join table with primary key (session_feedback_id, file_id) and an index on file_id. Each attachment is a real FK to files.
    • Deleting feedback removes its attachment rows (Cascade).
    • Deleting an attached file is refused (Restrict). This matches the files service on file-utils, which already refuses to delete attached files (FileInUseError).
  • Links: session_feedback.links text[], defaulting to empty. Links need no integrity checks, so a plain array is enough.
  • Links in the API:
    • SessionFeedback.links: [String!]! is returned wherever the feedback is visible.
    • SaveSessionFeedbackInput.links: [String!]! is required and replaces the saved list, like text and points do. Pass [] for none.
    • validateFeedbackLinks (in utils/validation.ts) trims each link and allows up to 10, each a valid http(s) URL of at most 2,048 characters. It rejects things like javascript: and ftp: links. Errors are BAD_USER_INPUT with field links.
  • File attachments aren't in the API yet, since file uploads are still in progress. TODO.md lists what's left, including adding this table to isFileAttached in the files service.
  • The seed gives A's Today feedback one link, and the README's save checks now cover links.

What should reviewers focus on?

  • Why a join table rather than attachment_ids uuid[]:
    • A Postgres array can't hold FKs.
    • isFileAttached needs a fast "is this file attached anywhere" lookup, which the file_id index gives.
    • Loading feedback with its files is one Prisma include.
    • It matches FileRecipient, the existing file join table.
  • Restrict on the file side: the database refuses to delete an attached file even if code skips the isFileAttached check.
  • links is required on the save input, not optional with "unchanged if omitted". That matches how text and points already work: each save sends the whole form.
  • Not run against a real database. Please run prisma migrate deploy.

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the TL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

🤖 Generated with Claude Code

@VidsterBroyo
VidsterBroyo added this pull request to stack #81 November 30, 2026 02:02
@VidsterBroyo VidsterBroyo changed the title feat: add nullable attachment_id to session_feedback Add nullable attachment_id to session_feedback Nov 30, 2026
@VidsterBroyo
VidsterBroyo force-pushed the feat/session-feedback-attachment branch 2 times, most recently from e2338c1 to 0225018 Compare November 30, 2026 02:09
@VidsterBroyo VidsterBroyo changed the title Add nullable attachment_id to session_feedback Add attachments and links to session feedback Nov 30, 2026
@VidsterBroyo
VidsterBroyo force-pushed the feat/session-feedback-attachment branch 3 times, most recently from b873cf4 to a02696b Compare November 30, 2026 02:35
@VidsterBroyo
VidsterBroyo marked this pull request as ready for review November 30, 2026 02:36
@VidsterBroyo
VidsterBroyo force-pushed the feat/session-feedback-attachment branch from a02696b to d000a8b Compare November 30, 2026 02:37
Base automatically changed from feat/session-feedback-reads to main November 30, 2026 02:37
Feedback can carry several uploaded files and several web links. Files go in
a session_feedback_attachments join table so each one is a real FK to files.
The file FK is Restrict, matching the files service, which refuses to delete
attached files. Links are a text[] column on session_feedback.

Links are in the API: SessionFeedback.links, and saveSessionFeedback takes a
links list that replaces the saved one (up to 10 http(s) URLs, each at most
2,048 characters). File attachments stay out of the API until file uploads
are finished.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VidsterBroyo
VidsterBroyo force-pushed the feat/session-feedback-attachment branch from d000a8b to 2854940 Compare November 30, 2026 02:37
@VidsterBroyo
VidsterBroyo merged commit 9b9c12a into main Nov 30, 2026
@VidsterBroyo
VidsterBroyo deleted the feat/session-feedback-attachment branch November 30, 2026 02:38
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.

1 participant