Skip to content

Commit

Permalink
Changelog (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
limehee authored Sep 1, 2024
2 parents 16c1277 + 30c542a commit 900dcf1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
3 changes: 2 additions & 1 deletion jenkins/prod/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
"""
}
Expand Down Expand Up @@ -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}/
"""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Board> findAllByCategory(BoardCategory category, Pageable pageable) {
return boardRepository.findAllByCategory(category, pageable)
Expand All @@ -47,7 +54,7 @@ public Page<Board> findAllByIsDeletedTrue(Pageable pageable) {

@Override
public Page<Board> findAllByMemberId(String memberId, Pageable pageable) {
return boardRepository.findAllByMemberId(memberId, pageable)
return boardRepository.findAllByMemberIdAndIsDeletedFalse(memberId, pageable)
.map(boardMapper::toDomain);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
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<BoardJpaEntity, Long> {

Page<BoardJpaEntity> findAllByMemberId(String memberId, Pageable pageable);
@Query("SELECT b FROM BoardJpaEntity b WHERE b.memberId = ?1 AND b.isDeleted = false")
Page<BoardJpaEntity> findAllByMemberIdAndIsDeletedFalse(String memberId, Pageable pageable);

Page<BoardJpaEntity> findAllByCategory(BoardCategory category, Pageable pageable);

@Query(value = "SELECT b.* FROM board b WHERE b.is_deleted = true", nativeQuery = true)
Page<BoardJpaEntity> findAllByIsDeletedTrue(Pageable pageable);

List<BoardJpaEntity> findByMemberId(String memberId);

@Query(value = "SELECT * FROM board b WHERE b.id = :boardId", nativeQuery = true)
Optional<BoardJpaEntity> findByIdRegardlessOfDeletion(@Param("boardId") Long boardId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public interface RetrieveBoardPort {

Board findByIdOrThrow(Long boardId);

Board findByIdRegardlessOfDeletion(Long boardId);

Page<Board> findAll(Pageable pageable);

Page<Board> findAllByCategory(BoardCategory category, Pageable pageable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -13,6 +14,7 @@
public class ExternalBoardRetrievalService implements ExternalRetrieveBoardUseCase {

private final BoardRetrievalService boardRetrievalService;
private final RetrieveBoardPort retrieveBoardPort;

@Transactional(readOnly = true)
@Override
Expand All @@ -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);
}
}

0 comments on commit 900dcf1

Please sign in to comment.