feat(project): add project deletion functionality with confirmation dialog#209
feat(project): add project deletion functionality with confirmation dialog#209Sithumli wants to merge 3 commits into
Conversation
|
@Sithumli is attempting to deploy a commit to the Agzaiyenths's Projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Adds an admin-only “delete rejected project” flow across the admin UI and backend API, including database cleanup and Azure Blob Storage image deletion, to allow permanent removal of rejected submissions.
Changes:
- Introduces
DELETE /api/admin/projects/[projectId]/deleteto delete a rejected project and related records, plus blob cleanup. - Adds a reusable
DeleteProjectDialogconfirmation modal and auseDeleteProjecthook to manage delete state. - Wires the delete action into the rejected-projects table (trash button) and the admin projects page with toast feedback.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| hooks/project/useDeleteProject.ts | New hook to call the admin delete endpoint and expose loading/error state. |
| components/tables/RejectedProjectsTable.tsx | Adds optional delete action button (admin-only via props) with tooltip + aria-label. |
| components/dialogs/DeleteProjectDialog.tsx | New confirmation dialog that blocks dismissal while deletion is in progress. |
| app/api/admin/projects/[projectId]/delete/route.ts | New DELETE route: validates admin + rejected status, deletes related DB rows, and cleans up Azure blobs. |
| app/(admin)/admin/projects/page.tsx | Integrates delete dialog + hook into the rejected tab with toast notifications and refresh. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agzaiyenth
left a comment
There was a problem hiding this comment.
can we also add audit logging?
|
|
@agzaiyenth isn't this ready to merge ? |
nah zion, not 100% comfortable merging this yet tbh thinking better approach is: also with the new portal coming, students can edit their own projects anyway, so this whole delete/edit pressure should reduce a lot 👍 @zionashirwada wdyt |
What changed
/api/admin/projects/[projectId]/deleteDeleteProjectDialogconfirmation component with warning messageuseDeleteProjecthook for delete state managementRejectedProjectsTable(visible to ADMIN only)Why
Scope
/admin/projects)Addressed Review Comments (from PR #204)
session.user.rolefor authorization (version-2 pattern)slice(1).join('/'))Promise.allSettledfor reliable blob cleanup in serverlessaria-labelon delete button for accessibilityDialogDescriptionusesasChildwith<div>for valid HTMLhandleConfirmDeletefor error handlingTesting performed
Closes #54