11package cmf .commitField .domain .pet .controller ;
22
33
4+ import cmf .commitField .domain .pet .dto .UserPetDto ;
45import cmf .commitField .domain .pet .entity .Pet ;
5- import cmf .commitField .domain .pet .entity .UserPet ;
66import cmf .commitField .domain .pet .service .PetService ;
77import cmf .commitField .domain .pet .service .UserPetService ;
88import cmf .commitField .domain .user .entity .User ;
99import cmf .commitField .domain .user .service .CustomOAuth2UserService ;
10+ import cmf .commitField .global .globalDto .GlobalResponse ;
1011import lombok .RequiredArgsConstructor ;
1112import org .springframework .web .bind .annotation .*;
1213
@@ -23,16 +24,17 @@ public class UserPetController {
2324
2425 // ์ ์ ๊ฐ ํซ์ ๋ถํ
2526 @ PostMapping ("/hatch" )
26- public UserPet hatchPet (@ RequestParam Long userId , @ RequestParam Long petId ) {
27+ public GlobalResponse < UserPetDto > hatchPet (@ RequestParam Long userId , @ RequestParam Long petId ) {
2728 User user = customOAuth2UserService .getUserById (userId ).orElse (null );
2829 Pet pet = petService .getPetById (petId );
29- return userPetService .hatchPet (user , pet );
30+ UserPetDto userPetDto = new UserPetDto (userPetService .hatchPet (user , pet ));
31+ return GlobalResponse .success (userPetDto );
3032 }
3133
3234 // ์ ์ ์ ๋๊ฐ ์กฐํ (๋ณด์ ํ ํซ ๋ชฉ๋ก)
3335 @ GetMapping ("/collection/{userId}" )
34- public List <Pet > getUserPetCollection (@ PathVariable Long userId ) {
36+ public GlobalResponse < List <Pet > > getUserPetCollection (@ PathVariable Long userId ) {
3537 User user = customOAuth2UserService .getUserById (userId ).orElse (null );
36- return userPetService .getUserPetCollection (user );
38+ return GlobalResponse . success ( userPetService .getUserPetCollection (user ) );
3739 }
3840}
0 commit comments