Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public class PublicCourse extends AuditingTimeEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;



@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "course_id", nullable = false)
private Course course;
Expand All @@ -42,7 +40,7 @@ public class PublicCourse extends AuditingTimeEntity {
private List<Record> records = new ArrayList<>();

@Formula("(select count(*) from Scrap where Scrap.public_course_id=id and Scrap.scraptf=true)")
private Integer scrapCount;
private Long scrapCount;

@Transient
private Boolean isScrap=false; //현재 사용자가 스크랩한지 아닌지 여부
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,6 @@ public GetPublicCourseDetailResponseDto getPublicCourseDetail(final Long userId,
}
}

//4. 해당 공개코스가 얼마나 스크랩되었는지 가져오기
Long scrapCount = scrapRepository.countByPublicCourseAndScrapTFIsTrue(publicCourse);

//5. 삭제된 유저인 경우 처리 user=null일때
RunnectUser uploader = course.getRunnectUser();
Expand All @@ -279,13 +277,13 @@ public GetPublicCourseDetailResponseDto getPublicCourseDetail(final Long userId,
if (course.getDepartureName() == null) {
return GetPublicCourseDetailResponseDto.of(
uploader.getId(), uploader.getNickname(), uploader.getLevel(), uploader.getLatestStamp().toString(), uploader.equals(user),
publicCourse.getId(), course.getId(), publicCourse.getIsScrap(), scrapCount, course.getImage(), publicCourse.getTitle(), publicCourse.getDescription(),
publicCourse.getId(), course.getId(), publicCourse.getIsScrap(), publicCourse.getScrapCount(), course.getImage(), publicCourse.getTitle(), publicCourse.getDescription(),
CoordinatePathConverter.pathConvertCoor(course.getPath()), course.getDistance(), course.getDepartureRegion(), course.getDepartureCity(), course.getDepartureTown());
}

return GetPublicCourseDetailResponseDto.of(
uploader.getId(), uploader.getNickname(), uploader.getLevel(), uploader.getLatestStamp().toString(), uploader.equals(user),
publicCourse.getId(), course.getId(), publicCourse.getIsScrap(), scrapCount, course.getImage(), publicCourse.getTitle(), publicCourse.getDescription(),
publicCourse.getId(), course.getId(), publicCourse.getIsScrap(), publicCourse.getScrapCount(), course.getImage(), publicCourse.getTitle(), publicCourse.getDescription(),
CoordinatePathConverter.pathConvertCoor(course.getPath()), course.getDistance(), course.getDepartureRegion(), course.getDepartureCity(), course.getDepartureTown(), course.getDepartureName());


Expand Down