Open giovabattelli opened 1 day ago
Please note, Sherpa may occasionally provide incomplete or inaccurate information. Always verify critical details and double-check suggested changes before implementation.
The task is to create a new endpoint for soft deleting a graph collection in the statistics router at the route statistics/:graphCollectionId/delete
. This endpoint will require the graph collection ID as a parameter and should include unit tests and Postman screenshots to verify functionality.
Change Required: Add a new route for the soft delete operation. You can refer to existing GET routes for structure.
router.delete('/statistics/:graphCollectionId/delete', graphCollectionController.softDelete);
Change Required: Implement a function for the soft delete operation. This function should:
graphCollectionId
.Example skeleton:
exports.softDelete = async (req, res) => {
const { graphCollectionId } = req.params;
// Validate ID and perform soft delete
};
Change Required: Ensure there is a method for soft deleting a graph collection, which might involve updating a deletedAt
timestamp or a similar field.
Example skeleton:
async function softDelete(graphCollectionId) {
// Update the collection to mark it as deleted
}
Change Required: Write tests to cover the new endpoint, ensuring it behaves as expected (e.g., returns the correct status code and response).
Example skeleton:
describe('DELETE /statistics/:graphCollectionId/delete', () => {
it('should soft delete the graph collection', async () => {
// Test implementation
});
});
To implement the soft delete endpoint for the graph collection, you will need to modify the routing file to include the new endpoint, implement the logic in the controller, ensure the model supports the soft delete functionality, and write unit tests to verify the implementation. This approach will ensure that the new feature is integrated smoothly into the existing codebase while maintaining the overall architecture.
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