Skip to content

feat(api): DB-backed idempotency guard, avatar post-upload verification, stream tips visibility - #977

Merged
xeeenab merged 2 commits into
InChordSync:mainfrom
khalyaro:feature/avatar-idempotency-sse-auth
Aug 30, 2026
Merged

feat(api): DB-backed idempotency guard, avatar post-upload verification, stream tips visibility#977
xeeenab merged 2 commits into
InChordSync:mainfrom
khalyaro:feature/avatar-idempotency-sse-auth

Conversation

@khalyaro

Copy link
Copy Markdown

Summary

Addresses four open issues across payment idempotency, avatar moderation/verification, and stream tip feed visibility.

#841 — DB-back the payment idempotency guard

  • Replaced the in-memory Map in PaymentIdempotencyGuardService with a database-backed store (TransactionIdempotencyRecord, unique per owner+key) so records survive restarts and are shared across instances.
  • Wired the guard into deposit.service.initiateDeposit and creator-payout.service.initiatePayout.
  • Added duplicate-request tests (unit test for the guard + API-level idempotency test for deposits).

#843 — post-upload avatar verification

  • Added getAvatarObject S3 helper and post-upload verification (real size / content-type / magic bytes) that runs in PATCH /api/users/me before an avatar is marked active, instead of trusting the client-declared content type.

#844 — wire (previously orphaned) avatar moderation service

  • Wired moderateAvatarUpload into the avatar upload flow (�erifyAvatarUrl) and added tests, including a rejection case for uploaded bytes that don't match the declared image type.

#845 — confirm stream tips visibility

  • Confirmed GET /api/streams/:id/tips (SSE) already enforces
    equireAuth; documented it as intentionally private in stream.routes.ts.

Notes

  • Adds a new Prisma model (TransactionIdempotencyRecord); run prisma generate + a migration before compiling/tests.

Closes

Closes #841
Closes #843
Closes #844
Closes #845

…on, document stream tips

- Back PaymentIdempotencyGuardService with TransactionIdempotencyRecord
  (DB) instead of an in-memory Map; wire into deposit and creator-payout
  flows with duplicate-request tests (InChordSync#841)
- Add post-upload avatar verification (size/type/magic bytes) in patchMe
  and wire the previously-orphaned moderateAvatarUpload into the flow,
  with tests (InChordSync#843, InChordSync#844)
- Document streamTips SSE as intentionally private (already requireAuth) (InChordSync#845)
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@khalyaro Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@xeeenab
xeeenab merged commit ffe76c0 into InChordSync:main Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants