fix(api): add DELETE /api/applications/[id] for withdraw#251
fix(api): add DELETE /api/applications/[id] for withdraw#251wangfudong-sudo wants to merge 2 commits into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Greptile SummaryThis PR adds a
Confidence Score: 5/5Safe to merge — the change is a thin delegation wrapper with no new business logic; all auth, ownership, and status validation remain in the existing PUT handler. The DELETE handler correctly derives the forwarded URL from No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant DELETE as DELETE /api/applications/[id]
participant PUT as PUT /api/applications/[id]/status
participant DB as Supabase
Client->>DELETE: "DELETE /api/applications/{id} (Authorization: Bearer ...)"
DELETE->>DELETE: Build statusUrl from nextUrl.pathname + /status
DELETE->>DELETE: Copy headers, set Content-Type: application/json
DELETE->>DELETE: "Create synthetic NextRequest { method: PUT, body: {status: withdrawn} }"
DELETE->>PUT: "PUT /api/applications/{id}/status"
PUT->>PUT: Auth check (getAuthContext)
PUT->>DB: SELECT application (applicant_id, gig_id)
PUT->>PUT: "Verify isApplicant && status === withdrawn"
PUT->>DB: "UPDATE applications SET status = withdrawn"
PUT-->>DELETE: "NextResponse { application: {...} }"
DELETE-->>Client: "200 { application: { status: withdrawn } }"
Reviews (2): Last reviewed commit: "refactor(api): address review on DELETE ..." | Re-trigger Greptile |
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed Greptile review feedback:
Commit: 00fd642 |
Summary
DELETE /api/applications/[id]to withdraw an applicationPUT /api/applications/[id]/statuswith{ "status": "withdrawn" }public/skill.mdagent documentationFixes #250.
Reproduction (before fix)
Validation
Notes
/api/applications/{id}/status; this PR implements the DELETE alias documented in skill.md for agent ergonomics.