Skip to content

Commit

Permalink
delete unused endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
ABbondar committed Sep 12, 2023
1 parent b5f4967 commit 0cb4ae1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 61 deletions.
34 changes: 0 additions & 34 deletions core/src/main/java/greencity/controller/UserController.java
Original file line number Diff line number Diff line change
Expand Up @@ -477,40 +477,6 @@ public UserAndAllFriendsWithOnlineStatusDto getUserAndAllFriendsWithOnlineStatus
return userService.getAllFriendsWithTheOnlineStatus(userId, pageable);
}

/**
* Method find user by principal.
*
* @return {@link ResponseEntity}.
* @author Orest Mamchuk
*/
@ApiOperation(value = "Find current user by principal")
@ApiResponses(value = {
@ApiResponse(code = 200, message = HttpStatuses.OK),
@ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST),
@ApiResponse(code = 401, message = HttpStatuses.UNAUTHORIZED),
})
@GetMapping("/findByEmail")
public ResponseEntity<UserVO> findByEmail(@RequestParam String email) {
return ResponseEntity.status(HttpStatus.OK).body(userService.findByEmail(email));
}

/**
* Get {@link UserVO} by id.
*
* @return {@link UserUpdateDto}.
* @author Orest Mamchuk
*/
@ApiOperation(value = "Get User by id")
@ApiResponses(value = {
@ApiResponse(code = 200, message = HttpStatuses.OK),
@ApiResponse(code = 400, message = HttpStatuses.BAD_REQUEST),
@ApiResponse(code = 401, message = HttpStatuses.UNAUTHORIZED),
})
@GetMapping("/findById")
public ResponseEntity<UserVO> findById(@RequestParam Long id) {
return ResponseEntity.status(HttpStatus.OK).body(userService.findById(id));
}

/**
* Method that allow you to find {@link UserVO} by Id.
*
Expand Down
27 changes: 0 additions & 27 deletions core/src/test/java/greencity/controller/UserControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
Expand Down Expand Up @@ -406,31 +404,6 @@ void searchTest() throws Exception {
verify(userService).search(pageable, userViewDto);
}

@Test
void findByEmailTest() throws Exception {
UserVO userVO = ModelUtils.getUserVO();
when(userService.findByEmail(TestConst.EMAIL)).thenReturn(userVO);
mockMvc.perform(get(userLink + "/findByEmail")
.param("email", TestConst.EMAIL))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id").value(1L))
.andExpect(jsonPath("$.name").value(TestConst.NAME))
.andExpect(jsonPath("$.email").value(TestConst.EMAIL));
}

@Test
void findByIdTest() throws Exception {
UserVO userVO = ModelUtils.getUserVO();
when(userService.findById(1L)).thenReturn(userVO);
mockMvc.perform(get(userLink + "/findById")
.param("id", "1"))
.andExpect(status().isOk())
.andExpect(content().contentType("application/json;charset=UTF-8"))
.andExpect(jsonPath("$.id").value(1L))
.andExpect(jsonPath("$.name").value(TestConst.NAME))
.andExpect(jsonPath("$.email").value(TestConst.EMAIL));
}

@Test
void findUserForAchievementTest() throws Exception {
UserVOAchievement userVOAchievement = UserVOAchievement.builder()
Expand Down

0 comments on commit 0cb4ae1

Please sign in to comment.