Skip to content

Comments

[Refactor] 공지사항 등록 기능 개선 #548

Merged
CUCU7103 merged 11 commits intodevfrom
refactor/register-admin-notice
Jan 8, 2026
Merged

[Refactor] 공지사항 등록 기능 개선 #548
CUCU7103 merged 11 commits intodevfrom
refactor/register-admin-notice

Conversation

@CUCU7103
Copy link
Collaborator

@CUCU7103 CUCU7103 commented Jan 6, 2026

History

연관된 이슈: #547

🚀 Major Changes & Explanations

  • 기존 공지사항 등록 기능은 일반적인 게시판 형식을 기준으로 작성되어졌습니다.
  • 스마트 에디터 사용으로 파라미터 값의 수정과 , 공지사항 본문에 포함된 이미지를 저장하는 로직이 변경되어졌습니다.

리뷰 포인트

CUCU7103 and others added 11 commits January 6, 2026 22:02
HTML 컨텐츠에서 임시 UUID를 CDN URL로 변환하는 기능을
제공하는 HtmlContentProcessor를 추가합니다.

기능:
- UUID 기반 이미지 참조를 CDN URL로 변환
- 정규식을 이용한 안전한 치환
- 단위 테스트 포함

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Notice, AdminNoticeInfo, AdminNoticeCommand를 개선하여
불필요한 필드를 제거하고 일관성을 향상합니다.

변경 사항:
1. Notice 도메인에서 links 필드 제거 (imageLinks만 사용)
2. AdminNoticeInfo에서 links 필드 제거
3. AdminNotificationResponse에서 links 필드 제거
4. 엔티티의 명확한 책임 분리

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
이미지 업로드 과정을 개선하여 부분 실패 시 안전한
처리를 보장합니다.

개선 사항:
1. 이미지 저장 중 실패 시 이전까지 업로드된 이미지만 추적하여 삭제
2. 모든 이미지 업로드 과정을 try-catch로 감싸서 예외 처리
3. 스택 트레이스 출력으로 디버깅 개선 (log.error("메시지", e))
4. 불필요한 중간 변수 제거로 코드 가독성 향상
5. 명확한 주석으로 로직 흐름 설명

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Service 계층의 책임을 명확히 하고 로직을 개선합니다.

개선 사항:
1. Notice 생성 로직의 명확성 향상
2. Admin 존재 여부 확인 강화
3. 메서드 가독성 개선

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Request/Response DTO와 Controller를 개선하여
더 명확하고 일관된 인터페이스를 제공합니다.

개선 사항:
1. AdminNotificationResponse에서 links 필드 제거
2. DTO 필드 일관성 향상
3. Controller 코드 정리

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
공지사항 생성 실패에 대한 에러 코드를 추가합니다.

추가된 에러 코드:
- ADMIN_NOTICE_CREATION_FAILED: 공지사항 생성 실패

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Notice 도메인 모델의 테스트를 개선하고, 테스트 픽스처를
업데이트합니다.

개선 사항:
1. links 필드 제거에 따른 테스트 수정
2. 테스트 케이스 정리 (7개)
3. NoticeFixture 업데이트

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Service 계층의 통합 테스트를 추가하여 비즈니스 로직의
정확성을 검증합니다.

추가된 테스트:
1. success_createAdminNotification - 공지사항 생성 성공
2. success_createAdminNotification_SavesToDB - DB 저장 및 JSON 직렬화
3. success_createAdminNotification_SetsAdminRelation - Admin 관계 설정
4. fail_createAdminNotification_WithNonExistentAdmin - Admin 없음
5. fail_createAdminNotification_WithEmptyTitle - 제목 검증
6. fail_createAdminNotification_WithEmptyContent - 본문 검증

검증 항목:
- 실제 DB 트랜잭션
- JPA Dirty Checking
- JSON 직렬화/역직렬화
- 데이터 무결성
- 예외 처리

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Facade 계층 테스트를 확대하여 Happy Path와 엣지 케이스를
완벽하게 검증합니다.

단위 테스트 추가 (6개 -> 9개):
- success_create_notice_with_single_image - 단일 이미지
- success_create_notice_with_multiple_images - 복수 이미지
- fail_when_second_image_upload_fails_then_delete_first_image - 부분 실패

통합 테스트 개선 (2개 -> 4개):
- success_create_notification_with_images - 정상 생성
- rollback_uploaded_images_when_notification_creation_fails - 실패 시 롤백
- rollback_first_image_when_second_image_fails - 부분 실패 롤백
- success_create_notification_without_images - 이미지 없는 경우

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Controller 계층 테스트를 확대하여 정상 요청, 예외 상황,
권한 검증을 완벽하게 검증합니다.

추가된 테스트 (2개 -> 5개):
1. success_registerNotification_WithValidInput - Happy Path (200 OK)
2. registerNotification_Fails_WithBlankTitle - 제목 검증 (400)
3. registerNotification_Fails_WithBlankContent - 본문 검증 (400)
4. registerNotification_Fails_WithoutAdminRole - 권한 검증 (401)
5. success_registerNotification_WithMultipleImages - 복수 이미지 (200)

검증 항목:
- HTTP 상태 코드
- 요청 바인딩 및 검증
- Facade 호출 검증
- 인증/권한 처리

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@CUCU7103 CUCU7103 self-assigned this Jan 6, 2026
@CUCU7103 CUCU7103 marked this pull request as draft January 7, 2026 11:50
@CUCU7103 CUCU7103 requested a review from kimbro97 January 7, 2026 12:09
@CUCU7103 CUCU7103 marked this pull request as ready for review January 7, 2026 12:09
@CUCU7103 CUCU7103 requested a review from mono0801 January 7, 2026 12:10
@CUCU7103 CUCU7103 changed the title [Refactor] 공지사항 등록 기능 개선 (작성이 미완료된 PR입니다) [Refactor] 공지사항 등록 기능 개선 Jan 8, 2026
Copy link
Contributor

@mono0801 mono0801 left a comment

Choose a reason for hiding this comment

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

@CUCU7103 준규님 고생하셨습니다!
가독성이 개선된 것 같아 좋은 것 같습니다.

@CUCU7103 CUCU7103 merged commit 538d142 into dev Jan 8, 2026
@CUCU7103 CUCU7103 deleted the refactor/register-admin-notice branch January 8, 2026 14:53
Copy link
Contributor

@kimbro97 kimbro97 left a comment

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants