From 69a3d4dc8c7e6a5a578c3ec17a6bc1a1c9106354 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 19:49:47 +0900 Subject: [PATCH 01/20] =?UTF-8?q?:sparkles:=20Feat:=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=BB=AC=EB=9F=BC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigdata/infou/domain/LectureUdemy.java | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java b/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java index 123da4f..b6441c6 100644 --- a/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java +++ b/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java @@ -4,8 +4,6 @@ import lombok.*; import org.hibernate.annotations.DynamicInsert; -import java.util.Date; - @Entity @Getter @Builder @@ -53,13 +51,13 @@ public class LectureUdemy { @Column(name = "content_length_min") private float contentLengthMin; - @Column(name = "category", length = 255) + @Column(name = "category") private String category; - @Column(name = "subcategory", length = 50) + @Column(name = "subcategory") private String subcategory; - @Column(name = "topic", length = 50) + @Column(name = "topic") private String topic; @Column(name = "language", length = 20) @@ -71,20 +69,9 @@ public class LectureUdemy { @Column(name = "instructor_name", length = 50) private String instructorName; - @Column(name = "instructor_url", columnDefinition = "TEXT") - private String instructorUrl; - @Column(name = "thumbnail", columnDefinition = "TEXT") private String thumbnail; - @Column(name = "published_time") - @Temporal(TemporalType.DATE) - private Date publishedTime; - - @Column(name = "last_update_date") - @Temporal(TemporalType.DATE) - private Date lastUpdateDate; - @ManyToOne(fetch = FetchType.LAZY) private PlatformStudentLecture platformStudentLecture; From 3d9cf02622f1233d2fd89612289f8796db246bb3 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 21:25:31 +0900 Subject: [PATCH 02/20] =?UTF-8?q?:recycle:=20Refactor:=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=EB=B3=84,=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=EB=B3=84=20=EC=B6=94=EC=B2=9C=20=EA=B0=95=EC=A2=8C=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20API=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infou/business/LectureConverter.java | 20 ++++-------- .../bigdata/infou/domain/LectureUdemy.java | 2 +- .../infou/implement/LectureService.java | 12 ++++--- .../repository/LectureUdemyRepository.java | 2 +- .../infou/web/controller/MainController.java | 5 ++- .../infou/web/dto/LectureResponseDTO.java | 31 +++++++++++++++---- 6 files changed, 44 insertions(+), 28 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/business/LectureConverter.java b/src/main/java/khu/bigdata/infou/business/LectureConverter.java index 4599c73..ba08ecb 100644 --- a/src/main/java/khu/bigdata/infou/business/LectureConverter.java +++ b/src/main/java/khu/bigdata/infou/business/LectureConverter.java @@ -1,6 +1,5 @@ package khu.bigdata.infou.business; -import khu.bigdata.infou.domain.LectureTag; import khu.bigdata.infou.domain.LectureUdemy; import khu.bigdata.infou.web.dto.LectureResponseDTO; @@ -12,19 +11,15 @@ public class LectureConverter { public static LectureResponseDTO.CategoryRecommendLectureInfo toCategoryRecommendLectureInfo(LectureUdemy lectureUdemy) { - LectureTag lectureTag = lectureUdemy.getLectureTag(); - return LectureResponseDTO.CategoryRecommendLectureInfo.builder() .lectureId(lectureUdemy.getLectureId()) .title(lectureUdemy.getTitle()) .price(lectureUdemy.getPrice()) .avgRating(lectureUdemy.getAvgRating()) .thumbnail(lectureUdemy.getThumbnail()) - .topword1(lectureTag.getTopword1()) - .topword2(lectureTag.getTopword2()) - .topword3(lectureTag.getTopword3()) - .topword4(lectureTag.getTopword4()) - .topword5(lectureTag.getTopword5()) + .topword1(lectureUdemy.getTopic()) + .topword2(lectureUdemy.getSubcategory()) + .topword3(lectureUdemy.getCategory()) .build(); } @@ -40,7 +35,6 @@ public static LectureResponseDTO.CategoryRecommendLectureDto toCategoryRecommend // 키워드별 추천 강좌 조회 public static LectureResponseDTO.KeywordRecommendLectureInfo toKeywordRecommendLectureInfo(LectureUdemy lectureUdemy) { - LectureTag lectureTag = lectureUdemy.getLectureTag(); return LectureResponseDTO.KeywordRecommendLectureInfo.builder() .lectureId(lectureUdemy.getLectureId()) @@ -48,11 +42,9 @@ public static LectureResponseDTO.KeywordRecommendLectureInfo toKeywordRecommendL .price(lectureUdemy.getPrice()) .avgRating(lectureUdemy.getAvgRating()) .thumbnail(lectureUdemy.getThumbnail()) - .topword1(lectureTag.getTopword1()) - .topword2(lectureTag.getTopword2()) - .topword3(lectureTag.getTopword3()) - .topword4(lectureTag.getTopword4()) - .topword5(lectureTag.getTopword5()) + .topword1(lectureUdemy.getTopic()) + .topword2(lectureUdemy.getSubcategory()) + .topword3(lectureUdemy.getCategory()) .build(); } diff --git a/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java b/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java index b6441c6..72a73f4 100644 --- a/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java +++ b/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java @@ -66,7 +66,7 @@ public class LectureUdemy { @Column(name = "course_url", columnDefinition = "TEXT") private String courseUrl; - @Column(name = "instructor_name", length = 50) + @Column(name = "instructor_name") private String instructorName; @Column(name = "thumbnail", columnDefinition = "TEXT") diff --git a/src/main/java/khu/bigdata/infou/implement/LectureService.java b/src/main/java/khu/bigdata/infou/implement/LectureService.java index 5598e74..588cb2a 100644 --- a/src/main/java/khu/bigdata/infou/implement/LectureService.java +++ b/src/main/java/khu/bigdata/infou/implement/LectureService.java @@ -2,6 +2,7 @@ import khu.bigdata.infou.business.LectureConverter; import khu.bigdata.infou.domain.LectureUdemy; +import khu.bigdata.infou.repository.LectureDetailRepository; import khu.bigdata.infou.repository.LectureInflearnRepository; import khu.bigdata.infou.repository.LectureUdemyRepository; import khu.bigdata.infou.web.dto.LectureResponseDTO; @@ -20,9 +21,10 @@ public class LectureService { private final LectureInflearnRepository lectureInflearnRepository; private final LectureUdemyRepository lectureUdemyRepository; + private final LectureDetailRepository lectureDetailRepository; - // 메인페이지 카테고리별 추천 강좌 조회 + // 카테고리별 추천 강좌 조회 public LectureResponseDTO.CategoryRecommendLectureDto findRecommendedLectureByCategory(String category) { if (category == null) { @@ -33,7 +35,7 @@ public LectureResponseDTO.CategoryRecommendLectureDto findRecommendedLectureByCa // 일단 가져오고 상위 값 추출 List sortedList = lectureUdemyList.stream() - .sorted(Comparator.comparingDouble(lecture -> lecture.getAvgRating() * lecture.getNumReviews())) + .sorted(Comparator.comparingDouble((LectureUdemy lecture) -> lecture.getAvgRating() * lecture.getNumReviews()).reversed()) .collect(Collectors.toList()); return LectureConverter.toCategoryRecommendLectureDto(sortedList); @@ -46,12 +48,12 @@ public LectureResponseDTO.KeywordRecommendLectureDto findRecommendedLectureByKey throw new IllegalArgumentException("Keyword must not be null or empty"); } - // 키워드를 포함하는 강의 목록을 조회 - List lectureUdemyList = lectureUdemyRepository.findAllByTitleContaining(keyword); + // 키워드를 포함하는 강의 목록을 조회(topic 데이터에 있는지 확인) + List lectureUdemyList = lectureUdemyRepository.findAllByTopic(keyword); // 조회된 강의 목록을 AvgRating과 NumReviews의 값을 곱한 값으로 내림차순 정렬 List sortedList = lectureUdemyList.stream() - .sorted(Comparator.comparingDouble(lecture -> lecture.getAvgRating() * lecture.getNumReviews())) + .sorted(Comparator.comparingDouble((LectureUdemy lecture) -> lecture.getAvgRating() * lecture.getNumReviews()).reversed()) .collect(Collectors.toList()); // 조회된 강의 목록을 DTO로 변환하여 반환 diff --git a/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java b/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java index 2c9725f..5532121 100644 --- a/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java +++ b/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java @@ -9,5 +9,5 @@ public interface LectureUdemyRepository extends JpaRepository findAllBySubcategory(String subcategory); - public List findAllByTitleContaining(String keyword); + public List findAllByTopic(String topic); } diff --git a/src/main/java/khu/bigdata/infou/web/controller/MainController.java b/src/main/java/khu/bigdata/infou/web/controller/MainController.java index 1871b91..97a7245 100644 --- a/src/main/java/khu/bigdata/infou/web/controller/MainController.java +++ b/src/main/java/khu/bigdata/infou/web/controller/MainController.java @@ -17,7 +17,7 @@ public class MainController { private final LectureService lectureService; @GetMapping("/lectures/categories") - @Operation(summary = "카테고리별 추천 강좌 조회 API", description = "카테고리: 프로그래밍 언어, 웹 개발, 게임 개발, 모바일 앱 개발, 데이터 사이언스, 인공지능") + @Operation(summary = "카테고리별 추천 강좌 조회 API", description = "카테고리: Programming Languages, Web Development, Game Development, Mobile Development, Data Science") public ResponseEntity getRecommendedLectureByCategory( @RequestParam(name = "category") String category ) { @@ -42,6 +42,9 @@ public ResponseEntity getLectureDetail( return ResponseEntity.ok(lectureService.findLectureDetail()); } + /** + * Todo + */ @GetMapping("/others") @Operation(summary = "다른 수강생들의 커리큘럼 전체 조회 API") public ResponseEntity getOtherStudents() { diff --git a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java index 05b59c5..7c224b6 100644 --- a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java +++ b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java @@ -26,8 +26,7 @@ public static class CategoryRecommendLectureInfo { private String topword1; private String topword2; private String topword3; - private String topword4; - private String topword5; + } @@ -56,8 +55,6 @@ public static class KeywordRecommendLectureInfo { private String topword1; private String topword2; private String topword3; - private String topword4; - private String topword5; } @@ -76,6 +73,20 @@ public static class KeywordRecommendLectureDto { @AllArgsConstructor public static class LectureDetailDto { + private float avgRating; + private String thumbnail; + private String title; + private float price; + private Integer good; + private Integer bad; + private float teaching_quality; + private float reference; + private float practice; + private float rating; + private float level; + private String category; + private String subcategory; + private String topic; } @@ -85,6 +96,10 @@ public static class LectureDetailDto { @AllArgsConstructor public static class OtherStudentsDto { + private String name; + private String category; + private String subcategory; + private String topic; } @@ -94,7 +109,9 @@ public static class OtherStudentsDto { @AllArgsConstructor public static class OtherLectureListDto { - + private String category; + private String subcategory; + private String topic; } @Builder @@ -103,7 +120,9 @@ public static class OtherLectureListDto { @AllArgsConstructor public static class StudentTopwordDto { - + private String category; + private String subcategory; + private String topic; } From 8eea3888cb2e650d4c5fa28ad96792214f83900e Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 21:26:13 +0900 Subject: [PATCH 03/20] =?UTF-8?q?:recycle:=20Refactor:=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=9C=20Swagger=20test=20API=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infou/web/controller/TestController.java | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 src/main/java/khu/bigdata/infou/web/controller/TestController.java diff --git a/src/main/java/khu/bigdata/infou/web/controller/TestController.java b/src/main/java/khu/bigdata/infou/web/controller/TestController.java deleted file mode 100644 index 8160ba1..0000000 --- a/src/main/java/khu/bigdata/infou/web/controller/TestController.java +++ /dev/null @@ -1,17 +0,0 @@ -package khu.bigdata.infou.web.controller; - -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@Tag(name = "TestController", description = "Swagger Test Controller") -@RestController -@RequestMapping("/test") -public class TestController { - - @RequestMapping("/example") - public String example() { - return "example for swagger test"; - } - -} From e37d377606e78c51b2b5089346d88a7ee9c95b1d Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 21:27:26 +0900 Subject: [PATCH 04/20] =?UTF-8?q?chore:=20rds=20url,=20ddl-auto=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 4d47c14..71b3b34 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -7,7 +7,6 @@ spring: jpa: hibernate: ddl-auto: update - # ddl-auto: none properties: hibernate: dialect: org.hibernate.dialect.MySQL8Dialect From 73de8d7f3a343b6cf06fc645890c38c925ea912a Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 21:27:45 +0900 Subject: [PATCH 05/20] =?UTF-8?q?:sparkles:=20Feat:=20=EA=B0=95=EC=A2=8C?= =?UTF-8?q?=20=EC=84=B8=EB=B6=80=20=EC=A1=B0=ED=9A=8C=20API=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigdata/infou/repository/LectureDetailRepository.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java b/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java index e927d70..2ac7ac6 100644 --- a/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java +++ b/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java @@ -1,7 +1,12 @@ package khu.bigdata.infou.repository; import khu.bigdata.infou.domain.LectureDetail; +import khu.bigdata.infou.domain.LectureUdemy; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.Optional; + public interface LectureDetailRepository extends JpaRepository { + + Optional findByLectureUdemy(LectureUdemy lectureUdemy); } From 342faaa79c33f6fbd6ab6af59a778cf6fe17449e Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 21:38:33 +0900 Subject: [PATCH 06/20] =?UTF-8?q?:sparkles:=20Feat:=20ResponseDto=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/khu/bigdata/infou/business/LectureConverter.java | 4 ++-- .../java/khu/bigdata/infou/web/dto/LectureResponseDTO.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/business/LectureConverter.java b/src/main/java/khu/bigdata/infou/business/LectureConverter.java index ba08ecb..7bea0ac 100644 --- a/src/main/java/khu/bigdata/infou/business/LectureConverter.java +++ b/src/main/java/khu/bigdata/infou/business/LectureConverter.java @@ -17,9 +17,9 @@ public static LectureResponseDTO.CategoryRecommendLectureInfo toCategoryRecommen .price(lectureUdemy.getPrice()) .avgRating(lectureUdemy.getAvgRating()) .thumbnail(lectureUdemy.getThumbnail()) + .instructorName(lectureUdemy.getInstructorName()) .topword1(lectureUdemy.getTopic()) .topword2(lectureUdemy.getSubcategory()) - .topword3(lectureUdemy.getCategory()) .build(); } @@ -42,9 +42,9 @@ public static LectureResponseDTO.KeywordRecommendLectureInfo toKeywordRecommendL .price(lectureUdemy.getPrice()) .avgRating(lectureUdemy.getAvgRating()) .thumbnail(lectureUdemy.getThumbnail()) + .instructorName(lectureUdemy.getInstructorName()) .topword1(lectureUdemy.getTopic()) .topword2(lectureUdemy.getSubcategory()) - .topword3(lectureUdemy.getCategory()) .build(); } diff --git a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java index 7c224b6..24a5e0e 100644 --- a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java +++ b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java @@ -22,10 +22,10 @@ public static class CategoryRecommendLectureInfo { private String thumbnail; private String title; private float price; + private String instructorName; private String topword1; private String topword2; - private String topword3; } @@ -51,10 +51,10 @@ public static class KeywordRecommendLectureInfo { private String thumbnail; private String title; private float price; + private String instructorName; private String topword1; private String topword2; - private String topword3; } From dbeba44646abcfec55259a41d7b751a7f5e9c55e Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 21:38:48 +0900 Subject: [PATCH 07/20] =?UTF-8?q?:sparkles:=20Feat:=20Controller=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{MainController.java => MainServiceController.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/main/java/khu/bigdata/infou/web/controller/{MainController.java => MainServiceController.java} (97%) diff --git a/src/main/java/khu/bigdata/infou/web/controller/MainController.java b/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java similarity index 97% rename from src/main/java/khu/bigdata/infou/web/controller/MainController.java rename to src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java index 97a7245..42ad587 100644 --- a/src/main/java/khu/bigdata/infou/web/controller/MainController.java +++ b/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java @@ -12,7 +12,7 @@ @RequiredArgsConstructor @Slf4j @RequestMapping("/api") -public class MainController { +public class MainServiceController { private final LectureService lectureService; @@ -26,7 +26,7 @@ public ResponseEntity getRecomme @GetMapping("/curriculum/recommendation") - @Operation(summary = "선택된 키워드별 추천 강좌 조회 API", description = "유저로부터 입력받은 키워드 4개를 입력받습니다.") + @Operation(summary = "선택된 키워드별 추천 강좌 조회 API", description = "유저로부터 입력받은 키워드와 일치하는 강좌를 조회합니다.") public ResponseEntity getRecommendedLectureByKeyword( @RequestParam(name = "keyword") String keyword ) { From 47ad87d547a1c440803f77f950be5924843fbef2 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 21:41:04 +0900 Subject: [PATCH 08/20] =?UTF-8?q?:sparkles:=20Feat:=20LectureDetailDto=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/khu/bigdata/infou/web/dto/LectureResponseDTO.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java index 24a5e0e..d36b44b 100644 --- a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java +++ b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java @@ -77,6 +77,8 @@ public static class LectureDetailDto { private String thumbnail; private String title; private float price; + private String instructorName; + private Integer good; private Integer bad; private float teaching_quality; @@ -86,8 +88,8 @@ public static class LectureDetailDto { private float level; private String category; private String subcategory; - private String topic; + private String topword; } @Builder From 711800a5ab8b5fb501af4dea284215c3de16265e Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 22:21:00 +0900 Subject: [PATCH 09/20] =?UTF-8?q?:sparkles:=20Feat:=20=EA=B0=95=EC=A2=8C?= =?UTF-8?q?=20=EC=84=B8=EB=B6=80=20=EC=A1=B0=ED=9A=8C=20Converter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infou/business/LectureConverter.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/khu/bigdata/infou/business/LectureConverter.java b/src/main/java/khu/bigdata/infou/business/LectureConverter.java index 7bea0ac..7bac2e5 100644 --- a/src/main/java/khu/bigdata/infou/business/LectureConverter.java +++ b/src/main/java/khu/bigdata/infou/business/LectureConverter.java @@ -1,5 +1,6 @@ package khu.bigdata.infou.business; +import khu.bigdata.infou.domain.LectureDetail; import khu.bigdata.infou.domain.LectureUdemy; import khu.bigdata.infou.web.dto.LectureResponseDTO; @@ -59,4 +60,26 @@ public static LectureResponseDTO.KeywordRecommendLectureDto toKeywordRecommendLe .build(); } + // 강좌 세부 조회 + public static LectureResponseDTO.LectureDetailDto toLectureDetailDto(LectureUdemy lectureUdemy, LectureDetail lectureDetail) { + + return LectureResponseDTO.LectureDetailDto.builder() + .lectureId(lectureUdemy.getLectureId()) + .title(lectureUdemy.getTitle()) + .price(lectureUdemy.getPrice()) + .avgRating(lectureUdemy.getAvgRating()) + .thumbnail(lectureUdemy.getThumbnail()) + .instructorName(lectureUdemy.getInstructorName()) + .category(lectureUdemy.getCategory()) + .subcategory(lectureUdemy.getSubcategory()) + .good(lectureDetail.getGood()) + .bad(lectureDetail.getBad()) + .teaching_quality(lectureDetail.getTeachingQuality()) + .reference(lectureDetail.getReference()) + .practice(lectureDetail.getPractice()) + .rating(lectureDetail.getRating()) + .level(lectureDetail.getLevel()) + .topword(lectureUdemy.getTopic()) + .build(); + } } From 28652a90b509f78867e2188ca0199b31b35f9124 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 22:21:33 +0900 Subject: [PATCH 10/20] =?UTF-8?q?:sparkles:=20Feat:=20=EA=B0=95=EC=A2=8C?= =?UTF-8?q?=20=EC=84=B8=EB=B6=80=20=EC=A1=B0=ED=9A=8C=20API=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigdata/infou/implement/LectureService.java | 17 +++++++++++++++-- .../repository/LectureDetailRepository.java | 2 ++ .../repository/LectureUdemyRepository.java | 3 +++ .../web/controller/MainServiceController.java | 4 ++-- .../infou/web/dto/LectureResponseDTO.java | 1 + 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/implement/LectureService.java b/src/main/java/khu/bigdata/infou/implement/LectureService.java index 588cb2a..3dd8dc6 100644 --- a/src/main/java/khu/bigdata/infou/implement/LectureService.java +++ b/src/main/java/khu/bigdata/infou/implement/LectureService.java @@ -1,6 +1,7 @@ package khu.bigdata.infou.implement; import khu.bigdata.infou.business.LectureConverter; +import khu.bigdata.infou.domain.LectureDetail; import khu.bigdata.infou.domain.LectureUdemy; import khu.bigdata.infou.repository.LectureDetailRepository; import khu.bigdata.infou.repository.LectureInflearnRepository; @@ -60,8 +61,20 @@ public LectureResponseDTO.KeywordRecommendLectureDto findRecommendedLectureByKey return LectureConverter.toKeywordRecommendLectureDto(sortedList); } - public LectureResponseDTO.LectureDetailDto findLectureDetail() { - return null; + // 강좌 세부 조회 + public LectureResponseDTO.LectureDetailDto findLectureDetail(Integer lectureId) { + + // lectureId가 null인 경우에 대한 예외 처리 + if (lectureId == null) { + throw new IllegalArgumentException("LectureId must not be null"); + } + + LectureUdemy lectureUdemy = lectureUdemyRepository.findById(lectureId) + .orElseThrow(() -> new IllegalArgumentException("Lecture not found")); + LectureDetail lectureDetail = lectureDetailRepository.findByLectureUdemy(lectureUdemy) + .orElseThrow(() -> new IllegalArgumentException("Lecture detail not found")); + + return LectureConverter.toLectureDetailDto(lectureUdemy, lectureDetail); } public LectureResponseDTO.OtherStudentsDto findOtherStudents() { diff --git a/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java b/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java index 2ac7ac6..4fd979d 100644 --- a/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java +++ b/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java @@ -9,4 +9,6 @@ public interface LectureDetailRepository extends JpaRepository { Optional findByLectureUdemy(LectureUdemy lectureUdemy); + + Optional findByLectureId(Integer lectureId); } diff --git a/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java b/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java index 5532121..d85241c 100644 --- a/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java +++ b/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java @@ -7,7 +7,10 @@ public interface LectureUdemyRepository extends JpaRepository { + public List findAllBySubcategory(String subcategory); public List findAllByTopic(String topic); + + } diff --git a/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java b/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java index 42ad587..64d4609 100644 --- a/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java +++ b/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java @@ -39,11 +39,11 @@ public ResponseEntity getRecommen public ResponseEntity getLectureDetail( @PathVariable(name = "lectureId") Integer lectureId ) { - return ResponseEntity.ok(lectureService.findLectureDetail()); + return ResponseEntity.ok(lectureService.findLectureDetail(lectureId)); } /** - * Todo + * TODO */ @GetMapping("/others") @Operation(summary = "다른 수강생들의 커리큘럼 전체 조회 API") diff --git a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java index d36b44b..611385c 100644 --- a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java +++ b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java @@ -73,6 +73,7 @@ public static class KeywordRecommendLectureDto { @AllArgsConstructor public static class LectureDetailDto { + private int lectureId; private float avgRating; private String thumbnail; private String title; From 6ab922544f19b446264400da289eb28fc504b69b Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 22:25:02 +0900 Subject: [PATCH 11/20] =?UTF-8?q?:recycle:=20Refactor:=20LectureDerailDto?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infou/web/dto/LectureResponseDTO.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java index 611385c..bb09206 100644 --- a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java +++ b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java @@ -99,10 +99,11 @@ public static class LectureDetailDto { @AllArgsConstructor public static class OtherStudentsDto { + private String userId; private String name; - private String category; - private String subcategory; - private String topic; + private String topword1; + private String topword2; + private String topword3; } @@ -117,16 +118,5 @@ public static class OtherLectureListDto { private String topic; } - @Builder - @Getter - @NoArgsConstructor - @AllArgsConstructor - public static class StudentTopwordDto { - - private String category; - private String subcategory; - private String topic; - } - } From 03bcb03c578c610885fe32fa02ab5667f7db41cc Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 22:28:03 +0900 Subject: [PATCH 12/20] =?UTF-8?q?:recycle:=20Refactor:=20OtherLectureInfoL?= =?UTF-8?q?ist=20=EA=B0=9D=EC=B2=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infou/web/dto/LectureResponseDTO.java | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java index bb09206..fa1989d 100644 --- a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java +++ b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java @@ -107,15 +107,37 @@ public static class OtherStudentsDto { } + @Builder + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static class OtherLectureListInfo { + + private int lectureId; + private float avgRating; + private String thumbnail; + private String title; + private float price; + private String instructorName; + + private String topword1; + private String topword2; + private String topword3; + } + @Builder @Getter @NoArgsConstructor @AllArgsConstructor public static class OtherLectureListDto { - private String category; - private String subcategory; - private String topic; + private String userId; + private String name; + private String topword1; + private String topword2; + private String topword3; + + private List lectureList; } From fdc0a4e735911d2def3ce5a5fdb9281312f7084a Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 22:29:27 +0900 Subject: [PATCH 13/20] =?UTF-8?q?:recycle:=20Refactor:=20=ED=8A=B9?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EA=B0=95=EC=83=9D=20top=20keyword=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infou/web/controller/MainServiceController.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java b/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java index 64d4609..3b44f43 100644 --- a/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java +++ b/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java @@ -58,12 +58,4 @@ public ResponseEntity getOtherLectureLis ) { return ResponseEntity.ok(lectureService.findOtherLectureList()); } - - @GetMapping("/others/{userId}") - @Operation(summary = "특정 수강생의 topword 조회 API", description = "유저로부터 입력받은 키워드 4개를 입력받습니다.") - public ResponseEntity getStudentTopword( - @PathVariable(name = "userId") Integer userId - ) { - return ResponseEntity.ok(lectureService.findStudentTopword()); - } } From 691242d8d439f801a235dd0c6219c9d84720cc58 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Mon, 10 Jun 2024 22:32:41 +0900 Subject: [PATCH 14/20] =?UTF-8?q?:sparkles:=20Feat:=20Udemy,=20Inflearn=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EB=AA=A8=EB=8D=B8=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?repository=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infou/repository/PlatformStudentLectureRepository.java | 7 +++++++ .../infou/repository/PlatformStudentRepository.java | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 src/main/java/khu/bigdata/infou/repository/PlatformStudentLectureRepository.java create mode 100644 src/main/java/khu/bigdata/infou/repository/PlatformStudentRepository.java diff --git a/src/main/java/khu/bigdata/infou/repository/PlatformStudentLectureRepository.java b/src/main/java/khu/bigdata/infou/repository/PlatformStudentLectureRepository.java new file mode 100644 index 0000000..5064077 --- /dev/null +++ b/src/main/java/khu/bigdata/infou/repository/PlatformStudentLectureRepository.java @@ -0,0 +1,7 @@ +package khu.bigdata.infou.repository; + +import khu.bigdata.infou.domain.PlatformStudentLecture; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface PlatformStudentLectureRepository extends JpaRepository { +} diff --git a/src/main/java/khu/bigdata/infou/repository/PlatformStudentRepository.java b/src/main/java/khu/bigdata/infou/repository/PlatformStudentRepository.java new file mode 100644 index 0000000..121fc7c --- /dev/null +++ b/src/main/java/khu/bigdata/infou/repository/PlatformStudentRepository.java @@ -0,0 +1,7 @@ +package khu.bigdata.infou.repository; + +import khu.bigdata.infou.domain.PlatformStudent; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface PlatformStudentRepository extends JpaRepository { +} From bea4d29f717ac7a8201855a7e9e0e69ac81d72d9 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Tue, 11 Jun 2024 00:17:25 +0900 Subject: [PATCH 15/20] =?UTF-8?q?:recycle:=20Refactor:=20swagger=20descrip?= =?UTF-8?q?tion=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../khu/bigdata/infou/web/controller/MainServiceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java b/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java index 3b44f43..f36ebd6 100644 --- a/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java +++ b/src/main/java/khu/bigdata/infou/web/controller/MainServiceController.java @@ -17,7 +17,7 @@ public class MainServiceController { private final LectureService lectureService; @GetMapping("/lectures/categories") - @Operation(summary = "카테고리별 추천 강좌 조회 API", description = "카테고리: Programming Languages, Web Development, Game Development, Mobile Development, Data Science") + @Operation(summary = "카테고리별 추천 강좌 조회 API", description = "카테고리: Programming Language, Web Development, Game Development, Mobile Development, Data Science") public ResponseEntity getRecommendedLectureByCategory( @RequestParam(name = "category") String category ) { From e447945c0f6b0e4ede215d3c6e99beeb86927aba Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Tue, 11 Jun 2024 00:18:20 +0900 Subject: [PATCH 16/20] =?UTF-8?q?:sparkles:=20Feat:=20fetch=20join=20?= =?UTF-8?q?=EC=BF=BC=EB=A6=AC=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigdata/infou/repository/LectureUdemyRepository.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java b/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java index d85241c..82eb4e7 100644 --- a/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java +++ b/src/main/java/khu/bigdata/infou/repository/LectureUdemyRepository.java @@ -2,15 +2,19 @@ import khu.bigdata.infou.domain.LectureUdemy; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import java.util.List; +import java.util.Optional; public interface LectureUdemyRepository extends JpaRepository { - public List findAllBySubcategory(String subcategory); + @Query("select l from LectureUdemy l left join fetch l.lectureTag where l.subcategory = :subcategory") + List findAllBySubcategory(String subcategory); - public List findAllByTopic(String topic); + List findAllByTopic(String topic); + Optional findByLectureId(Long lectureId); } From aae082c0e4512c0fed6480b38bd49ff292126041 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Tue, 11 Jun 2024 00:18:55 +0900 Subject: [PATCH 17/20] :sparkles: Feat: DB indexing --- src/main/java/khu/bigdata/infou/domain/LectureDetail.java | 3 ++- src/main/java/khu/bigdata/infou/domain/LectureUdemy.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/domain/LectureDetail.java b/src/main/java/khu/bigdata/infou/domain/LectureDetail.java index 480bafe..02b278d 100644 --- a/src/main/java/khu/bigdata/infou/domain/LectureDetail.java +++ b/src/main/java/khu/bigdata/infou/domain/LectureDetail.java @@ -11,7 +11,8 @@ @DynamicInsert @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PROTECTED) // 생성 로직 규정 -@Table(name = "lecture_detail") +@Table(name = "lecture_detail", indexes = { + @Index(name = "idx_lecture_id", columnList = "lectureId")}) public class LectureDetail { @Id diff --git a/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java b/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java index 72a73f4..3954ee2 100644 --- a/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java +++ b/src/main/java/khu/bigdata/infou/domain/LectureUdemy.java @@ -10,7 +10,8 @@ @DynamicInsert @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PROTECTED) // 생성 로직 규정 -@Table(name = "lecture_udemy") +@Table(name = "lecture_udemy", indexes = { + @Index(name = "idx_lecture_id", columnList = "lectureId")}) public class LectureUdemy { @Id From c8aaf5de5b065fecfcdf571f92fc60487aa11353 Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Tue, 11 Jun 2024 00:19:32 +0900 Subject: [PATCH 18/20] =?UTF-8?q?:recycle:=20Refactor:=20lectureId=20type?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../khu/bigdata/infou/repository/LectureDetailRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java b/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java index 4fd979d..90d1105 100644 --- a/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java +++ b/src/main/java/khu/bigdata/infou/repository/LectureDetailRepository.java @@ -10,5 +10,5 @@ public interface LectureDetailRepository extends JpaRepository findByLectureUdemy(LectureUdemy lectureUdemy); - Optional findByLectureId(Integer lectureId); + Optional findByLectureId(Long lectureId); } From c97e4062c539f1fb30337ad9a1b589c2d4b3cc5e Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Tue, 11 Jun 2024 00:20:07 +0900 Subject: [PATCH 19/20] =?UTF-8?q?:recycle:=20Refactor:=20LectureDetailDto?= =?UTF-8?q?=20=ED=95=84=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/khu/bigdata/infou/web/dto/LectureResponseDTO.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java index fa1989d..c7629a1 100644 --- a/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java +++ b/src/main/java/khu/bigdata/infou/web/dto/LectureResponseDTO.java @@ -79,6 +79,8 @@ public static class LectureDetailDto { private String title; private float price; private String instructorName; + private String category; + private String subcategory; private Integer good; private Integer bad; @@ -87,8 +89,6 @@ public static class LectureDetailDto { private float practice; private float rating; private float level; - private String category; - private String subcategory; private String topword; } From b05a893959419196fc32d598d7408344f193913d Mon Sep 17 00:00:00 2001 From: yxhwxn Date: Tue, 11 Jun 2024 00:20:42 +0900 Subject: [PATCH 20/20] =?UTF-8?q?:recycle:=20Refactor:=20lectureId=20value?= =?UTF-8?q?Of=20=ED=83=80=EC=9E=85=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/khu/bigdata/infou/implement/LectureService.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/khu/bigdata/infou/implement/LectureService.java b/src/main/java/khu/bigdata/infou/implement/LectureService.java index 3dd8dc6..d8ab677 100644 --- a/src/main/java/khu/bigdata/infou/implement/LectureService.java +++ b/src/main/java/khu/bigdata/infou/implement/LectureService.java @@ -69,9 +69,9 @@ public LectureResponseDTO.LectureDetailDto findLectureDetail(Integer lectureId) throw new IllegalArgumentException("LectureId must not be null"); } - LectureUdemy lectureUdemy = lectureUdemyRepository.findById(lectureId) + LectureUdemy lectureUdemy = lectureUdemyRepository.findByLectureId(Long.valueOf(lectureId)) .orElseThrow(() -> new IllegalArgumentException("Lecture not found")); - LectureDetail lectureDetail = lectureDetailRepository.findByLectureUdemy(lectureUdemy) + LectureDetail lectureDetail = lectureDetailRepository.findByLectureId(Long.valueOf(lectureId)) .orElseThrow(() -> new IllegalArgumentException("Lecture detail not found")); return LectureConverter.toLectureDetailDto(lectureUdemy, lectureDetail); @@ -85,8 +85,4 @@ public LectureResponseDTO.OtherLectureListDto findOtherLectureList() { return null; } - - public LectureResponseDTO.StudentTopwordDto findStudentTopword() { - return null; - } }