Skip to content

Commit

Permalink
updated user service to include language code
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-addison-h committed May 30, 2024
1 parent 5ade11a commit 0c36779
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/femr/business/services/core/IUserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public interface IUserService {
*/
ServiceResponse<UserItem> updateUser(UserItem userItem, String newPassword);


ServiceResponse<UserItem> updateUserLanguageCode(UserItem userItem, String languageCode);

/**
* Retrieves a user by their email address. TODO: stop returning data models
*
Expand Down
20 changes: 20 additions & 0 deletions app/femr/business/services/system/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,26 @@ public ServiceResponse<UserItem> updateUser(UserItem userItem, String newPasswor
return response;
}

@Override
public ServiceResponse<UserItem> updateUserLanguageCode(UserItem userItem, String languageCode) {
ServiceResponse<UserItem> response = new ServiceResponse<>();
if (userItem == null) {
response.addError("", "send a user");
return response;
}

try {
IUser user = userRepository.retrieveUserById(userItem.getId());
user.setLanguageCode(languageCode);
user = userRepository.updateUser(user);
response.setResponseObject(itemModelMapper.createUserItem(user));
} catch (Exception ex) {
response.addError("", ex.getMessage());
}
return response;
}


/**
* {@inheritDoc}
*/
Expand Down

0 comments on commit 0c36779

Please sign in to comment.