feat: Banner mediaType 필드 추가 (IMAGE/VIDEO)#574
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Banner 도메인에 mediaType(IMAGE/VIDEO)를 추가해 프론트에서 <img>/<video> 렌더링 분기를 할 수 있도록 하고, 배너 등록/수정/조회 및 관리자 조회 응답 전반에 해당 필드를 반영하는 PR입니다.
Changes:
MediaTypeenum(IMAGE/VIDEO) 추가 및 Banner 엔티티에media_type컬럼 매핑/기본값(IMAGE) 추가- 관리자 배너 생성/수정/조회 및 검색 리스트 응답에
mediaType포함 - 관련 테스트/RestDocs 픽스처 및 문서 스펙에
mediaType반영
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| bottlenote-mono/src/main/java/app/bottlenote/banner/constant/MediaType.java | 배너 미디어 타입 enum 추가 및 JSON 파싱 지원 |
| bottlenote-mono/src/main/java/app/bottlenote/banner/domain/Banner.java | mediaType 필드 추가(ENUM STRING, not-null, 기본값 IMAGE) 및 update 파라미터 확장 |
| bottlenote-mono/src/main/java/app/bottlenote/banner/dto/request/AdminBannerCreateRequest.java | 배너 생성 요청에 mediaType 추가 및 기본값 IMAGE 설정 |
| bottlenote-mono/src/main/java/app/bottlenote/banner/dto/request/AdminBannerUpdateRequest.java | 배너 수정 요청에 mediaType 추가 |
| bottlenote-mono/src/main/java/app/bottlenote/banner/dto/response/BannerResponse.java | 배너 조회 응답에 mediaType 추가 |
| bottlenote-mono/src/main/java/app/bottlenote/banner/dto/response/AdminBannerListResponse.java | 관리자 리스트 응답 record에 mediaType 추가 |
| bottlenote-mono/src/main/java/app/bottlenote/banner/dto/response/AdminBannerDetailResponse.java | 관리자 상세 응답 record에 mediaType 추가 |
| bottlenote-mono/src/main/java/app/bottlenote/banner/service/AdminBannerService.java | 생성/수정/상세 응답 구성에 mediaType 반영 |
| bottlenote-mono/src/main/java/app/bottlenote/banner/service/BannerQueryService.java | 활성 배너 조회 응답에 mediaType 반영 |
| bottlenote-mono/src/main/java/app/bottlenote/banner/repository/CustomBannerRepositoryImpl.java | QueryDSL 프로젝션에 mediaType 포함 |
| bottlenote-mono/src/test/java/app/bottlenote/banner/fixture/InMemoryBannerRepository.java | 테스트용 검색 결과 DTO에 mediaType 포함 |
| bottlenote-mono/src/test/java/app/bottlenote/banner/fixture/BannerTestFactory.java | 배너 테스트 픽스처 기본 mediaType=IMAGE 세팅 |
| bottlenote-product-api/src/test/java/app/docs/banner/RestBannerQueryControllerTest.java | product API RestDocs 스펙에 mediaType 추가 및 테스트 데이터 반영 |
| bottlenote-product-api/src/test/java/app/bottlenote/common/file/upload/ImageUploadServiceTest.java | 허용되지 않은 contentType 테스트 케이스 조정 |
| bottlenote-admin-api/src/test/kotlin/app/helper/banner/BannerHelper.kt | admin 테스트 헬퍼/요청 바디에 mediaType 포함 |
| bottlenote-admin-api/src/test/kotlin/app/docs/banner/AdminBannerControllerDocsTest.kt | admin RestDocs 스펙에 mediaType 추가 |
Comments suppressed due to low confidence (1)
bottlenote-mono/src/main/java/app/bottlenote/banner/dto/request/AdminBannerUpdateRequest.java:32
- AdminBannerUpdateRequest에서 mediaType이 nullable인데, AdminBannerService.update()가 그대로 Banner.update()에 전달해 엔티티의 mediaType(nullable=false)이 null로 세팅될 수 있습니다. 요청에서 mediaType을 필수로 강제(@NotNull 추가)하거나, update 시 null이면 기존 값 유지/기본값(MediaType.IMAGE)으로 보정하도록 처리해 500/DB 제약 위반을 방지해주세요.
@NotBlank(message = "BANNER_IMAGE_URL_REQUIRED") String imageUrl,
TextPosition textPosition,
Boolean isExternalUrl,
String targetUrl,
MediaType mediaType,
@NotNull(message = "BANNER_TYPE_REQUIRED") BannerType bannerType,
@NotNull(message = "BANNER_SORT_ORDER_REQUIRED")
@Min(value = 0, message = "BANNER_SORT_ORDER_MINIMUM")
Integer sortOrder,
LocalDateTime startDate,
LocalDateTime endDate,
@NotNull(message = "BANNER_IS_ACTIVE_REQUIRED") Boolean isActive) {}
| @@ -120,6 +128,7 @@ public void update( | |||
| this.textPosition = textPosition; | |||
| this.isExternalUrl = isExternalUrl; | |||
| this.targetUrl = targetUrl; | |||
There was a problem hiding this comment.
Banner.update()가 mediaType을 그대로 대입하고 있어, 상위 계층에서 null이 전달되면 @column(nullable=false) 제약을 위반하는 상태가 됩니다. 도메인 불변식 관점에서 update() 내부에서 null을 거부(예: 예외)하거나, null이면 기존 값 유지/기본값으로 보정해 엔티티가 항상 유효한 상태를 유지하도록 해주세요.
Suggested change
| this.targetUrl = targetUrl; | |
| this.targetUrl = targetUrl; | |
| if (mediaType == null) { | |
| // mediaType은 @Column(nullable = false) 제약을 가지므로 null을 허용하지 않는다. | |
| throw new IllegalArgumentException("mediaType must not be null"); | |
| } |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mediaType필드 추가 (IMAGE,VIDEO)<img>vs<video>태그 분기 가능banners.media_type컬럼 추가 (서브모듈, main 반영 완료)변경 파일 (16개)
신규 (1개)
MediaType.javaenum (IMAGE, VIDEO)프로덕션 (9개)
테스트 (6개)
Test plan
Related: bottle-note/workspace#205
Generated with Claude Code