Skip to content

fix: upsert vCon on duplicate UUID submission#38

Merged
SunainaKhan merged 2 commits intomainfrom
CON-488/fix-upsert-on-duplicate-vcon-submission
Mar 26, 2026
Merged

fix: upsert vCon on duplicate UUID submission#38
SunainaKhan merged 2 commits intomainfrom
CON-488/fix-upsert-on-duplicate-vcon-submission

Conversation

@pavanputhra
Copy link
Copy Markdown
Contributor

Summary

  • Replaced .insert() with .upsert({ onConflict: 'id' }) for the main vcon row so re-submissions don't throw a 500 duplicate key error
  • Added child row cleanup (parties, dialog, analysis, attachments) before re-inserting, so the second submission fully replaces the first

Test plan

  • POST same vcon UUID twice → both return 201
  • Second POST returns updated subject, parties, and dialog (not the first submission's data)
  • New vcon UUIDs still insert normally

🤖 Generated with Claude Code

pavanputhra and others added 2 commits March 18, 2026 14:32
Replace .insert() with .upsert({ onConflict: 'id' }) for the main vcon
row, and delete all child rows (parties, dialog, analysis, attachments)
before re-inserting. This makes re-submitting the same vCon UUID
idempotent instead of returning a 500 duplicate key error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add `upsert` to the chainable Supabase mock and update the createVCon
test assertion from `insert` to `upsert` to match the new upsert
behavior introduced in the previous commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@SunainaKhan SunainaKhan merged commit 701ff08 into main Mar 26, 2026
4 checks 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