diff --git a/src/main/java/com/t3t/frontserver/book/model/dto/PublisherDto.java b/src/main/java/com/t3t/frontserver/book/model/dto/PublisherDto.java new file mode 100644 index 0000000..98f4f44 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/book/model/dto/PublisherDto.java @@ -0,0 +1,17 @@ +package com.t3t.frontserver.book.model.dto; + +import lombok.Builder; +import lombok.Data; +import lombok.Getter; + +import javax.validation.constraints.NotNull; + +@Data +@Getter +@Builder +public class PublisherDto { + @NotNull + private Long publisherId; + private String publisherName; + private String publisherEmail; +} diff --git a/src/main/java/com/t3t/frontserver/category/controller/CategoryController.java b/src/main/java/com/t3t/frontserver/category/controller/CategoryController.java new file mode 100644 index 0000000..57a8c7c --- /dev/null +++ b/src/main/java/com/t3t/frontserver/category/controller/CategoryController.java @@ -0,0 +1,25 @@ +package com.t3t.frontserver.category.controller; + +import com.t3t.frontserver.category.client.CategoryApiClient; +import com.t3t.frontserver.category.response.CategoryTreeResponse; +import com.t3t.frontserver.model.response.BaseResponse; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +@Slf4j +@RequiredArgsConstructor +@Controller +public class CategoryController { + private final CategoryApiClient categoryApiClient; + + @GetMapping("/categories") + ResponseEntity>> getCategoryTreeByDepth(@RequestParam Integer startDepth, @RequestParam Integer maxDepth) { + return categoryApiClient.getCategoryTreeByDepth(startDepth, maxDepth); + } +} diff --git a/src/main/java/com/t3t/frontserver/participant/client/ParticipantApiClient.java b/src/main/java/com/t3t/frontserver/participant/client/ParticipantApiClient.java new file mode 100644 index 0000000..a2e3a91 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/participant/client/ParticipantApiClient.java @@ -0,0 +1,26 @@ +package com.t3t.frontserver.participant.client; + +import com.t3t.frontserver.model.response.BaseResponse; +import com.t3t.frontserver.model.response.PageResponse; +import com.t3t.frontserver.participant.dto.ParticipantDto; +import com.t3t.frontserver.participant.dto.ParticipantRoleDto; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@FeignClient(name = "categoryApiClient", url = "${t3t.feignClient.url}") +public interface ParticipantApiClient { + + @GetMapping("/t3t/bookstore/participants") + ResponseEntity>> getParticipantList( + @RequestParam(value = "pageNo", defaultValue = "0", required = false) int pageNo, + @RequestParam(value = "pageSize", defaultValue = "10", required = false) int pageSize, + @RequestParam(value = "sortBy", defaultValue = "participantId", required = false) String sortBy); + + @GetMapping("/t3t/bookstore/participantRoles") + ResponseEntity>> getParticipantRoleList( + @RequestParam(value = "pageNo", defaultValue = "0", required = false) int pageNo, + @RequestParam(value = "pageSize", defaultValue = "10", required = false) int pageSize, + @RequestParam(value = "sortBy", defaultValue = "participantRoleId", required = false) String sortBy); +} diff --git a/src/main/java/com/t3t/frontserver/participant/controller/ParticipantController.java b/src/main/java/com/t3t/frontserver/participant/controller/ParticipantController.java new file mode 100644 index 0000000..0932849 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/participant/controller/ParticipantController.java @@ -0,0 +1,38 @@ +package com.t3t.frontserver.participant.controller; + +import com.t3t.frontserver.model.response.BaseResponse; +import com.t3t.frontserver.model.response.PageResponse; +import com.t3t.frontserver.participant.client.ParticipantApiClient; +import com.t3t.frontserver.participant.dto.ParticipantDto; +import com.t3t.frontserver.participant.dto.ParticipantRoleDto; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@Slf4j +@RequiredArgsConstructor +@Controller +public class ParticipantController { + private final ParticipantApiClient participantApiClient; + + @GetMapping("/participants") + ResponseEntity>> getParticipantList( + @RequestParam(value = "pageNo", defaultValue = "0", required = false) int pageNo, + @RequestParam(value = "pageSize", defaultValue = "10", required = false) int pageSize, + @RequestParam(value = "sortBy", defaultValue = "participantId", required = false) String sortBy) { + + return participantApiClient.getParticipantList(pageNo, pageSize, sortBy); + } + + @GetMapping("/participantRoles") + ResponseEntity>> getParticipantRoleList( + @RequestParam(value = "pageNo", defaultValue = "0", required = false) int pageNo, + @RequestParam(value = "pageSize", defaultValue = "10", required = false) int pageSize, + @RequestParam(value = "sortBy", defaultValue = "participantRoleId", required = false) String sortBy) { + + return participantApiClient.getParticipantRoleList(pageNo, pageSize, sortBy); + } +} diff --git a/src/main/java/com/t3t/frontserver/participant/dto/ParticipantDto.java b/src/main/java/com/t3t/frontserver/participant/dto/ParticipantDto.java new file mode 100644 index 0000000..cb30e38 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/participant/dto/ParticipantDto.java @@ -0,0 +1,21 @@ +package com.t3t.frontserver.participant.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 도서 참여자에 대한 데이터 전송 객체(DTO)
+ * 각 객체는 도서 참여자의 식별자(ID)와 이름, 이메일을 가지고 있음 + * @author Yujin-nKim(김유진) + */ +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ParticipantDto { + private Long id; + private String name; + private String email; +} diff --git a/src/main/java/com/t3t/frontserver/participant/dto/ParticipantRoleDto.java b/src/main/java/com/t3t/frontserver/participant/dto/ParticipantRoleDto.java new file mode 100644 index 0000000..28ccf2b --- /dev/null +++ b/src/main/java/com/t3t/frontserver/participant/dto/ParticipantRoleDto.java @@ -0,0 +1,21 @@ +package com.t3t.frontserver.participant.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +/** + * 도서 참여자 역할에 대한 데이터 전송 객체(DTO)
+ * 각 객체는 도서 참여자 역할의 식별자(ID)와 영어 이름, 한국어 이름을 가지고 있음 + * @author Yujin-nKim(김유진) + */ +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ParticipantRoleDto { + private Integer id; + private String roleNameEn; + private String roleNameKr; +} diff --git a/src/main/java/com/t3t/frontserver/publishers/client/PublisherApiClient.java b/src/main/java/com/t3t/frontserver/publishers/client/PublisherApiClient.java new file mode 100644 index 0000000..97548ac --- /dev/null +++ b/src/main/java/com/t3t/frontserver/publishers/client/PublisherApiClient.java @@ -0,0 +1,18 @@ +package com.t3t.frontserver.publishers.client; + +import com.t3t.frontserver.book.model.dto.PublisherDto; +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.RequestParam; + +@FeignClient(name = "publisherApiClient", url = "${t3t.feignClient.url}") +public interface PublisherApiClient { + @GetMapping("t3t/bookstore/publishers") + ResponseEntity>> getPublisherList( + @RequestParam(value = "pageNo", defaultValue = "0", required = false) int pageNo, + @RequestParam(value = "pageSize", defaultValue = "10", required = false) int pageSize, + @RequestParam(value = "sortBy", defaultValue = "publisherId", required = false) String sortBy); +} diff --git a/src/main/java/com/t3t/frontserver/publishers/controller/PublisherController.java b/src/main/java/com/t3t/frontserver/publishers/controller/PublisherController.java new file mode 100644 index 0000000..9b40ca2 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/publishers/controller/PublisherController.java @@ -0,0 +1,29 @@ +package com.t3t.frontserver.publishers.controller; + +import com.t3t.frontserver.book.model.dto.PublisherDto; +import com.t3t.frontserver.model.response.BaseResponse; +import com.t3t.frontserver.model.response.PageResponse; +import com.t3t.frontserver.publishers.client.PublisherApiClient; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@Slf4j +@RequiredArgsConstructor +@Controller +public class PublisherController { + + private final PublisherApiClient publisherApiClient; + + @GetMapping("/publishers") + public ResponseEntity>> getPublisherList( + @RequestParam(value = "pageNo", defaultValue = "0", required = false) int pageNo, + @RequestParam(value = "pageSize", defaultValue = "10", required = false) int pageSize, + @RequestParam(value = "sortBy", defaultValue = "publisherId", required = false) String sortBy) { + + return publisherApiClient.getPublisherList(pageNo, pageSize, sortBy); + } +} diff --git a/src/main/java/com/t3t/frontserver/tag/client/TagApiClient.java b/src/main/java/com/t3t/frontserver/tag/client/TagApiClient.java new file mode 100644 index 0000000..a8dfdc4 --- /dev/null +++ b/src/main/java/com/t3t/frontserver/tag/client/TagApiClient.java @@ -0,0 +1,20 @@ +package com.t3t.frontserver.tag.client; + +import com.t3t.frontserver.book.model.dto.TagDto; +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.RequestParam; + +@FeignClient(name = "tagApiClient", url = "${t3t.feignClient.url}") +public interface TagApiClient { + + @GetMapping(value = "/t3t/bookstore/tags") + ResponseEntity>> getTagList( + @RequestParam(value = "pageNo", defaultValue = "0", required = false) int pageNo, + @RequestParam(value = "pageSize", defaultValue = "10", required = false) int pageSize, + @RequestParam(value = "sortBy", defaultValue = "tagId", required = false) String sortBy); + +} diff --git a/src/main/java/com/t3t/frontserver/tag/controller/TagController.java b/src/main/java/com/t3t/frontserver/tag/controller/TagController.java new file mode 100644 index 0000000..e16badc --- /dev/null +++ b/src/main/java/com/t3t/frontserver/tag/controller/TagController.java @@ -0,0 +1,28 @@ +package com.t3t.frontserver.tag.controller; + +import com.t3t.frontserver.book.model.dto.TagDto; +import com.t3t.frontserver.model.response.BaseResponse; +import com.t3t.frontserver.model.response.PageResponse; +import com.t3t.frontserver.tag.client.TagApiClient; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@Slf4j +@RequiredArgsConstructor +@Controller +public class TagController { + private final TagApiClient tagApiClient; + + @GetMapping("/tags") + public ResponseEntity>> getTagList( + @RequestParam(value = "pageNo", defaultValue = "0", required = false) int pageNo, + @RequestParam(value = "pageSize", defaultValue = "10", required = false) int pageSize, + @RequestParam(value = "sortBy", defaultValue = "tagId", required = false) String sortBy) { + + return tagApiClient.getTagList(pageNo, pageSize, sortBy); + } +} diff --git a/src/main/resources/static/assets/admin/js/api.js b/src/main/resources/static/assets/admin/js/api.js index 2e5d17d..9c7453d 100644 --- a/src/main/resources/static/assets/admin/js/api.js +++ b/src/main/resources/static/assets/admin/js/api.js @@ -12,8 +12,7 @@ const APP_KEY = document.querySelector("#appKey").getAttribute("data-contextPath */ function fetchPublishersAndUpdateModal() { $.ajax({ - // url: 'http://localhost:8081/publishers', - url: APP_KEY + '/t3t/bookstore/publishers', + url : '/publishers', type: 'GET', data: { pageNo: currentPage, @@ -47,8 +46,7 @@ function fetchPublishersAndUpdateModal() { */ function fetchParticipantsAndUpdateModal() { $.ajax({ - // url: 'http://localhost:8081/participants', - url: APP_KEY + '/t3t/bookstore/participants', + url: '/participants', type: 'GET', data: { pageNo: currentPage, @@ -82,8 +80,7 @@ function fetchParticipantsAndUpdateModal() { */ function fetchParticipantRolesAndUpdateModal() { $.ajax({ - // url: 'http://localhost:8081/participantRoles', - url: APP_KEY + '/t3t/bookstore/participantRoles', + url: '/participantRoles', type: 'GET', data: { pageNo: currentPage, @@ -116,8 +113,7 @@ function fetchParticipantRolesAndUpdateModal() { */ function fetchCategoriesAndUpdateModal(startDepth, maxDepth) { $.ajax({ - // url: 'http://localhost:8081/categories', - url: APP_KEY + '/t3t/bookstore/categories', + url: '/categories', type: 'GET', data: { startDepth: startDepth, @@ -148,8 +144,7 @@ function fetchCategoriesAndUpdateModal(startDepth, maxDepth) { */ function fetchTagsAndUpdateModal() { $.ajax({ - // url: 'http://localhost:8081/tags', - url: APP_KEY + '/t3t/bookstore/tags', + url: '/tags', type: 'GET', data: { pageNo: currentPage, diff --git a/src/main/resources/templates/main/page/detail.html b/src/main/resources/templates/main/page/detail.html index 1318191..2d0049a 100644 --- a/src/main/resources/templates/main/page/detail.html +++ b/src/main/resources/templates/main/page/detail.html @@ -5,6 +5,12 @@ layout:decorate="main/layout/layout"> + + + + + +
@@ -71,7 +77,8 @@

Book Name

-

Lorem ipsum dolor sit amet consectetur adipisicing elit. Praesentium at dolorem quidem modi. Nam sequi consequatur obcaecati excepturi alias magni, accusamus eius blanditiis delectus ipsam minima ea iste laborum vero?

+ +
@@ -170,7 +177,8 @@

도서 기본 정보

도서 목차

-

+ +
@@ -217,5 +225,29 @@

등록된 리뷰가 없습니다.

+ +
\ No newline at end of file