Skip to content

Commit

Permalink
[ADD] Possibility to unset owner from alerts from API
Browse files Browse the repository at this point in the history
  • Loading branch information
whikernel committed Nov 9, 2024
1 parent 1e5e805 commit d31acf1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/app/blueprints/alerts/alerts_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def alerts_update_route(alert_id) -> Response:
if data.get('alert_owner_id') is None and updated_alert.alert_owner_id is None:
updated_alert.alert_owner_id = current_user.id

if data.get('alert_owner_id') == "-1":
if data.get('alert_owner_id') == "-1" or data.get('alert_owner_id') == -1:
updated_alert.alert_owner_id = None

# Save the changes
Expand Down Expand Up @@ -434,6 +434,9 @@ def alerts_batch_update_route() -> Response:
if not user_has_client_access(current_user.id, alert.alert_customer_id):
return response_error('User not entitled to update alerts for the client', status=403)

if data.get('alert_owner_id') == "-1" or data.get('alert_owner_id') == -1:
updates['alert_owner_id'] = None

# Deserialize the JSON data into an Alert object
alert_schema.load(updates, instance=alert, partial=True)

Expand Down

0 comments on commit d31acf1

Please sign in to comment.