@Test @WithMockUser(username = "user@umbrella.com", roles = ROLE_ORGANIZATION_USER) void willUpdateUserInfo() throws Exception { User authUser = MockAuthenticationContextProvider.getAuthUser(); mockMvc.perform(put("/api/user") .contentType(APPLICATION_JSON) .content(objectMapper.writeValueAsString(new UpdateUserRequest("display-name-change", "email-change", "password-change")))) .andExpect(status().isOk()); verify(usersService).updateUser(authUser.getId(), authUser.getId(), "email-change", "display-name-change", "password-change"); }
@PutMapping @ApiOperation("Update currently authenticated user information") public void updateUser(User user, @RequestBody UpdateUserRequest updateUserRequest) { usersService.updateUser(user.getId(), user.getId(), updateUserRequest.getEmail(), updateUserRequest.getDisplayName(), updateUserRequest.getPassword()); }
UserController { @PutMapping @ApiOperation("Update currently authenticated user information") public void updateUser(User user, @RequestBody UpdateUserRequest updateUserRequest) { usersService.updateUser(user.getId(), user.getId(), updateUserRequest.getEmail(), updateUserRequest.getDisplayName(), updateUserRequest.getPassword()); } }
UserController { @PutMapping @ApiOperation("Update currently authenticated user information") public void updateUser(User user, @RequestBody UpdateUserRequest updateUserRequest) { usersService.updateUser(user.getId(), user.getId(), updateUserRequest.getEmail(), updateUserRequest.getDisplayName(), updateUserRequest.getPassword()); } @Autowired  UserController(DtoConverter dtoConverter, UsersService usersService, FileService fileService,
                          UsersReadService usersReadService); }
UserController { @PutMapping @ApiOperation("Update currently authenticated user information") public void updateUser(User user, @RequestBody UpdateUserRequest updateUserRequest) { usersService.updateUser(user.getId(), user.getId(), updateUserRequest.getEmail(), updateUserRequest.getDisplayName(), updateUserRequest.getPassword()); } @Autowired  UserController(DtoConverter dtoConverter, UsersService usersService, FileService fileService,
                          UsersReadService usersReadService); @GetMapping @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Get currently authenticated user information") UserResponse getUser(User user); @PutMapping @ApiOperation("Update currently authenticated user information") void updateUser(User user, @RequestBody UpdateUserRequest updateUserRequest); @PostMapping("/profile-photo") void uploadProfilePhoto(User requestingUser,
                                   @RequestParam("file") MultipartFile uploadedFile); @GetMapping("/profile-photo") ResponseEntity<StreamingResponseBody> streamProfilePhoto(User requestingUser); @GetMapping( value = "/profile-photo/thumbnail", produces = APPLICATION_OCTET_STREAM_VALUE) ResponseEntity<StreamingResponseBody> streamProfilePhotoThumbnail(User requestingUser,
                                                                             @RequestParam int width,
                                                                             @RequestParam int height); }
UserController { @PutMapping @ApiOperation("Update currently authenticated user information") public void updateUser(User user, @RequestBody UpdateUserRequest updateUserRequest) { usersService.updateUser(user.getId(), user.getId(), updateUserRequest.getEmail(), updateUserRequest.getDisplayName(), updateUserRequest.getPassword()); } @Autowired  UserController(DtoConverter dtoConverter, UsersService usersService, FileService fileService,
                          UsersReadService usersReadService); @GetMapping @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Get currently authenticated user information") UserResponse getUser(User user); @PutMapping @ApiOperation("Update currently authenticated user information") void updateUser(User user, @RequestBody UpdateUserRequest updateUserRequest); @PostMapping("/profile-photo") void uploadProfilePhoto(User requestingUser,
                                   @RequestParam("file") MultipartFile uploadedFile); @GetMapping("/profile-photo") ResponseEntity<StreamingResponseBody> streamProfilePhoto(User requestingUser); @GetMapping( value = "/profile-photo/thumbnail", produces = APPLICATION_OCTET_STREAM_VALUE) ResponseEntity<StreamingResponseBody> streamProfilePhotoThumbnail(User requestingUser,
                                                                             @RequestParam int width,
                                                                             @RequestParam int height);  }