feat(routes-d): DELETE /api/routes-d/deposits/addresses/[id] (#1029)#1062
Open
Rufai-Ahmed wants to merge 1 commit into
Open
feat(routes-d): DELETE /api/routes-d/deposits/addresses/[id] (#1029)#1062Rufai-Ahmed wants to merge 1 commit into
Rufai-Ahmed wants to merge 1 commit into
Conversation
Add a handler to remove a deposit address. It authenticates the caller, validates the id param, loads the address, enforces ownership (404 when missing, 403 when foreign), hard-deletes the record, and returns 204. Follows the existing routes-d conventions (Bearer auth via verifyAuthToken, Prisma delegate access, structured error envelopes, pino logger). Adds vitest coverage for the happy path plus unauthorized, user-not-found, invalid-id, address-not-found, not-owner, and failure modes.
|
@donprecious is attempting to deploy a commit to the david's projects Team on Vercel. A member of the Team first needs to authorize it. |
498c76f to
f7fa4af
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Implements
DELETE /api/routes-d/deposits/addresses/[id]to remove a deposit address.Changes
app/api/routes-d/deposits/addresses/[id]/route.ts(DELETE handler)app/api/routes-d/deposits/addresses/[id]/__tests__/deposit-address.test.ts(colocated vitest)Behaviour
The handler mirrors the existing
routes-dconventions. Closest neighbours:members/[id]/route.ts(the canonical DELETE[id]template) andwhitelist/addresses(the user-owned address model).verifyAuthToken, then loads the user byprivyId.{ error }envelope, and status codes plus thelogger.errorcatch all match neighbouring routes.Tests cover the happy path, missing header, invalid token, user not found, empty id, address not found, not-owner (asserts no delete is attempted), and an unexpected failure.
Note
There is no
DepositAddressmodel inprisma/schema.prismayet, so the handler uses the same runtime delegate-cast idiom the existingwhitelistandmembersroutes use for not-yet-generated models, rather than adding a schema migration here (that looks like a separate concern). The tests follow the repo's existing vitest patterns; I was not able to run them locally in my environment.Closes #1029