Merge branch 'RED-7055' into 'main'

RED-7055 - Change status code for user creation to conflict

See merge request fforesight/tenant-user-management-service!92
This commit is contained in:
Yannik Hampe 2024-03-04 09:05:31 +01:00
commit 2f49ee0908

View File

@ -323,7 +323,7 @@ public class UserService {
var userList = this.getTenantUsersResource().search(username, true);
if (userList.isEmpty()) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "User with this username already exists");
throw new ResponseStatusException(HttpStatus.CONFLICT, "User with this username already exists");
}
return convert(userList.iterator().next());
@ -413,7 +413,7 @@ public class UserService {
}
if (!EmailValidator.getInstance().isValid(updateProfileRequest.getEmail())) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Email address format is not valid");
throw new ResponseStatusException(HttpStatus.CONFLICT, "Email address format is not valid");
}
userRepresentation.setFirstName(updateProfileRequest.getFirstName());