Skip to content

feat: Banner mediaType 필드 추가 (IMAGE/VIDEO)#574

Merged
Whale0928 merged 3 commits intomainfrom
feat/banner-media-type
Mar 24, 2026
Merged

feat: Banner mediaType 필드 추가 (IMAGE/VIDEO)#574
Whale0928 merged 3 commits intomainfrom
feat/banner-media-type

Conversation

@Whale0928
Copy link
Copy Markdown
Collaborator

Summary

  • Banner 도메인에 mediaType 필드 추가 (IMAGE, VIDEO)
  • 프론트엔드에서 <img> vs <video> 태그 분기 가능
  • 배너 등록/수정/조회 API 전체에 mediaType 반영
  • DB 스키마: banners.media_type 컬럼 추가 (서브모듈, main 반영 완료)

변경 파일 (16개)

신규 (1개)

  • MediaType.java enum (IMAGE, VIDEO)

프로덕션 (9개)

  • Banner 엔티티, Request/Response DTO 5개, 서비스 2개, QueryDSL Projection

테스트 (6개)

  • BannerTestFactory, InMemoryBannerRepository, BannerHelper
  • RestDocs (product-api, admin-api), ImageUploadServiceTest 테스트 수정

Test plan

  • mono compileJava 성공
  • admin compileKotlin 성공
  • mono test 성공
  • product-api test 성공
  • admin integration test 성공

Related: bottle-note/workspace#205

Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 24, 2026 07:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Banner 도메인에 mediaType(IMAGE/VIDEO)를 추가해 프론트에서 <img>/<video> 렌더링 분기를 할 수 있도록 하고, 배너 등록/수정/조회 및 관리자 조회 응답 전반에 해당 필드를 반영하는 PR입니다.

Changes:

  • MediaType enum(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;
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

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");
}

Copilot uses AI. Check for mistakes.
Whale0928 and others added 2 commits March 24, 2026 16:10
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Whale0928 Whale0928 merged commit 516dc88 into main Mar 24, 2026
8 checks passed
@Whale0928 Whale0928 deleted the feat/banner-media-type branch March 24, 2026 07:32
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.

2 participants