-
Notifications
You must be signed in to change notification settings - Fork 2
feat(hackathons): Add delete functionality with confirmation dialog and enhanced logging #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nd enhanced logging - Add delete button to hackathon management table with trash icon - Implement confirmation dialog for hackathon deletion using AlertDialog component - Add comprehensive logging throughout DELETE endpoint for debugging - Enhance error handling with auth error checking and proper HTTP status codes (403 for unauthorized) - Update DELETE response format to include success flag - Add error message details in 500 response for better debugging - Include tooltips on action buttons (Edit, View, Delete) for better UX - Add delete state management (deleteDialogOpen, hackathonToDelete, isDeleting) - Implement handleDeleteClick and handleDeleteConfirm functions for deletion workflow - Use hackathon slug instead of id for API endpoint consistency - Add success and error toast notifications for user feedback - Refresh hackathon list after successful deletion
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. WalkthroughThe pull request enhances the hackathon deletion functionality across the API route, dashboard UI, and service layer. It introduces comprehensive logging, explicit authentication and authorization validation with appropriate HTTP status codes (401/403), a delete confirmation dialog in the UI, and improved error handling with detailed logging at each step of the deletion flow. Changes
Sequence DiagramsequenceDiagram
actor User
participant Dashboard
participant API Route
participant Service
participant Database
User->>Dashboard: Click delete button
Dashboard->>Dashboard: Show confirmation dialog
User->>Dashboard: Confirm deletion
Dashboard->>API Route: DELETE /api/hackathons/[id]
rect rgb(200, 220, 255)
Note over API Route: Authentication & Authorization
API Route->>API Route: Check authentication
alt No user/authError
API Route-->>Dashboard: 401 Unauthorized
else Check authorization (admin/member)
alt Not authorized
API Route-->>Dashboard: 403 Forbidden
else Authorized
rect rgb(220, 255, 220)
Note over API Route, Service: Delete Flow
API Route->>Service: deleteHackathon(slug)
Service->>Database: DELETE from hackathons WHERE slug=?
Database-->>Service: Deleted row(s)
alt No rows deleted
Service-->>API Route: Error (not found/forbidden)
else Success
Service->>Service: Log deletion confirmation
Service-->>API Route: Return deleted data
end
end
API Route-->>Dashboard: 200 { success: true, message: ... }
end
end
end
Dashboard->>Dashboard: Close dialog, refresh list, show toast
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Authored by: @akshay0611
Summary by CodeRabbit
Release Notes
New Features