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 @@ -172,8 +172,14 @@ public LessonApplicationResponseDto applyToLesson(Long lessonId, Long userId) {
throw new BusinessException(ErrorCode.LESSON_NOT_AVAILABLE);
}



// 선착순 여부에 따라 저장 처리 분기
if (lesson.getOpenRun()) {
// 신청 시간 체크
if (java.time.LocalDateTime.now().isBefore(lesson.getOpenTime())) {
throw new BusinessException(ErrorCode.LESSON_NOT_YET_OPEN);
}
// 바로 참가자 등록, 인원수 증가
LessonParticipant participant = LessonParticipant.builder()
.lesson(lesson)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ int countCreatedLessons(
AND (:district IS NULL OR l.district = :district)
AND (:dong IS NULL OR l.dong = :dong)
AND (:ri IS NULL OR l.ri = :ri)
AND MATCH(l.lesson_name, l.description) AGAINST(:search IN BOOLEAN MODE)
AND MATCH(l.lesson_name) AGAINST(:search IN BOOLEAN MODE)
ORDER BY
CASE WHEN :sort = 'LATEST' THEN l.created_at END DESC,
CASE WHEN :sort = 'OLDEST' THEN l.created_at END ASC,
Expand Down Expand Up @@ -248,7 +248,7 @@ SELECT COUNT(*) FROM (
AND (:district IS NULL OR l.district = :district)
AND (:dong IS NULL OR l.dong = :dong)
AND (:ri IS NULL OR l.ri = :ri)
AND MATCH(l.lesson_name, l.description) AGAINST(:search IN BOOLEAN MODE)
AND MATCH(l.lesson_name) AGAINST(:search IN BOOLEAN MODE)
LIMIT :limit
) t
""", nativeQuery = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public enum ErrorCode {
DUPLICATE_LESSON(HttpStatus.CONFLICT, "동일한 이름과 시간으로 이미 생성된 레슨이 있습니다."),
LESSON_TIME_OVERLAP(HttpStatus.CONFLICT, "해당 시간대에 이미 다른 레슨이 예정되어 있습니다."),
LESSON_NOT_AVAILABLE(HttpStatus.BAD_REQUEST, "신청 불가능한 상태의 레슨입니다."),
LESSON_NOT_YET_OPEN(HttpStatus.BAD_REQUEST, "아직 신청 가능한 시간이 아닙니다."),

// 409
ALREADY_APPLIED(HttpStatus.CONFLICT, "이미 신청한 레슨입니다."),
Expand Down