Skip to content

Commit

Permalink
[ADD]
Browse files Browse the repository at this point in the history
  • Loading branch information
jinjoo-lab committed Sep 18, 2023
1 parent 7b6fad4 commit d8de5c4
Show file tree
Hide file tree
Showing 19 changed files with 108 additions and 28 deletions.
2 changes: 1 addition & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'
implementation 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
runtimeOnly 'com.h2database:h2:1.4.200'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import com.twtw.backend.global.properties.KakaoProperties;
import com.twtw.backend.global.properties.NaverProperties;

import com.twtw.backend.global.properties.TmapProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({NaverProperties.class, KakaoProperties.class})
@EnableConfigurationProperties({NaverProperties.class, KakaoProperties.class, TmapProperties.class})
public class PropertiesConfig {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.twtw.backend.domain.path.client;

import com.twtw.backend.domain.path.dto.client.SearchPathRequest;
import com.twtw.backend.domain.path.dto.client.SearchPathResponse;
import com.twtw.backend.domain.path.dto.client.car.SearchCarPathRequest;
import com.twtw.backend.domain.path.dto.client.car.SearchCarPathResponse;
import com.twtw.backend.global.client.MapClient;
import com.twtw.backend.global.exception.WebClientResponseException;
import com.twtw.backend.global.properties.NaverProperties;
Expand All @@ -15,17 +15,17 @@
import java.nio.charset.StandardCharsets;

@Component
public class SearchPathClient implements MapClient<SearchPathRequest, SearchPathResponse> {
public class SearchCarPathClient implements MapClient<SearchCarPathRequest, SearchCarPathResponse> {
private final WebClient webClient;
private final NaverProperties naverProperties;

public SearchPathClient(final WebClient webClient, final NaverProperties naverProperties) {
public SearchCarPathClient(final WebClient webClient, final NaverProperties naverProperties) {
this.webClient = webClient;
this.naverProperties = naverProperties;
}

/*상세 검색을 위한 변경 필요*/
private URI getPathUri(final SearchPathRequest request, final UriBuilder uriBuilder) {
private URI getPathUri(final SearchCarPathRequest request, final UriBuilder uriBuilder) {

final UriBuilder builder =
uriBuilder
Expand All @@ -47,7 +47,7 @@ private URI getPathUri(final SearchPathRequest request, final UriBuilder uriBuil
}

@Override
public SearchPathResponse request(final SearchPathRequest request) {
public SearchCarPathResponse request(final SearchCarPathRequest request) {
return webClient
.get()
.uri(uri -> getPathUri(request, uri))
Expand All @@ -56,7 +56,7 @@ public SearchPathResponse request(final SearchPathRequest request) {
.header(naverProperties.getHeaderClientId(), naverProperties.getId())
.header(naverProperties.getHeaderClientSecret(), naverProperties.getSecret())
.retrieve()
.bodyToMono(SearchPathResponse.class)
.bodyToMono(SearchCarPathResponse.class)
.blockOptional()
.orElseThrow(WebClientResponseException::new);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.twtw.backend.domain.path.client;

import com.twtw.backend.domain.path.dto.client.ped.SearchPedPathRequest;
import com.twtw.backend.domain.path.dto.client.ped.SearchPedPathResponse;
import com.twtw.backend.global.client.MapClient;
import com.twtw.backend.global.properties.TmapProperties;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.client.WebClient;

@Component
public class SearchPedPathClient implements MapClient<SearchPedPathRequest, SearchPedPathResponse> {

private final WebClient webClient;
private final TmapProperties tmapProperties;

public SearchPedPathClient(final WebClient webClient,final TmapProperties tmapProperties){
this.webClient = webClient;
this.tmapProperties = tmapProperties;
}

@Override
public SearchPedPathResponse request(SearchPedPathRequest request) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.twtw.backend.domain.path.controller;

import com.twtw.backend.domain.path.dto.client.SearchPathRequest;
import com.twtw.backend.domain.path.dto.client.SearchPathResponse;
import com.twtw.backend.domain.path.dto.client.car.SearchCarPathRequest;
import com.twtw.backend.domain.path.dto.client.car.SearchCarPathResponse;
import com.twtw.backend.domain.path.service.PathService;

import org.springframework.http.ResponseEntity;
Expand All @@ -18,7 +18,7 @@ public PathController(PathService pathService) {

/*response 변경*/
@PostMapping("/search")
public ResponseEntity<SearchPathResponse> searchPath(@RequestBody SearchPathRequest request) {
public ResponseEntity<SearchCarPathResponse> searchPath(@RequestBody SearchCarPathRequest request) {
return ResponseEntity.ok(pathService.searchPath(request));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twtw.backend.domain.path.dto.client;
package com.twtw.backend.domain.path.dto.client.car;

import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twtw.backend.domain.path.dto.client;
package com.twtw.backend.domain.path.dto.client.car;

import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twtw.backend.domain.path.dto.client;
package com.twtw.backend.domain.path.dto.client.car;

import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twtw.backend.domain.path.dto.client;
package com.twtw.backend.domain.path.dto.client.car;

import lombok.AllArgsConstructor;
import lombok.Getter;
Expand All @@ -7,7 +7,7 @@
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class SearchPathRequest {
public class SearchCarPathRequest {
private String start;
private String end;
private String way;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twtw.backend.domain.path.dto.client;
package com.twtw.backend.domain.path.dto.client.car;

import lombok.AllArgsConstructor;
import lombok.Getter;
Expand All @@ -9,7 +9,7 @@
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class SearchPathResponse {
public class SearchCarPathResponse {
private int code;
private String message;
private String currentDateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twtw.backend.domain.path.dto.client;
package com.twtw.backend.domain.path.dto.client.car;

import lombok.RequiredArgsConstructor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twtw.backend.domain.path.dto.client;
package com.twtw.backend.domain.path.dto.client.car;

import lombok.RequiredArgsConstructor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twtw.backend.domain.path.dto.client;
package com.twtw.backend.domain.path.dto.client.car;

import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twtw.backend.domain.path.dto.client;
package com.twtw.backend.domain.path.dto.client.car;

import lombok.AllArgsConstructor;
import lombok.Getter;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.twtw.backend.domain.path.dto.client.ped;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class Geometry {
private String type;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.twtw.backend.domain.path.dto.client.ped;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class SearchPedPathRequest {
private String startX;
private String startY;
private String endX;
private String endY;
private String startName;
private String endName;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.twtw.backend.domain.path.dto.client.ped;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class SearchPedPathResponse {
private String type;

}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.twtw.backend.domain.path.service;

import com.twtw.backend.domain.path.dto.client.SearchPathRequest;
import com.twtw.backend.domain.path.dto.client.SearchPathResponse;
import com.twtw.backend.domain.path.dto.client.car.SearchCarPathRequest;
import com.twtw.backend.domain.path.dto.client.car.SearchCarPathResponse;
import com.twtw.backend.global.client.MapClient;

import org.springframework.stereotype.Service;

@Service
public class PathService {
private final MapClient<SearchPathRequest, SearchPathResponse> client;
private final MapClient<SearchCarPathRequest, SearchCarPathResponse> client;

public PathService(MapClient<SearchPathRequest, SearchPathResponse> client) {
public PathService(MapClient<SearchCarPathRequest, SearchCarPathResponse> client) {
this.client = client;
}

public SearchPathResponse searchPath(final SearchPathRequest request) {
public SearchCarPathResponse searchPath(final SearchCarPathRequest request) {
return this.client.request(request);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.twtw.backend.global.properties;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Getter
@RequiredArgsConstructor
@ConfigurationProperties(prefix = "tmap")
public class TmapProperties {
private final String appKey;
}

0 comments on commit d8de5c4

Please sign in to comment.