Skip to content

feat: add project deletion for rejected projects#204

Closed
Sithumli wants to merge 2 commits into
IIT-SDGP:mainfrom
Sithumli:feat/project-delete-option
Closed

feat: add project deletion for rejected projects#204
Sithumli wants to merge 2 commits into
IIT-SDGP:mainfrom
Sithumli:feat/project-delete-option

Conversation

@Sithumli
Copy link
Copy Markdown

This PR implements the project deletion feature requested in issue #54, allowing administrators to permanently delete rejected projects and all associated data.

What changed


  • Added DELETE API endpoint at /api/admin/projects/[projectId]/delete
  • Added cascade deletion of all related records (details, status, associations, slides, team, social links)
  • Added Azure blob storage cleanup for project images (cover, logo, team profiles)
  • Added DeleteProjectDialog confirmation component with warning message
  • Added useDeleteProject hook for delete state management
  • Added trash icon button in RejectedProjectsTable (visible to ADMIN only)
  • Integrated delete flow in admin projects page with toast notifications

Why


  • Rejected projects currently remain in the database indefinitely
  • Administrators need a way to clean up rejected submissions and free storage
  • Related blob storage images were never cleaned up, causing unnecessary storage costs

Scope


  • Admin projects management page (/admin/projects)
  • Rejected projects tab and table component
  • New API endpoint for project deletion
  • Blob storage cleanup utility

Testing performed


  • Created local MySQL database via Docker
  • Seeded test rejected projects
  • Verified delete button appears only for ADMIN users
  • Confirmed project and all related records removed from database
  • Verified UI updates after successful deletion

Closes #54

  Implement delete functionality for rejected projects in admin panel.
  - Add DELETE API endpoint with cascade deletion of related records
  - Clean up blob storage images (cover, logo, team profiles)
  - Add confirmation dialog with warning about permanent deletion
  - Add delete button (trash icon) visible only to ADMIN users

  Closes IIT-SDGP#54
Copilot AI review requested due to automatic review settings April 15, 2026 22:20
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 15, 2026

@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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements an admin-only flow to permanently delete rejected projects, including database cleanup of related project records and attempting Azure Blob Storage cleanup for stored images. This supports issue #54 by enabling removal of rejected submissions and associated storage usage from the admin projects management UI.

Changes:

  • Added a new admin DELETE API endpoint to delete a project and its related records, plus blob cleanup logic.
  • Added a reusable useDeleteProject hook and a DeleteProjectDialog confirmation dialog.
  • Extended the rejected projects table + admin projects page to expose and wire up a delete action for admins.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
hooks/project/useDeleteProject.ts New hook to call the delete endpoint and manage loading/error/success state.
components/tables/RejectedProjectsTable.tsx Adds optional delete action UI (trash button) for rejected projects.
components/dialogs/DeleteProjectDialog.tsx New confirmation dialog describing irreversible deletion impact.
app/api/admin/projects/[projectId]/delete/route.ts New server route to delete project data in Prisma and trigger blob deletion.
app/(admin)/admin/projects/page.tsx Wires delete dialog + hook into rejected projects tab with toast feedback.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/(admin)/admin/projects/page.tsx Outdated
Comment thread components/tables/RejectedProjectsTable.tsx
Comment thread app/api/admin/projects/[projectId]/delete/route.ts
Comment thread app/api/admin/projects/[projectId]/delete/route.ts Outdated
Comment thread app/api/admin/projects/[projectId]/delete/route.ts
Comment thread components/dialogs/DeleteProjectDialog.tsx Outdated
@agzaiyenth
Copy link
Copy Markdown
Member

@Sithumli Please resolve the co-pilot comments first.

Copy link
Copy Markdown
Member

@agzaiyenth agzaiyenth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this tested properly?

@agzaiyenth
Copy link
Copy Markdown
Member

@Sithumli we can't leave the delete api accessible to the public
when executing the delete endpoint it has to check for the user role and execute only if the user is admin
also can we close this PR and create a new PR requesting to merge into 'Version 2 release' Branch
we have implemented Asgardeo Auth, please take the session user's role from there, do the validation before executing the API, this is to ensure that public can't delete the projects.

Comment thread app/api/admin/projects/[projectId]/delete/route.ts Outdated
Comment thread app/api/admin/projects/[projectId]/delete/route.ts Outdated
Comment thread components/dialogs/DeleteProjectDialog.tsx Outdated
@Sithumli
Copy link
Copy Markdown
Author

Sithumli commented Apr 21, 2026

@agzaiyenth As requested I've addressed the comments and created a new PR #209 targeting the version-2-release branch. Ready for review when you have time. Thanks! :)

@Sithumli Sithumli closed this Apr 21, 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

Development

Successfully merging this pull request may close these issues.

[feat] create delete option

4 participants