MLH-Fellowship / orientation-project-python-24.SPR.A

Orientation Project (Python for 24.SPR.A)
1 stars 3 forks source link

Implemented DELETE for existing skills #44

Closed nfallah closed 9 months ago

nfallah commented 9 months ago

Summary

Added and updated the /resume/skill endpoint for DELETE requests to remove existing skills. On success, the erased skill is returned in JSON format, and both data in memory and data.json on disk are updated.

Issue

This request closes issue #3.

Testing

An example DELETE request for /resume/skill?index=value will succeed if a valid JSON is provided and value is numeric and within bounds. The provided test case test_skill_delete() in test_pytest.py calls this endpoint with index 0. It then validates the removal by calling a GET request at the same index, ensuring an error or a different skill is returned.

Concerns

This implementation does not use the serialization class we discussed earlier as the issue has not yet been resolved. Similarly, index is obtained via query (not URL) parameters, which is another concern our team has discussed. Lastly, there can be mismatches between the id attribute and the actual index of a given skill; deleting a skill will decrement the indices of all skills in front, but not their ids. As such, the id of different skills can be identical under certain conditions, and may generally lead to problems.