Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e57dc01
[refactor] 특정 책과 관련된 방 쿼리 필터링 조건을 정적으로 변경 (#289)
buzz0331 Sep 12, 2025
edc58dd
[fix] FIrebaseAdapter 프로필 조건 수정 (#289)
buzz0331 Sep 12, 2025
a41646a
[refactor] 방 도메인 내부 방 기간 유효성 검증 정적을 변경 (#289)
buzz0331 Sep 12, 2025
4b21c69
[refactor] 방 조회 쿼리 기간 필터링 조건 모두 정적으로 수정 (#289)
buzz0331 Sep 12, 2025
231c256
[refactor] 기간이 만료된 방 내부 게시물들은 조회만 가능하도록 예외처리 (#289)
buzz0331 Sep 12, 2025
1d8a507
[refactor] RoomStatus 도입에 따른 테스트 케이스 수정 (#289)
buzz0331 Sep 12, 2025
a2297a1
[refactor] 투표하기, 투표삭제하기 api에서 방 만료 검증 (#289)
buzz0331 Sep 12, 2025
0414562
[fix] 투표하기 단위테스트에 RoomCommandPort Mock 추가 (#295)
buzz0331 Sep 12, 2025
a99e536
[fix] 투표하기 단위테스트에 Room 스텁 객체 추가 (#295)
buzz0331 Sep 12, 2025
1f07fef
[refactor] RoomQueryDto에 roomStatus 추가 (#295)
buzz0331 Sep 13, 2025
a06af47
[refactor] 진행중인 방이 아닌경우의 에러코드 추가 (#295)
buzz0331 Sep 13, 2025
ce1956d
[refactor] 진행중인 방이 아닌 경우(모집 중인 방)의 예외처리 추가 (#295)
buzz0331 Sep 13, 2025
5e43d56
[docs] 에러메시지 스웨거 명세 추가 (#295)
buzz0331 Sep 13, 2025
ed6d55f
[merge] 머지 (#295)
buzz0331 Sep 13, 2025
d87aa32
[test] TestEntityFactory에서 방 생성시 기본 진행중인 방이 생성되도록 수정 (#295)
buzz0331 Sep 13, 2025
fbaef2e
[chore] 주석 제거 (#295)
buzz0331 Sep 13, 2025
f25d4f2
[refactor] validateRoom 메서드 추출 해제 (#295)
buzz0331 Sep 13, 2025
a4819f3
[refactor] RoomStatus not null assertion 추가 (#295)
buzz0331 Sep 13, 2025
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 @@ -11,8 +11,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

@Service
@RequiredArgsConstructor
public class BookRecruitingRoomsService implements BookRecruitingRoomsUseCase {
Expand All @@ -26,7 +24,7 @@ public class BookRecruitingRoomsService implements BookRecruitingRoomsUseCase {
@Transactional(readOnly = true)
public BookRecruitingRoomsResponse getRecruitingRoomsWithBook(String isbn, String cursorStr) {
Integer totalRoomCount = (cursorStr == null || cursorStr.isBlank()) ? // 첫 요청 여부 판단
roomQueryPort.countRecruitingRoomsByBookAndStartDateAfter(isbn, LocalDate.now()) : null;
roomQueryPort.countRecruitingRoomsByBookIsbn(isbn) : null;

Cursor cursor = Cursor.from(cursorStr, DEFAULT_PAGE_SIZE);
CursorBasedList<RoomQueryDto> roomDtos = roomQueryPort.findRoomsByIsbnOrderByDeadline(isbn, cursor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ public BookDetailSearchResult searchDetailBooks(String isbn,Long userId) {
}

private int getRecruitingRoomCount(Book book) {
//오늘 날짜 기준으로 방 활동 시작 기간이 이후인 방 찾기(모집중인 방)
LocalDate today = LocalDate.now();
return roomQueryPort.countRecruitingRoomsByBookAndStartDateAfter(book.getIsbn(), today);
// 모집 중인 방 개수
return roomQueryPort.countRecruitingRoomsByBookIsbn(book.getIsbn());
}

private int getReadCount(Book book) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import konkuk.thip.post.domain.CountUpdatable;
import konkuk.thip.room.application.service.validator.RoomParticipantValidator;
import konkuk.thip.room.application.service.validator.RoomValidator;
import konkuk.thip.roompost.domain.RoomPost;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
Expand All @@ -11,11 +12,13 @@
public class RoomPostCommentAccessPolicy implements CommentAccessPolicy {

private final RoomParticipantValidator roomParticipantValidator;
private final RoomValidator roomValidator;

@Override
public void validateCommentAccess(CountUpdatable post, Long userId) {
RoomPost roomPost = (RoomPost) post;
roomParticipantValidator.validateUserIsRoomMember(roomPost.getRoomId(), userId);
roomValidator.validateRoomInProgress(roomPost.getRoomId());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public enum ErrorCode implements ResponseCode {
ROOM_MEMBER_COUNT_UNDERFLOW(HttpStatus.BAD_REQUEST, 100007, "방의 인원 수가 1 이하(방장 포함)입니다."),
ROOM_IS_EXPIRED(HttpStatus.BAD_REQUEST, 100008, "방이 만료되었습니다."),
ROOM_POST_TYPE_NOT_MATCH(HttpStatus.BAD_REQUEST, 100009, "일치하는 방 게시물 타입 이름이 없습니다. [RECORD, VOTE] 중 하나여야 합니다."),
ROOM_NOT_IN_PROGRESS(HttpStatus.BAD_REQUEST, 100010, "진행 중인 방이 아닙니다."),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG가TM~


/**
* 110000 : vote error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ public enum SwaggerResponseDescription {
BOOK_NOT_FOUND,
ROOM_IS_EXPIRED,
RECORD_CANNOT_BE_OVERVIEW,
INVALID_RECORD_PAGE_RANGE
INVALID_RECORD_PAGE_RANGE,
ROOM_NOT_IN_PROGRESS
))),
RECORD_SEARCH(new LinkedHashSet<>(Set.of(
USER_NOT_FOUND,
Expand All @@ -147,7 +148,9 @@ public enum SwaggerResponseDescription {
RECORD_DELETE(new LinkedHashSet<>(Set.of(
ROOM_ACCESS_FORBIDDEN,
RECORD_NOT_FOUND,
RECORD_ACCESS_FORBIDDEN
RECORD_ACCESS_FORBIDDEN,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),
RECORD_PIN(new LinkedHashSet<>(Set.of(
ROOM_ACCESS_FORBIDDEN,
Expand All @@ -158,7 +161,9 @@ public enum SwaggerResponseDescription {
RECORD_UPDATE(new LinkedHashSet<>(Set.of(
ROOM_ACCESS_FORBIDDEN,
RECORD_NOT_FOUND,
RECORD_ACCESS_FORBIDDEN
RECORD_ACCESS_FORBIDDEN,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),

// Vote
Expand All @@ -168,24 +173,31 @@ public enum SwaggerResponseDescription {
BOOK_NOT_FOUND,
ROOM_IS_EXPIRED,
VOTE_CANNOT_BE_OVERVIEW,
INVALID_VOTE_PAGE_RANGE
INVALID_VOTE_PAGE_RANGE,
ROOM_NOT_IN_PROGRESS
))),
VOTE(new LinkedHashSet<>(Set.of(
ROOM_ACCESS_FORBIDDEN,
VOTE_ITEM_NOT_FOUND,
VOTE_ITEM_ALREADY_VOTED,
VOTE_ITEM_NOT_VOTED_CANNOT_CANCEL,
VOTE_ITEM_COUNT_CANNOT_BE_NEGATIVE
VOTE_ITEM_COUNT_CANNOT_BE_NEGATIVE,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),
VOTE_DELETE(new LinkedHashSet<>(Set.of(
ROOM_ACCESS_FORBIDDEN,
VOTE_NOT_FOUND,
VOTE_ACCESS_FORBIDDEN
VOTE_ACCESS_FORBIDDEN,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),
VOTE_UPDATE(new LinkedHashSet<>(Set.of(
ROOM_ACCESS_FORBIDDEN,
VOTE_NOT_FOUND,
VOTE_ACCESS_FORBIDDEN
VOTE_ACCESS_FORBIDDEN,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),


Expand Down Expand Up @@ -251,8 +263,9 @@ public enum SwaggerResponseDescription {
VOTE_NOT_FOUND,
INVALID_COMMENT_CREATE,
FEED_ACCESS_FORBIDDEN,
ROOM_ACCESS_FORBIDDEN

ROOM_ACCESS_FORBIDDEN,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),
CHANGE_COMMENT_LIKE_STATE(new LinkedHashSet<>(Set.of(
USER_NOT_FOUND,
Expand All @@ -264,7 +277,9 @@ public enum SwaggerResponseDescription {
COMMENT_NOT_LIKED_CANNOT_CANCEL,
COMMENT_LIKE_COUNT_UNDERFLOW,
FEED_ACCESS_FORBIDDEN,
ROOM_ACCESS_FORBIDDEN
ROOM_ACCESS_FORBIDDEN,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),
COMMENT_DELETE(new LinkedHashSet<>(Set.of(
USER_NOT_FOUND,
Expand All @@ -275,7 +290,9 @@ public enum SwaggerResponseDescription {
COMMENT_DELETE_FORBIDDEN,
COMMENT_COUNT_UNDERFLOW,
FEED_ACCESS_FORBIDDEN,
ROOM_ACCESS_FORBIDDEN
ROOM_ACCESS_FORBIDDEN,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),

// Book
Expand Down Expand Up @@ -321,7 +338,9 @@ public enum SwaggerResponseDescription {
ROOM_NOT_FOUND,
USER_NOT_FOUND,
ATTENDANCE_CHECK_WRITE_LIMIT_EXCEEDED,
ATTENDANCE_CHECK_NOT_FOUND
ATTENDANCE_CHECK_NOT_FOUND,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),

ATTENDANCE_CHECK_SHOW(new LinkedHashSet<>(Set.of(
Expand All @@ -331,7 +350,9 @@ public enum SwaggerResponseDescription {
ATTENDANCE_CHECK_DELETE(new LinkedHashSet<>(Set.of(
ROOM_ACCESS_FORBIDDEN,
ATTENDANCE_CHECK_NOT_FOUND,
ATTENDANCE_CHECK_CAN_NOT_DELETE
ATTENDANCE_CHECK_CAN_NOT_DELETE,
ROOM_IS_EXPIRED,
ROOM_NOT_IN_PROGRESS
))),

// Notiification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@Slf4j
@Component
@Profile({"!test & !local"})
@Profile("!test & !local")
@RequiredArgsConstructor
public class FirebaseAdapter implements FirebaseMessagingPort {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,7 @@ public void updateIsPublic(boolean isPublic) {

@VisibleForTesting
public void updateRoomPercentage(double roomPercentage) {this.roomPercentage = roomPercentage;}

@VisibleForTesting
public void updateRoomStatus(RoomStatus roomStatus) {this.roomStatus = roomStatus;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public class RoomQueryPersistenceAdapter implements RoomQueryPort {
private final RoomJpaRepository roomJpaRepository;

@Override
public int countRecruitingRoomsByBookAndStartDateAfter(String isbn, LocalDate currentDate) {
return roomJpaRepository.countActiveRoomsByBookIdAndStartDateAfter(isbn, currentDate);
public int countRecruitingRoomsByBookIsbn(String isbn) {
return roomJpaRepository.countRecruitingRoomsByBookIsbn(isbn);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.time.LocalDate;
import java.util.List;
import java.util.Optional;

Expand All @@ -19,8 +18,8 @@ public interface RoomJpaRepository extends JpaRepository<RoomJpaEntity, Long>, R

@Query("SELECT COUNT(r) FROM RoomJpaEntity r " +
"WHERE r.bookJpaEntity.isbn = :isbn " +
"AND r.startDate > :currentDate")
int countActiveRoomsByBookIdAndStartDateAfter(@Param("isbn") String isbn, @Param("currentDate") LocalDate currentDate);
"AND r.roomStatus = 'RECRUITING'")
int countRecruitingRoomsByBookIsbn(@Param("isbn") String isbn);

@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query("""
Expand Down
Loading