diff --git a/src/main/java/com/dku/council/domain/with_dankook/controller/StudyController.java b/src/main/java/com/dku/council/domain/with_dankook/controller/StudyController.java index 4c34327f..cf3832c8 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/controller/StudyController.java +++ b/src/main/java/com/dku/council/domain/with_dankook/controller/StudyController.java @@ -22,7 +22,6 @@ @RequestMapping("with-dankook/study") @RequiredArgsConstructor public class StudyController { - private final StudyService studyService; /** @@ -116,4 +115,16 @@ public void delete(AppAuthentication auth, @PathVariable Long id) { studyService.delete(id, auth.getUserId(), auth.isAdmin()); } + + /** + * 단터디 게시글 모집 완료 처리 + * 유저가 처리하거나 관리자가 강제로 처리할 수 있습니다. + * + * @param id 게시글 id + */ + @PatchMapping("/{id}") + @UserAuth + public void close(AppAuthentication auth, @PathVariable Long id) { + studyService.close(id, auth.getUserId()); + } } diff --git a/src/main/java/com/dku/council/domain/with_dankook/repository/WithDankookRepository.java b/src/main/java/com/dku/council/domain/with_dankook/repository/WithDankookRepository.java index fbfc84fc..7d0107d2 100644 --- a/src/main/java/com/dku/council/domain/with_dankook/repository/WithDankookRepository.java +++ b/src/main/java/com/dku/council/domain/with_dankook/repository/WithDankookRepository.java @@ -1,6 +1,5 @@ package com.dku.council.domain.with_dankook.repository; -import com.dku.council.domain.with_dankook.model.dto.list.SummarizedTradeDto; import com.dku.council.domain.with_dankook.model.entity.WithDankook; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -59,8 +58,8 @@ public interface WithDankookRepository extends JpaReposit "where w.id = :withDankookId and (w.withDankookStatus in ('FULL', 'CLOSED'))") int findWithClosedOrFullByIdToCreateReview(@Param("withDankookId") Long withDankookId); - @Query("select COUNT(*) from WithDankook w " + - "where w.id = :withDankookId and " + - "((w.withDankookStatus in ('FULL', 'CLOSED')) or (w.withDankookStatus = 'ACTIVE' and w.endTime <= CURRENT_TIMESTAMP)) ") + @Query(value = "select COUNT(*) from with_dankook w " + + "where w.with_dankook_id = :withDankookId and " + + "((w.with_dankook_status in ('FULL', 'CLOSED')) or (w.with_dankook_status = 'ACTIVE' and w.end_time <= CURRENT_TIMESTAMP())) ", nativeQuery = true) int findWithClosedOrFullOrActiveByIdToCreateReview(@Param("withDankookId") Long withDankookId); }