Skip to content

Validate duplicate user assignment on submission before saving #2255

@wreality

Description

@wreality

Description

When assigning a user to a submission role (reviewer, coordinator, submitter) via the updateSubmission mutation, if the user is already assigned, the app relies on the MySQL unique constraint (submission_user_unique) to reject the duplicate. This produces an unhandled SQL exception in the Laravel log rather than a clean validation error returned to the client.

Steps to reproduce

  1. Assign a user as a reviewer on a submission
  2. Try to assign the same user again as a reviewer
  3. A SQLSTATE[23000]: Integrity constraint violation error is logged

Expected behavior

The API should validate that the user isn't already assigned to the requested role before attempting the insert, and return a clear GraphQL error to the client.

Impact

The SQL error generates noise in production/development logs. During E2E testing, it makes it harder to distinguish real errors from expected validation failures.

Found during

Playwright E2E test development — the submission_user_unique constraint violation appears in Laravel logs when tests attempt duplicate assignments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions