#31 API DELETE

* adds support for DELETE method for all relevant objects
* improves get_obj_from_db functionality
* drops custom compensation logic for get_obj_from_db due to improvement of base method
This commit is contained in:
2022-01-28 08:52:11 +01:00
parent 80896731a8
commit a47d4e8416
5 changed files with 59 additions and 26 deletions

View File

@@ -129,23 +129,6 @@ class CompensationAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensa
return obj.id
def get_obj_from_db(self, id, user):
""" Returns the object from database
Fails if id not found or user does not have shared access
Args:
id (str): The object's id
user (User): The API user
Returns:
"""
return self.model.objects.get(
id=id,
intervention__users__in=[user]
)
def update_model_from_json(self, id, json_model, user):
""" Updates an entry for the model based on the contents of json_model