-
Notifications
You must be signed in to change notification settings - Fork 2
feat: admin 노션 타임테이블 최초 등록 dto 수정 및 행사등록 dto 이미지 추가 - #160 #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughSummary by CodeRabbit릴리스 노트
Walkthrough관리자 이벤트 관련 DTO에 Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Controller
participant AdminEventService
participant ImageStore as EventImageRepository
participant TicketStore as TicketRepository
Client->>Controller: AdminEventWithTicketCreateRequest (images: List<AdminEventImageRequest>)
Controller->>AdminEventService: createEventWithTickets(req)
AdminEventService->>AdminEventService: validate & persist Event entity
AdminEventService->>ImageStore: saveEventImages(eventId, images)
ImageStore-->>AdminEventService: saved image entities
AdminEventService->>TicketStore: saveTicketRoundsAndTypes(...)
AdminEventService-->>Controller: created event response
Controller-->>Client: 201 Created
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/com/permitseoul/permitserver/domain/admin/util/NotionResponseMapper.java (1)
95-98: 필드명 업데이트가 올바르게 적용되었습니다.새로운
artistOrActivity필드를 사용하도록 정확히 수정되었으며, 로직도 적절합니다. 첫 번째 타이틀을 추출하거나 빈 문자열로 폴백하는 방식이 유지되고 있습니다.98번 라인의 주석을 더 명확하게 개선할 수 있습니다:
- final String blockName = artist; // (현재 정해진 바로는)blockName == artistOrActivity + final String blockName = artist; // (현재 정해진 바로는)blockName은 artistOrActivity에서 추출한 artist 값과 동일이렇게 하면
blockName이artistOrActivity필드 자체가 아닌, 해당 필드에서 추출한 값임을 더 명확히 전달할 수 있습니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventImageRequest.java(1 hunks)src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventUpdateRequest.java(1 hunks)src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventWithTicketCreateRequest.java(2 hunks)src/main/java/com/permitseoul/permitserver/domain/admin/event/api/service/AdminEventService.java(3 hunks)src/main/java/com/permitseoul/permitserver/domain/admin/util/NotionResponseMapper.java(1 hunks)src/main/java/com/permitseoul/permitserver/global/external/notion/dto/NotionTimetableDatasourceResponse.java(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: sjk4618
Repo: PERMIT-SEOUL/permit-server PR: 48
File: src/main/java/com/permitseoul/permitserver/domain/guest/core/domain/entity/GuestEntity.java:31-37
Timestamp: 2025-07-15T09:37:32.765Z
Learning: sjk4618 prefers to implement factory methods or public constructors for entities when they are actually needed, rather than creating them proactively.
🔇 Additional comments (6)
src/main/java/com/permitseoul/permitserver/global/external/notion/dto/NotionTimetableDatasourceResponse.java (1)
27-28: 필드 이름 변경이 완벽하게 적용되었습니다.코드베이스 전체에서 기존
artist()메서드 참조가 없으며,NotionResponseMapper.java의 모든 사용 지점(95, 97, 98줄)이 새로운artistOrActivity필드로 올바르게 업데이트되었습니다.@JsonProperty("artist/activity")어노테이션이 Notion 데이터베이스 필드와 정확하게 매핑되어 있으므로 추가 조치는 필요하지 않습니다.src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventWithTicketCreateRequest.java (1)
62-64: 이미지 필드 추가가 올바르게 구현되었습니다.
@NotEmpty와@Valid애노테이션을 통해 최소 1개 이상의 이미지를 요구하고 중첩 객체 검증을 수행하도록 설정되어 있습니다. 새로운AdminEventImageRequestDTO와의 통합도 적절합니다.src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventUpdateRequest.java (1)
47-47: 이미지 타입 통합이 잘 되었습니다.중첩된
AdminEventUpdateImageInfo레코드를 제거하고 새로운AdminEventImageRequest로 통합하여 코드 중복을 제거했습니다. 업데이트 시나리오에서 이미지는 선택 사항이므로 검증 애노테이션이 없는 것도 적절합니다.src/main/java/com/permitseoul/permitserver/domain/admin/event/api/service/AdminEventService.java (3)
4-4: 새로운 DTO 타입을 위한 import가 추가되었습니다.
AdminEventImageRequest사용을 위해 필요한 import입니다.
118-129: 파라미터 이름 변경이 가독성을 개선했습니다.
createDto를createEventWithTicketsReq로 변경하여 파라미터의 역할이 더 명확해졌습니다. 이미지 저장 로직도 새로운 헬퍼 메서드를 통해 적절히 호출되고 있습니다.
187-196: 이미지 저장 로직이 헬퍼 메서드로 잘 추출되었습니다.생성과 수정 흐름 모두에서 재사용 가능한
saveEventImages메서드를 추출하여 코드 중복을 제거했습니다.IntStream을 사용한 시퀀스 번호 생성과trim()을 통한 공백 제거도 적절합니다.단,
AdminEventImageRequest.imageUrl에 검증이 추가되지 않으면 Line 191에서 null pointer exception이 발생할 수 있으니, 해당 DTO에 검증을 추가하는 것이 중요합니다.
| public record AdminEventImageRequest( | ||
| String imageUrl | ||
| ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이미지 URL 필드에 검증 애노테이션을 추가하세요.
imageUrl 필드에 검증 로직이 없어 null이나 빈 문자열, 잘못된 형식의 URL이 허용될 수 있습니다. 부모 DTO에서 @Valid를 사용하고 있으므로, 이 필드에도 적절한 검증을 추가해야 합니다.
다음 diff를 적용하여 검증을 추가하세요:
+import jakarta.validation.constraints.NotBlank;
+
public record AdminEventImageRequest(
+ @NotBlank(message = "이미지 URL은 필수입니다.")
String imageUrl
) {
}필요시 URL 형식 검증을 위해 @Pattern 또는 커스텀 검증을 추가할 수도 있습니다.
🤖 Prompt for AI Agents
In
src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventImageRequest.java
around lines 3 to 5, the imageUrl record component lacks validation and can be
null/blank or an invalid URL; add Bean Validation annotations (e.g., @NotBlank
and a URL-format check such as @Pattern with a suitable regex or a
provider-specific @URL) to the imageUrl component, and import the corresponding
validation annotations so the parent DTO's @Valid will enforce non-empty and
correct URL formatting at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventImageRequest.java (1)
5-8: 기본 검증이 적용되었습니다. URL 형식 검증은 선택적으로 추가할 수 있습니다.
@NotBlank검증이 올바르게 적용되어 null 및 빈 문자열을 방지합니다. 필요시 URL 형식 검증(@Pattern또는@URL)을 추가하여 유효하지 않은 URL 형식을 사전에 차단할 수 있습니다.선택적으로 URL 형식 검증을 추가하려면:
import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Pattern; public record AdminEventImageRequest( @NotBlank(message = "이미지 URL은 필수입니다.") + @Pattern(regexp = "^https?://.*", message = "유효한 URL 형식이어야 합니다.") String imageUrl ) { }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventImageRequest.java(1 hunks)src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventUpdateRequest.java(2 hunks)src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventWithTicketCreateRequest.java(2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: sjk4618
Repo: PERMIT-SEOUL/permit-server PR: 48
File: src/main/java/com/permitseoul/permitserver/domain/guest/core/domain/entity/GuestEntity.java:31-37
Timestamp: 2025-07-15T09:37:32.765Z
Learning: sjk4618 prefers to implement factory methods or public constructors for entities when they are actually needed, rather than creating them proactively.
🔇 Additional comments (2)
src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventUpdateRequest.java (1)
49-51: 빈 리스트 허용 여부를 확인하세요.
@NotNull검증은 리스트 자체가 null이 아님을 보장하지만, 빈 리스트는 허용됩니다. 비즈니스 로직상 이벤트 업데이트 시 최소 1개의 이미지가 필요한 경우@NotEmpty또는@Size(min=1)검증을 추가해야 합니다.src/main/java/com/permitseoul/permitserver/domain/admin/event/api/dto/req/AdminEventWithTicketCreateRequest.java (1)
62-64: 행사 생성 시 이미지 필수 여부를 확인하세요.
@NotNull검증은 빈 리스트를 허용합니다. 행사 생성 시 최소 1개의 이미지가 필수인 경우@NotEmpty(message = "이미지는 최소 1개 이상이어야 합니다.")검증을 추가하는 것이 좋습니다.필요시 다음과 같이 수정:
@NotNull(message = "image는 필수입니다.") + @NotEmpty(message = "이미지는 최소 1개 이상이어야 합니다.") @Valid List<AdminEventImageRequest> images,
🔥Pull requests
⛳️ 작업한 브랜치
👷 작업한 내용
🚨 참고 사항