From 25bc12b3243f3ace55d91301d2863b490a5c2ef2 Mon Sep 17 00:00:00 2001 From: mingmingmon <96719969+mingmingmon@users.noreply.github.com> Date: Mon, 2 Sep 2024 01:59:37 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EC=9A=B4=EC=98=81=EC=84=9C=EB=B2=84?= =?UTF-8?q?=EC=99=80=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?DB=20=EB=8F=99=EA=B8=B0=ED=99=94=20=EA=B3=BC=EC=A0=95=EC=97=90?= =?UTF-8?q?=EC=84=9C=20SSH=20=EC=9D=B8=EC=A6=9D=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EC=99=84=EB=A3=8C=20(#523)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 한관희 --- jenkins/prod/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jenkins/prod/Jenkinsfile b/jenkins/prod/Jenkinsfile index 8dc582985..49ae770ab 100644 --- a/jenkins/prod/Jenkinsfile +++ b/jenkins/prod/Jenkinsfile @@ -303,6 +303,7 @@ def backupPostgres() { ]) { sh """ echo "Backing up PostgreSQL database to ${BACKUP_DIR}/${BACKUP_FILE}..." + echo "Executing as user: \$(whoami)" docker exec -e PGPASSWORD=${PG_PASSWORD} ${POSTGRESQL_CONTAINER_NAME} sh -c 'pg_dumpall -c -U ${PG_USER} > ${BACKUP_DIR}/${BACKUP_FILE}' """ } @@ -456,7 +457,7 @@ def performHealthCheck() { def transferBackupToStaging(String BACKUP_FILE) { sh """ - echo "Transferring backup file to staging server..." + echo "Executing as user: \$(whoami)" scp -P ${env.STAGING_SSH_PORT} ${env.BACKUP_DIR}/${BACKUP_FILE} ${env.STAGING_USER}@${env.STAGING_HOST}:${env.STAGING_BACKUP_DIR_PATH}/ """ } From 30c542a61383d7292f3e39bb280b2b8dbe5e2ec4 Mon Sep 17 00:00:00 2001 From: mingmingmon <96719969+mingmingmon@users.noreply.github.com> Date: Mon, 2 Sep 2024 03:16:46 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EC=82=AD=EC=A0=9C=EB=90=9C=20?= =?UTF-8?q?=EA=B2=8C=EC=8B=9C=EA=B8=80=EB=A1=9C=20=EC=9D=B8=ED=95=B4=20?= =?UTF-8?q?=EB=82=98=EC=9D=98=20=EB=8C=93=EA=B8=80=EC=9D=B4=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=95=20(#525)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../out/persistence/BoardPersistenceAdapter.java | 9 ++++++++- .../adapter/out/persistence/BoardRepository.java | 11 ++++++++--- .../board/application/port/out/RetrieveBoardPort.java | 2 ++ .../service/ExternalBoardRetrievalService.java | 4 +++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/java/page/clab/api/domain/community/board/adapter/out/persistence/BoardPersistenceAdapter.java b/src/main/java/page/clab/api/domain/community/board/adapter/out/persistence/BoardPersistenceAdapter.java index a23c36b63..72414d65a 100644 --- a/src/main/java/page/clab/api/domain/community/board/adapter/out/persistence/BoardPersistenceAdapter.java +++ b/src/main/java/page/clab/api/domain/community/board/adapter/out/persistence/BoardPersistenceAdapter.java @@ -33,6 +33,13 @@ public Board findByIdOrThrow(Long boardId) { .orElseThrow(() -> new NotFoundException("[Board] id: " + boardId + "에 해당하는 게시글이 존재하지 않습니다.")); } + @Override + public Board findByIdRegardlessOfDeletion(Long boardId) { + return boardRepository.findByIdRegardlessOfDeletion(boardId) + .map(boardMapper::toDomain) + .orElseThrow(() -> new NotFoundException("[Board] id: " + boardId + "에 해당하는 게시글이 존재하지 않습니다.")); + } + @Override public Page findAllByCategory(BoardCategory category, Pageable pageable) { return boardRepository.findAllByCategory(category, pageable) @@ -47,7 +54,7 @@ public Page findAllByIsDeletedTrue(Pageable pageable) { @Override public Page findAllByMemberId(String memberId, Pageable pageable) { - return boardRepository.findAllByMemberId(memberId, pageable) + return boardRepository.findAllByMemberIdAndIsDeletedFalse(memberId, pageable) .map(boardMapper::toDomain); } diff --git a/src/main/java/page/clab/api/domain/community/board/adapter/out/persistence/BoardRepository.java b/src/main/java/page/clab/api/domain/community/board/adapter/out/persistence/BoardRepository.java index bb1b38514..bbb0dc8ed 100644 --- a/src/main/java/page/clab/api/domain/community/board/adapter/out/persistence/BoardRepository.java +++ b/src/main/java/page/clab/api/domain/community/board/adapter/out/persistence/BoardRepository.java @@ -1,18 +1,20 @@ package page.clab.api.domain.community.board.adapter.out.persistence; +import java.util.List; +import java.util.Optional; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import page.clab.api.domain.community.board.domain.BoardCategory; -import java.util.List; - @Repository public interface BoardRepository extends JpaRepository { - Page findAllByMemberId(String memberId, Pageable pageable); + @Query("SELECT b FROM BoardJpaEntity b WHERE b.memberId = ?1 AND b.isDeleted = false") + Page findAllByMemberIdAndIsDeletedFalse(String memberId, Pageable pageable); Page findAllByCategory(BoardCategory category, Pageable pageable); @@ -20,4 +22,7 @@ public interface BoardRepository extends JpaRepository { Page findAllByIsDeletedTrue(Pageable pageable); List findByMemberId(String memberId); + + @Query(value = "SELECT * FROM board b WHERE b.id = :boardId", nativeQuery = true) + Optional findByIdRegardlessOfDeletion(@Param("boardId") Long boardId); } diff --git a/src/main/java/page/clab/api/domain/community/board/application/port/out/RetrieveBoardPort.java b/src/main/java/page/clab/api/domain/community/board/application/port/out/RetrieveBoardPort.java index f785e8ade..379d1778f 100644 --- a/src/main/java/page/clab/api/domain/community/board/application/port/out/RetrieveBoardPort.java +++ b/src/main/java/page/clab/api/domain/community/board/application/port/out/RetrieveBoardPort.java @@ -9,6 +9,8 @@ public interface RetrieveBoardPort { Board findByIdOrThrow(Long boardId); + Board findByIdRegardlessOfDeletion(Long boardId); + Page findAll(Pageable pageable); Page findAllByCategory(BoardCategory category, Pageable pageable); diff --git a/src/main/java/page/clab/api/external/community/board/application/service/ExternalBoardRetrievalService.java b/src/main/java/page/clab/api/external/community/board/application/service/ExternalBoardRetrievalService.java index c147a7efb..012e16260 100644 --- a/src/main/java/page/clab/api/external/community/board/application/service/ExternalBoardRetrievalService.java +++ b/src/main/java/page/clab/api/external/community/board/application/service/ExternalBoardRetrievalService.java @@ -4,6 +4,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import page.clab.api.domain.community.board.application.dto.shared.BoardCommentInfoDto; +import page.clab.api.domain.community.board.application.port.out.RetrieveBoardPort; import page.clab.api.domain.community.board.application.service.BoardRetrievalService; import page.clab.api.domain.community.board.domain.Board; import page.clab.api.external.community.board.application.port.ExternalRetrieveBoardUseCase; @@ -13,6 +14,7 @@ public class ExternalBoardRetrievalService implements ExternalRetrieveBoardUseCase { private final BoardRetrievalService boardRetrievalService; + private final RetrieveBoardPort retrieveBoardPort; @Transactional(readOnly = true) @Override @@ -23,7 +25,7 @@ public Board findByIdOrThrow(Long targetId) { @Transactional(readOnly = true) @Override public BoardCommentInfoDto getBoardCommentInfoById(Long boardId) { - Board board = boardRetrievalService.findByIdOrThrow(boardId); + Board board = retrieveBoardPort.findByIdRegardlessOfDeletion(boardId); return BoardCommentInfoDto.create(board); } }