Skip to content

Feat/#224 executive report#225

Open
yeongsinkeem wants to merge 15 commits into
devfrom
feat/#224-executive-report
Open

Feat/#224 executive report#225
yeongsinkeem wants to merge 15 commits into
devfrom
feat/#224-executive-report

Conversation

@yeongsinkeem
Copy link
Copy Markdown
Collaborator

이슈 번호

#224

작업 내용

  • 운영진 ) 신고 게시글 관리 API 구현

@yeongsinkeem yeongsinkeem requested a review from tishakong April 12, 2026 14:28
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements a comprehensive management system for reported posts, providing separate functionalities for administrators and executives. Key changes include the introduction of new controllers and services for handling reported post lists, details, activation, and deletion, alongside a transition to standardized DTO naming and centralized business exception handling. The review feedback highlights opportunities to optimize database performance by removing redundant queries in the service layer and improving the reliability of report-fetching logic in the repository. Additionally, it is recommended to ensure consistent state validation during post activation and to strictly adhere to the project's pattern of centralizing ownership validation within the dedicated validator component.

Comment on lines +24 to +28
ON r.reportedAt = (
SELECT MAX(r2.reportedAt)
FROM Report r2
WHERE r2.postId = p.id
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Joining on reportedAt with a subquery finding the MAX timestamp can lead to duplicate rows if multiple reports for the same post are created at the exact same time (e.g., during a bulk operation or high concurrency). It is safer to join on a unique identifier like the report ID.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

select 절에서 id를 가져오고
order 절에서 id를 내림차순 정렬하는 방식으로 수정

Comment thread src/main/java/org/example/tackit/domain/admin/service/AdminPostService.java Outdated
Comment on lines +80 to +83
// 이미 활성 상태인지 체크하는 비즈니스 로직 예시
if (post.getActiveStatus() == ActiveStatus.ACTIVE) {
throw new BusinessException(ErrorCode.ALREADY_ACTIVE_POST);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The check post.getActiveStatus() == ActiveStatus.ACTIVE is inconsistent with the logic in post.activate(), which requires the post to be in DELETED status. It is better to validate that the post is indeed deleted before attempting to activate it, utilizing the newly added ErrorCode.CANNOT_ACTIVATE_DELETED_POST for a more accurate business exception.

    if (post.getActiveStatus() != ActiveStatus.DELETED) {
      throw new BusinessException(ErrorCode.CANNOT_ACTIVATE_DELETED_POST);
    }

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

추후 에러코드 추가하면 좋을 듯합니다.

Comment on lines +94 to +97
// 이미 활성 상태인지 체크하는 비즈니스 로직 예시
if (post.getActiveStatus() == ActiveStatus.ACTIVE) {
throw new BusinessException(ErrorCode.ALREADY_ACTIVE_POST);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The status check should ensure the post is in a DELETED state before activation to remain consistent with the entity's internal state transition logic and to provide the correct error response.

        if (post.getActiveStatus() != ActiveStatus.DELETED) {
            throw new BusinessException(ErrorCode.CANNOT_ACTIVATE_DELETED_POST);
        }

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

추후 에러코드 추가하면 좋을 듯합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant