Skip to content

Commit

Permalink
Merge pull request #81 from GDSC-KNU/develop
Browse files Browse the repository at this point in the history
Develop -> Main
  • Loading branch information
fanta4715 authored Feb 25, 2024
2 parents f817708 + a5d8a1c commit 98ed797
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public ResponseEntity<?> updateUserInfo(Authentication authentication, @RequestB
return ResponseEntity.ok().body("업데이트 완료");
}

@PostMapping("/likeAnimal")
@PostMapping("/likeAnimal/{animalId}")
public ResponseEntity<UserLikeResponse> likeAnimal(
Authentication authentication,
@RequestParam Long animalId
@PathVariable Long animalId
) {
UserLikeResponse userLikeResponse = userAccountService.addlikeAnimal((UserSecurityDto) authentication.getPrincipal(), animalId);
return ResponseEntity.ok().body(userLikeResponse);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/gdsc/pikpet/dto/AnimalSearchDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
public record AnimalSearchDto(
List<AnimalSimpleDto> animals,
Integer page,
int numberOfElements
int numberOfElements,
int totalElements
) {
}
3 changes: 2 additions & 1 deletion src/main/java/com/gdsc/pikpet/service/AnimalService.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public AnimalSearchDto getAnimals(AnimalFilterCriteria animalFilterCriteria, Use
pageable
);
int numberOfElements = animals.getNumberOfElements();
int totalElements = (int) animals.getTotalElements();
UserAccount userAccount = userAccountService.getUserAccount(userSecurityDto);
List<AnimalSimpleDto> animalSimpleDtos = animals.getContent().stream()
.map(animal -> {
Expand All @@ -64,7 +65,7 @@ public AnimalSearchDto getAnimals(AnimalFilterCriteria animalFilterCriteria, Use
})
.toList();

AnimalSearchDto response = new AnimalSearchDto(animalSimpleDtos, animalFilterCriteria.page(), numberOfElements);
AnimalSearchDto response = new AnimalSearchDto(animalSimpleDtos, animalFilterCriteria.page(), numberOfElements, totalElements);
return response;
}

Expand Down

0 comments on commit 98ed797

Please sign in to comment.