giovabattelli / FinishLine

Our project management dashboard, v5
https://finishlinebyner.com
GNU Affero General Public License v3.0
0 stars 0 forks source link

[Stats Page] - Create Delete Graph Collection Endpoint #6

Open giovabattelli opened 1 day ago

giovabattelli commented 1 day ago

Description

We need to create an endpoint to soft delete a graph collection. This endpoint should be in the statistics router under the route ‘statistics/:graphCollectionId/delete’ and should take in the graph collection id.

Be sure to include unit tests and screenshots of postman manual tests to ensure everything is working correctly.

Acceptance Criteria

a new endpoint is created in the statistics router under the route ‘statistics/:graphCollectionId/delete’ that soft deletes a graph collection. unit tests and postman screenshot

Proposed Solution

Take a look at some of the other get endpoints we have on Finishline and use it as a reference for this endpoint.

Mocks

No response

trysherpa[bot] commented 1 day ago

Please note, Sherpa may occasionally provide incomplete or inaccurate information. Always verify critical details and double-check suggested changes before implementation.

Summary

The issue at hand is to create a new endpoint for soft deleting a graph collection in the statistics router. The endpoint should be structured as statistics/:graphCollectionId/delete, and it must accept the graph collection ID as a parameter.

Relevant Files

Changes Required

  1. statisticsRouter.js

    • Locate the section where other statistics-related routes are defined.
    • Add a new route for the delete operation:
      router.delete('/statistics/:graphCollectionId/delete', graphCollectionController.deleteGraphCollection);
  2. graphCollectionController.js

    • Implement the deleteGraphCollection function. This function should:
      • Retrieve the graphCollectionId from the request parameters.
      • Perform a soft delete operation on the graph collection, likely by updating a deleted flag in the database.
      • Return an appropriate response indicating success or failure.
    • A skeleton of the function might look like this:
      const deleteGraphCollection = async (req, res) => {
       const { graphCollectionId } = req.params;
       // Logic to soft delete the graph collection
       // Respond with success or failure message
      };
  3. tests/statistics.test.js

    • Write unit tests to ensure the new endpoint works as expected. Consider testing:
      • Successful deletion of a graph collection.
      • Handling of invalid graphCollectionId.
      • Proper response messages and status codes.

Conclusion

To implement the soft delete functionality for the graph collection, you will need to modify the routing file to include the new endpoint, implement the deletion logic within the controller, and ensure that adequate tests are written to validate the new functionality. This approach helps maintain the integrity of the existing codebase while adding the required feature.