-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 보호 동물 검색 조회 로직을 구현한다.(봉사자) (#145)
* feat: AnimalRepositoryCustom.findAnimalsByVolunteer 를 구현한다. * feat: AnimalService.findAnimalsByVolunteer 를 구현한다. * feat: AnimalController.findAnimalByIdByVolunteer 를 구현한다. * feat: 보호 동물 리스트 조회 시 createdAt 기준으로 정렬한다. * fix: 잘못된 count 쿼리 사용을 수정한다.
- Loading branch information
1 parent
a502325
commit d24a57f
Showing
10 changed files
with
605 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...in/java/com/clova/anifriends/domain/animal/dto/request/FindAnimalsByVolunteerRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.clova.anifriends.domain.animal.dto.request; | ||
|
||
import com.clova.anifriends.domain.animal.AnimalAge; | ||
import com.clova.anifriends.domain.animal.AnimalSize; | ||
import com.clova.anifriends.domain.animal.wrapper.AnimalActive; | ||
import com.clova.anifriends.domain.animal.wrapper.AnimalGender; | ||
import com.clova.anifriends.domain.animal.wrapper.AnimalType; | ||
|
||
public record FindAnimalsByVolunteerRequest( | ||
AnimalType type, | ||
AnimalGender gender, | ||
Boolean isNeutered, | ||
AnimalActive active, | ||
AnimalSize size, | ||
AnimalAge age | ||
) { | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
.../java/com/clova/anifriends/domain/animal/dto/response/FindAnimalsByVolunteerResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.clova.anifriends.domain.animal.dto.response; | ||
|
||
import com.clova.anifriends.domain.animal.Animal; | ||
import com.clova.anifriends.domain.common.PageInfo; | ||
import java.util.List; | ||
import org.springframework.data.domain.Page; | ||
|
||
public record FindAnimalsByVolunteerResponse( | ||
PageInfo pageInfo, | ||
List<FindAnimalByVolunteerResponse> animals | ||
) { | ||
|
||
public record FindAnimalByVolunteerResponse( | ||
Long animalId, | ||
String animalName, | ||
String shelterName, | ||
String shelterAddress, | ||
String animalImageUrl | ||
) { | ||
|
||
public static FindAnimalByVolunteerResponse from(Animal animal) { | ||
return new FindAnimalByVolunteerResponse( | ||
animal.getAnimalId(), | ||
animal.getName(), | ||
animal.getShelter().getName(), | ||
animal.getShelter().getAddress(), | ||
animal.getImageUrls().get(0) | ||
); | ||
} | ||
} | ||
|
||
public static FindAnimalsByVolunteerResponse from(Page<Animal> pagination) { | ||
PageInfo pageInfo = PageInfo.of(pagination.getTotalElements(), pagination.hasNext()); | ||
List<FindAnimalByVolunteerResponse> findAnimalByVolunteerResponses = pagination.get() | ||
.map(FindAnimalByVolunteerResponse::from).toList(); | ||
|
||
return new FindAnimalsByVolunteerResponse(pageInfo, findAnimalByVolunteerResponses); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.