Description
POST /dictionary/register endpoint returns 500 error code when a category is already linked to a different study.
Steps to reproduce:
- Register a Dictionary successfully.
- Register the same Dictionary, using the same category used in step 1 but different study.
Current behaviour
500 HTTP Code
{
"error": "Internal Server Error",
"message": "Something went wrong while updating the requested study. Please try again later."
}
Expected
400 HTTP Code
{
"error": "Bad Request",
"message": "Category 'ABC123' is already linked to study 'XYZ456'"
}
Details:
Reason: Error is caused by a database error: duplicate key value violates unique constraint "study_category_id_unique".
A Category can only be associated to only 1 study.