All problems

Admin Member Role Validation

Level 2 · node · API · Validation error

Scenario

An admin member-management screen changes a member service role to viewer, editor, or manager. Valid updates and missing-member handling work as expected, but an unexpected role string also returns success and later reads expose that value unchanged. The controller, service, and repository are separated.

Requirements

- role must be one of viewer, editor, or manager - An allowed role update returns 200 with the updated member - An unsupported role returns 400 without changing stored member data - A missing member returns 404 - Validation failures must not call the repository update

Acceptance criteria

  • Changing a member to the allowed editor role succeeds with 200 and persists editor
  • Updating a missing member returns 404
  • An unsupported role request returns 400
  • The existing member role remains unchanged after an unsupported role request
  • A validation failure does not increase the repository update count