-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…-detail-api [BE-FEAT] 단일 특성 정보를 불러오는 API
- Loading branch information
Showing
6 changed files
with
78 additions
and
6 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
6 changes: 6 additions & 0 deletions
6
...ue/src/main/java/com/pokerogue/helper/ability/dto/PokemonAbilityWithPokemonsResponse.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,6 @@ | ||
package com.pokerogue.helper.ability.dto; | ||
|
||
import java.util.List; | ||
|
||
public record PokemonAbilityWithPokemonsResponse(String name, String description, List<SameAbilityPokemonResponse> pokemons) { | ||
} |
22 changes: 22 additions & 0 deletions
22
.../pokerogue/src/main/java/com/pokerogue/helper/ability/dto/SameAbilityPokemonResponse.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,22 @@ | ||
package com.pokerogue.helper.ability.dto; | ||
|
||
import com.pokerogue.helper.pokemon.domain.Pokemon; | ||
import com.pokerogue.helper.type.dto.PokemonTypeResponse; | ||
import java.util.List; | ||
|
||
public record SameAbilityPokemonResponse( | ||
Long id, | ||
Long pokedexNumber, | ||
String name, | ||
String image, | ||
List<PokemonTypeResponse> pokemonTypeResponses | ||
) { | ||
public static SameAbilityPokemonResponse from(Pokemon pokemon, List<PokemonTypeResponse> pokemonTypeResponses) { | ||
Long id = pokemon.getId(); | ||
Long pokedexNumber = pokemon.getPokedexNumber(); | ||
String name = pokemon.getName(); | ||
String image = pokemon.getImage(); | ||
|
||
return new SameAbilityPokemonResponse(id, pokedexNumber, name, image, pokemonTypeResponses); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...rogue/src/main/java/com/pokerogue/helper/ability/repository/PokemonAbilityRepository.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 |
---|---|---|
@@ -1,10 +1,23 @@ | ||
package com.pokerogue.helper.ability.repository; | ||
|
||
import com.pokerogue.helper.ability.domain.PokemonAbility; | ||
|
||
import io.micrometer.common.lang.NonNull; | ||
|
||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
public interface PokemonAbilityRepository extends JpaRepository<PokemonAbility, Long> { | ||
|
||
|
||
@NonNull | ||
@Query(""" | ||
select a from PokemonAbility a | ||
join fetch a.pokemonAbilityMappings m | ||
""") | ||
Optional<PokemonAbility> findByIdWithPokemonMappings(@NonNull @Param("id") Long id); | ||
|
||
Optional<PokemonAbility> findByName(String name); | ||
} |
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