notsoocool / codecache

CodeCache is a dynamic web application designed to streamline the way developers manage and access code snippets. The platform provides a comprehensive library of code snippets, allowing users to save, organize, and retrieve useful code snippets for various programming languages and use cases.
https://codecache.tech
MIT License
18 stars 56 forks source link

Delete Snippet Completed #77

Closed inkerton closed 1 month ago

inkerton commented 1 month ago

image

vercel[bot] commented 1 month ago

@inkerton is attempting to deploy a commit to the notsoocool's projects Team on Vercel.

A member of the Team first needs to authorize it.

inkerton commented 1 month ago

This is in response to the issue #74 @notsoocool Review the PR and merge it

notsoocool commented 1 month ago

Instead of directly deleting a snippet, I propose implementing a request deletion option. If a user wishes to delete a snippet, they should provide a reason for the deletion. This reason will be displayed on the admin page alongside the snippet. The admin will then have the authority to approve or reject the delete request. If the admin approves the request, the snippet will be deleted from the system.

inkerton commented 1 month ago

Then shall I make a DeleteRequest model also with a reason from the user to delete it and then store in the deleteRequest collection. Also I don't have admin access so I won't be able to do much on that part till u tell me how to access the admin panel.

Also since I will be making a whole new model and request setup I would like the issue to be raised to level3. I will start working on the model and I was thinking of a Dialogue box that will open up on delete where the user can enter the delete request along with the reason.

@notsoocool

notsoocool commented 1 month ago

Then shall I make a DeleteRequest model also with a reason from the user to delete it and then store in the deleteRequest collection. Also I don't have admin access so I won't be able to do much on that part till u tell me how to access the admin panel.

Also since I will be making a whole new model and request setup I would like the issue to be raised to level3. I will start working on the model and I was thinking of a Dialogue box that will open up on delete where the user can enter the delete request along with the reason.

@notsoocool

Hey, this looks perfect! You can go ahead with the implementation. For admin access, you have an environment variable named ADMIN_USER_IDS in the .env.sample file. Just add your user ID (which you can get from Clerk) and save it, and you'll have admin access.

Also, for labeling issues or PRs, don’t worry—I’ll label you appropriately based on the work. I won't show any bias to anyone 😊.

inkerton commented 1 month ago

created the delepteRequest Model image

notsoocool commented 1 month ago

created the delepteRequest Model image

just a suggestion no need to have so many field, just have the user id, description, snippet id, thats it

inkerton commented 1 month ago

image

Changed the Model @notsoocool

inkerton commented 1 month ago

image

inkerton commented 1 month ago

image

inkerton commented 1 month ago

Tabs for easy admin navigation image


Table with delete Requests data and Accept and Reject row actions image

I have completed my work. Since the whole process has been completed please check out the PR merge it and raise the level to level3. @notsoocool

inkerton commented 1 month ago

I added these following

  1. Delete button
  2. Button modal open
  3. Delete request model (revised according to your request)
  4. backend api/getdeleteRequest to fetch all requests
  5. tabs for easy admin navigation (rerendered the whole page)
  6. Delete requests table
  7. added table actions -'Accept' and 'Reject'
  8. api call for api/getdeleteRequest/accept
  9. api call for api/getdeleteRequest/reject
  10. working logic for all

Screenshots added above @notsoocool

inkerton commented 1 month ago

@notsoocool Have you checked my PR. Please merge it and add level3 tag also.

inkerton commented 1 month ago

Is there any issue with the PR ???

@notsoocool If not then please do merge it i need to work on the edit snippet too that I will build upon this one.

notsoocool commented 1 month ago

Is there any issue with the PR ???

@notsoocool If not then please do merge it i need to work on the edit snippet too that I will build upon this one.

I understand your concern, but I'm not available at the moment. Please wait until the evening, and I will review the code changes by then and let you know.

notsoocool commented 1 month ago

@notsoocool Have you checked my PR. Please merge it and add level3 tag also.

Just a friendly reminder—please avoid mentioning what to label your PR. This is your second reminder, so I kindly ask you to keep this in mind moving forward. Thank you for understanding!

notsoocool commented 1 month ago

@inkerton I’ve tested your code locally, and everything works smoothly until I reach the snippet deletion page. The issue arises when I attempt to delete a snippet—it doesn’t get removed from the database. Could you please take a look and see if anything might be causing this?

notsoocool commented 1 month ago

Also i need you add some toast notification and also need to improve the UI for level3 label, but before that solve the above mentioned problem

inkerton commented 1 month ago

image

And for deleted also i added the toast. @notsoocool

inkerton commented 1 month ago

What UI changes do you want?? Specify please @notsoocool

notsoocool commented 1 month ago

@inkerton Thanks for the PR, I’m satisfied with the changes! However, I noticed that the snippet rating isn’t displaying anymore. Could you also add a toast notification on the profile page after submitting the reason? Additionally, when a request is accepted, the snippet should be dynamically removed from the list, but currently, it's only disappearing after a page reload. Could you look into that as well?

notsoocool commented 1 month ago

This would be some last Checks you have to complete and you are good to go.

inkerton commented 1 month ago

Their was no snippet rating being displayed in the first place @notsoocool image

image

image

Refer to the original PR #50

inkerton commented 1 month ago

@notsoocool As for the dynamic removal of table row . it is done.

notsoocool commented 1 month ago

Hi @inkerton,

Could you please fetch the latest changes from the develop branch and test it? The rated snippet section is functioning properly there.

Everything else is working well, so you're good to go! Could you please check what’s causing the rated snippets not to display?

Thank you!

inkerton commented 1 month ago

@notsoocool you can Merge PR now