Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package rootbox.rootboxApp.api.places.business;

public class PlacesMapper {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package rootbox.rootboxApp.api.places.business;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import rootbox.rootboxApp.api.places.implementation.PlacesCommandAdapter;
import rootbox.rootboxApp.api.places.implementation.PlacesQueryAdapter;
import rootbox.rootboxApp.api.places.presentation.dto.PlacesDto;

import java.util.List;

@Slf4j
@Service
@RequiredArgsConstructor
public class PlacesService {

private final PlacesQueryAdapter placesQueryAdapter;

private final PlacesCommandAdapter placesCommandAdapter;

public List<PlacesDto.NearByPlaceDto> getNearByPlaces(double latitude, double longitude
,String category, Integer radius, Integer size, String nextPageToken) {

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package rootbox.rootboxApp.api.places.implementation;

import lombok.extern.slf4j.Slf4j;
import rootbox.rootboxApp.global.annotations.Adapter;

@Slf4j
@Adapter
public class PlacesCommandAdapter {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package rootbox.rootboxApp.api.places.implementation;

import lombok.extern.slf4j.Slf4j;
import rootbox.rootboxApp.global.annotations.Adapter;

@Slf4j
@Adapter
public class PlacesQueryAdapter {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package rootbox.rootboxApp.api.places.presentation;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import rootbox.rootboxApp.api.places.business.PlacesService;
import rootbox.rootboxApp.api.places.presentation.dto.PlacesDto;
import rootbox.rootboxApp.global.common.CommonResponse;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/places")
public class PlacesApi {

private final PlacesService placesService;

@GetMapping("/")
public CommonResponse<List<PlacesDto.NearByPlaceDto>> getNearByPlaces(@RequestParam(required = false) Integer radius
, @RequestParam(required = false) Integer size, @RequestParam(required = false) String nextPageToken
, @RequestParam(required = true) String category
, @RequestParam(required = true) double lat
, @RequestParam(required = true) double lng) {
return CommonResponse.onSuccess(placesService.getNearByPlaces(lat,lng,category,radius,size,nextPageToken));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package rootbox.rootboxApp.api.places.presentation.dto;

import lombok.*;

import java.util.List;

public class PlacesDto {

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public static class NearByPlaceDto {

private String placeName;

private Float latitude;

private Float longitude;

private String openTime;

private Boolean isOpen;

private List<String> photoList;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ public SocialLoginDto.KakaoSocialLoginResponseDto socialLogin(SocialLoginDto.Kak

// 로그인 처리
if (userBySocialId.isPresent()) {
User user = userBySocialId.get();
if (user.getNickname() ==null){
String accessToken = tokenProvider.createAccessToken(user, List.of(new SimpleGrantedAuthority(UserRole.USER.name())));
return SocialLoginDto.KakaoSocialLoginResponseDto
.builder()
.loginType(SocialType.KAKAO.name())
.isNew(true)
.accessToken(accessToken)
.refreshToken(userCommandAdapter.saveRefreshToken(tokenProvider.createRefreshToken(),
user.getSocialLoginUid()).getRefreshToken())
.userSocialId(user.getSocialLoginUid())
.build();
}
Optional<RefreshToken> refreshTokenByUserId = userQueryAdapter.findRefreshTokenByUserId(kakaoUserInfo.getId());

String accessToken = tokenProvider.createAccessToken(userBySocialId.get(), List.of(new SimpleGrantedAuthority(UserRole.USER.name())));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package rootbox.rootboxApp.global.feign.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import rootbox.rootboxApp.global.feign.config.KakaoFeignConfiguration;

@FeignClient(name = "GoogleNearByFeignClient", url = "${oauth.google.baseUrl}", configuration = GoogleNearByFeignClient.class)
@Component
public interface GoogleNearByFeignClient {


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package rootbox.rootboxApp.global.feign.config;

import feign.Logger;
import feign.codec.ErrorDecoder;
import org.springframework.context.annotation.Bean;
import rootbox.rootboxApp.global.feign.exception.FeignClientExceptionErrorDecoder;

public class GoggleFeignConfiguration {
@Bean
public ErrorDecoder errorDecoder() {
return new FeignClientExceptionErrorDecoder();
}

@Bean
Logger.Level feignLoggerLevel() {
return Logger.Level.FULL;
}
}
7 changes: 7 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ oauth:
clientId: ${KAKAO_CLIENT_ID}
redirectUrl : ${KAKAO_REDIRECT_URL}
secretKeyREST: ${KAKAO_SECRET_REST}
google:
baseUrl : ${GOOGLE_BASE_URL}
apiKey : ${GOOGLE_API_KEY}


#cloud:
# aws:
Expand Down Expand Up @@ -150,6 +154,9 @@ oauth:
clientId: ${KAKAO_REST_KEY}
redirectUrl : ${KAKAO_REDIRECT_URL}
secretKeyREST: ${KAKAO_SECRET_REST}
google:
baseUrl : ${GOOGLE_BASE_URL}
apiKey : ${GOOGLE_API_KEY}

#firebase:
# admin-sdk: ${FCM_KEY}
Expand Down