def get(self, request_id): """Get endpoint for request with matching id in the database. Headers: {Authorization: JWT jwt_token, ContentType: application/json} If no request with ID found will return json message 404 error. If found returns json of request with matching ID and 200 code.""" request = RequestModel.select_by_id(request_id) if request: return request.json(), 200 return {'message': 'Request not found'}, 404
def delete(self, request_id): """Get endpoint for request with matching id in the database. Headers: {Authorization: JWT jwt_token, ContentType: application/json} If no request with ID found will return json message and 404 error. If found and deleted returns 200 code.""" request = RequestModel.select_by_id(request_id) if request: request.delete_from_db() return {'message': 'Request deleted'}, 200 return {'message': 'Request not found'}, 404