Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Course 상세 조회 CoursePlace 순서 오류 해결 - #288 #290

Merged
merged 2 commits into from
Sep 28, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/CICD-main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CICD
name: CICD-MAIN

on:
push:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -270,7 +271,7 @@ public CourseGetDetailRes getCourseDetail(final Long userId, final Long courseId
imageList.getSequence())
).toList();

List<CoursePlace> foundCoursePlaces = coursePlaceRepository.findAllCoursePlacesByCourseId(foundCourse.getId());
List<CoursePlace> foundCoursePlaces = coursePlaceRepository.findAllCoursePlacesByCourseId(foundCourse.getId(), Sort.by(Sort.Direction.ASC, "sequence"));
validateCoursePlace(foundCoursePlaces);

List<CourseGetDetailRes.Places> places = foundCoursePlaces.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.List;
import org.dateroad.place.domain.CoursePlace;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
Expand All @@ -14,7 +15,7 @@ public interface CoursePlaceRepository extends JpaRepository<CoursePlace,Long> {
@Query("SELECT SUM(p.duration) FROM CoursePlace p WHERE p.course.id = :courseId")
Integer findTotalDurationByCourseId(@Param("courseId") Long courseId);

List<CoursePlace> findAllCoursePlacesByCourseId(Long courseId);
List<CoursePlace> findAllCoursePlacesByCourseId(Long courseId, Sort sort);

@Modifying
@Transactional
Expand Down
Loading