-
Notifications
You must be signed in to change notification settings - Fork 15
Description
This was tested via the Argus react frontend.
Backend v.1.16.0, API v1(stable), frontend v.1.14.1
The API returns a 500 error if you try to create a destination that has the same name, media type and belongs to the same user.
Steps to reproduce (example using email media, but should be the same for all media):
- Go to
/destinationspage - Create an email destination with a name so the "title" field should not be empty (multiple destinations with a blank doesnt seem to cause any issues)
- Try to create another email destination with a unique and valid email address, but the same name as the first destination
- API will reply with a 500 error code
I'm pretty sure the error is caused by a this constraint:
Argus/src/argus/notificationprofile/models.py
Line 133 in 90bdc8a
| models.UniqueConstraint(fields=["user", "media", "label"], name="unique_label_per_user_and_medium"), |
API tries to save via the serializer, but an exception is thrown as the constraint is not met. The error is not handled anywhere so it ends in a 500 error.
Expected behaviour
I expected to see this happen: Probably a 400 code reply with the error message "Destination label must be unique per media", or something along those lines
Metadata
Metadata
Assignees
Labels
Type
Projects
Status