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 issue requires the creation of a new endpoint to soft delete a graph collection within the statistics router of the FinishLine application. The endpoint should be accessible at the route statistics/:graphCollectionId/delete
and should accept the graph collection ID as a parameter.
router.delete('/:graphCollectionId/delete', statisticsController.deleteGraphCollection);
Implement the deleteGraphCollection
function:
graphCollectionId
from the request parameters.Example skeleton:
const deleteGraphCollection = async (req, res) => {
const { graphCollectionId } = req.params;
try {
await GraphCollection.softDelete(graphCollectionId); // Implement this method in the model
res.status(200).json({ message: 'Graph collection deleted successfully.' });
} catch (error) {
res.status(500).json({ error: error.message });
}
};
deletedAt
timestamp or a isDeleted
flag in the database:
static async softDelete(graphCollectionId) {
// Example implementation
return await prisma.graphCollection.update({
where: { id: graphCollectionId },
data: { deletedAt: new Date() } // or isDeleted: true
});
}
To implement the soft delete functionality for the graph collection, you will need to add a new endpoint in the statistics router, create a corresponding controller method to handle the request, and implement the soft delete logic in the model. Make sure to include unit tests for the new endpoint and document the expected behavior in Postman for manual testing. This approach will ensure that the new functionality is integrated seamlessly into the existing architecture of the FinishLine application.
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