-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/point_details
Merge branch 'develop' into feature/point_details Update point details feature with changes from develop branch.
- Loading branch information
Showing
72 changed files
with
3,807 additions
and
285 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
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
20 changes: 2 additions & 18 deletions
20
src/main/java/com/t3t/frontserver/auth/exception/RestApiClientException.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,26 +1,10 @@ | ||
package com.t3t.frontserver.auth.exception; | ||
|
||
import feign.Response; | ||
import lombok.Getter; | ||
|
||
import java.io.IOException; | ||
|
||
@Getter | ||
public class RestApiClientException extends RuntimeException{ | ||
private String responseBody; | ||
private int status; | ||
private String message; | ||
|
||
public RestApiClientException(Response response) { | ||
super(); | ||
this.status = response.status(); | ||
this.message = response.reason(); | ||
|
||
try{ | ||
this.responseBody = response.body() != null ? new String(response.body().asInputStream().readAllBytes()) : null; | ||
} catch (IOException e){ | ||
this.responseBody = null; | ||
} | ||
|
||
public RestApiClientException(String message) { | ||
super(message); | ||
} | ||
} |
94 changes: 86 additions & 8 deletions
94
src/main/java/com/t3t/frontserver/book/client/BookApiClient.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,20 +1,98 @@ | ||
package com.t3t.frontserver.book.client; | ||
|
||
import com.t3t.frontserver.book.model.request.BookRegisterRequest; | ||
import com.t3t.frontserver.book.model.dto.ParticipantMapDto; | ||
import com.t3t.frontserver.book.model.request.ModifyBookDetailRequest; | ||
import com.t3t.frontserver.book.model.response.BookDetailResponse; | ||
import com.t3t.frontserver.book.model.response.BookListResponse; | ||
import com.t3t.frontserver.model.response.BaseResponse; | ||
import com.t3t.frontserver.model.response.PageResponse; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@FeignClient(name = "bookAdaptor", url = "${t3t.feignClient.url}") | ||
import javax.validation.Valid; | ||
import java.util.List; | ||
|
||
@FeignClient(name = "bookApiClient", url = "${t3t.feignClient.url}") | ||
public interface BookApiClient { | ||
/** | ||
* 책의 상세 정보를 조회 | ||
* @param bookId 도서의 ID | ||
* @return 200 OK, 성공 메세지 | ||
*/ | ||
@GetMapping(value = "/t3t/bookstore/books/{bookId}") | ||
ResponseEntity<BaseResponse<BookDetailResponse>> getBook(@PathVariable Long bookId); | ||
|
||
// @PostMapping(value = "/t3t/bookstore/books") | ||
// ResponseEntity<BaseResponse<Void>> createBook(@RequestBody BookRegisterRequest request); | ||
/** | ||
* 도서 목록을 페이징하여 가져오는 요청을 처리 | ||
* @param pageNo 페이지 번호 | ||
* @param pageSize 페이지 크기 | ||
* @return 도서 목록과 관련된 응답 데이터를 포함하는 ResponseEntity | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@GetMapping(value = "/t3t/bookstore/books") | ||
ResponseEntity<BaseResponse<PageResponse<BookListResponse>>> getAllBooks(@RequestParam int pageNo, @RequestParam int pageSize); | ||
|
||
/** | ||
* 특정 도서의 상세 정보를 수정 | ||
* @param bookId 수정할 도서의 식별자 | ||
* @param request 수정할 도서의 상세 정보를 담은 요청 객체 | ||
* @return 200 OK, 성공 메세지 | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@PutMapping(value = "/t3t/bookstore/books/{bookId}/book-detail") | ||
ResponseEntity<BaseResponse<Void>> updateBookDetail(@PathVariable Long bookId, | ||
@RequestBody @Valid ModifyBookDetailRequest request); | ||
|
||
/** | ||
* 특정 도서의 출판사 정보를 수정 | ||
* @param bookId 수정할 도서의 식별자 | ||
* @param publisherId 수정할 출판사의 id | ||
* @return 200 OK, 성공 메세지 | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@PutMapping("/t3t/bookstore/books/{bookId}/publisher") | ||
ResponseEntity<BaseResponse<Void>> updateBookPublisher(@PathVariable Long bookId, | ||
@RequestParam Long publisherId); | ||
|
||
/** | ||
* 특정 도서의 참여자를 수정 | ||
* @param bookId 수정할 도서의 식별자 | ||
* @param participantList 수정할 참여자 매핑 리스트 | ||
* @return 200 OK, 성공 메세지 | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@PutMapping("/t3t/bookstore/books/{bookId}/participant") | ||
ResponseEntity<BaseResponse<Void>> updateBookParticipant(@PathVariable Long bookId, | ||
@RequestBody @Valid List<ParticipantMapDto> participantList); | ||
|
||
/** | ||
* 특정 도서의 태그를 수정 | ||
* @param bookId 수정할 도서의 식별자 | ||
* @param tagList 수정할 태그 리스트 | ||
* @return 200 OK, 성공 메세지 | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@PutMapping("/t3t/bookstore/books/{bookId}/tag") | ||
ResponseEntity<BaseResponse<Void>> updateBookTag(@PathVariable Long bookId, | ||
@RequestBody @Valid List<Long> tagList); | ||
|
||
/** | ||
* 특정 도서의 카테고리를 수정 | ||
* @param bookId 수정할 도서의 식별자 | ||
* @param categoryList 수정할 카테고리 리스트 | ||
* @return 200 OK, 성공 메세지 | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@PutMapping("/t3t/bookstore/books/{bookId}/category") | ||
ResponseEntity<BaseResponse<Void>> updateBookCategory(@PathVariable Long bookId, | ||
@RequestBody @Valid List<Integer> categoryList); | ||
|
||
/** | ||
* 도서 삭제 요청을 처리 | ||
* @param bookId 삭제하고자 하는 도서 id | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@DeleteMapping(value = "/t3t/bookstore/books/{bookId}") | ||
ResponseEntity<BaseResponse<Void>> deleteBook(@PathVariable Long bookId); | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/com/t3t/frontserver/book/client/BookFormApiClient.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,55 @@ | ||
package com.t3t.frontserver.book.client; | ||
|
||
import com.t3t.frontserver.book.model.request.RegisterBookRequest; | ||
import com.t3t.frontserver.config.FormConfiguration; | ||
import com.t3t.frontserver.model.response.BaseResponse; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Feign을 사용하여 멀티파트 폼 데이터를 전송하는 BookFormApiClient 인터페이스 | ||
* 이 인터페이스는 Feign을 사용하여 원격 서버에 HTTP 요청을 보내고, BookRegisterRequest 객체를 멀티파트 폼 데이터로 전송함 | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@FeignClient(name = "bookFormApiClient", url = "${t3t.feignClient.url}", configuration = FormConfiguration.class) | ||
public interface BookFormApiClient { | ||
|
||
/** | ||
* 새 책을 생성하는 POST 요청 | ||
* 요청 바디에는 BookRegisterRequest 객체가 멀티파트 폼 데이터로 전송됨 | ||
* | ||
* @param request 책을 등록하기 위한 요청 객체 | ||
* @return 책 생성 요청에 대한 응답 | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@PostMapping(value = "/t3t/bookstore/books", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||
ResponseEntity<BaseResponse<Long>> createBook(@ModelAttribute RegisterBookRequest request); | ||
|
||
/** | ||
* 특정 도서의 썸네일을 수정 | ||
* @param bookId 수정할 도서의 식별자 | ||
* @param image 수정할 썸네일 이미지 | ||
* @return 200 OK, 성공 메세지 | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@PutMapping(value = "/t3t/bookstore/books/{bookId}/book-thumbnail", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | ||
ResponseEntity<BaseResponse<Void>> updateBookThumbnail(@PathVariable Long bookId, | ||
@ModelAttribute MultipartFile image); | ||
|
||
/** | ||
* 특정 도서의 이미지를 수정 | ||
* @param bookId 수정할 도서의 식별자 | ||
* @param imageList 수정할 이미지 리스트 | ||
* @return 200 OK, 성공 메세지 | ||
* @author Yujin-nKim(김유진) | ||
*/ | ||
@PutMapping("/t3t/bookstore/books/{bookId}/book-image") | ||
ResponseEntity<BaseResponse<Void>> updateBookImage(@PathVariable Long bookId, | ||
@ModelAttribute List<MultipartFile> imageList); | ||
|
||
} |
Oops, something went wrong.