Skip to content

fix: record rmas.closed_at when an RMA is completed or cancelled - #73

Draft
sonnymay wants to merge 1 commit into
mainfrom
claude/vibrant-meitner-noekuj
Draft

sonnymay wants to merge 1 commit into
mainfrom
claude/vibrant-meitner-noekuj

Conversation

@sonnymay

Copy link
Copy Markdown
Owner

Summary

schema.sql defines rmas.closed_at, but no endpoint ever wrote to it, so it was always null. POST /rmas and PUT /rmas/{id} now set it to the current UTC time when resolution_status is Completed or Cancelled (the closed statuses offered in RMAs.jsx).

  • Editing an RMA that is already closed keeps its original close time. This adds one select=closed_at lookup, which only runs when the status is a closed one.
  • Moving an RMA back to an open status clears closed_at.

No open PR (#17–#72) or issue touches closed_at (also searched issues and PRs for "closed_at"). #72 makes the same kind of fix for tickets.updated_at. #46 and #53 also edit the RMA routes and model, so a small merge conflict is possible, but neither changes this logic.

Testing

  • Added 4 tests: create with an open vs. closed status, closing an RMA, keeping an existing close time, and reopening.
  • pytest: 47 passed (with SUPABASE_URL/SUPABASE_KEY set). ruff check and ruff format --check are clean.

Generated by Claude Code

schema.sql defines rmas.closed_at, but no endpoint ever wrote it, so it
was always null and there was no way to tell when an RMA finished.

POST /rmas and PUT /rmas/{id} now stamp closed_at (UTC) when
resolution_status is Completed or Cancelled. Editing an already-closed
RMA keeps its original close time, and moving it back to an open status
clears closed_at.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0171zWzmNQGv8CgCKbL65TK9
@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
supportops Ready Ready Preview Nov 12, 2026 3:04pm UTC

This branch was successfully deployed

1 active deployment
Preview — d5f010bd Deployed Nov 12, 2026 by vercel[bot]
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