feat: [NDGL-133] 어드민 페이지 사용자 요청 컨텐츠 목록 조회#75
Hidden character warning
Conversation
개요이 PR은 관리자가 상태별로 필터링하고 페이지네이션을 사용하여 사용자가 제안한 템플릿을 조회할 수 있는 기능을 추가합니다. 공통 페이지 응답 DTO, QueryDSL 저장소 구현, 도메인 및 애플리케이션 계층의 조회 메서드, 관리자 MVC 컨트롤러, 그리고 Thymeleaf UI 템플릿을 포함합니다. 변경 사항Admin User-Suggested Template Listing
시퀀스 다이어그램sequenceDiagram
participant Admin as Admin User
participant Browser as Web Browser
participant Controller as AdminUserSuggestedTemplateViewController
participant Facade as UserSuggestedTemplateFacade
participant Service as UserSuggestedTemplateService
participant DomainService as UserSuggestedTemplateDomainService
participant Repository as UserSuggestedTemplateRepositoryImpl
participant Template as Thymeleaf Template
Admin->>Browser: GET /admin/user-suggested-templates?status=PENDING&page=0&size=12
Browser->>Controller: HTTP GET request
Controller->>Facade: readUserSuggestedTemplatesForAdmin(PENDING, 0, 12)
Facade->>Facade: log info message
Facade->>Service: readUserSuggestedTemplatesForAdmin(PENDING, 0, 12)
Service->>DomainService: findUserSuggestedTemplates(PENDING, 0, 12)
DomainService->>DomainService: create PageRequest(0, 12, createdAt DESC)
DomainService->>Repository: findByStatus(PENDING, PageRequest)
Repository->>Repository: build QueryDSL predicate with status filter
Repository->>Repository: fetch page content with sort and offset/limit
Repository->>Repository: execute separate count query
Repository-->>DomainService: Page<UserSuggestedTemplateEntity>
DomainService->>DomainService: map entities to UserSuggestedTemplate domain objects
DomainService-->>Service: Page<UserSuggestedTemplate>
Service->>Service: map domain objects to AdminUserSuggestedTemplateResponse
Service->>Service: create PageResponse with content and metadata
Service-->>Facade: PageResponse<AdminUserSuggestedTemplateResponse>
Facade-->>Controller: PageResponse<AdminUserSuggestedTemplateResponse>
Controller->>Controller: populate model with templates and pagination metadata
Controller->>Template: render admin/user-suggested-template-list
Template-->>Browser: rendered HTML with template grid and pagination
Browser-->>Admin: display admin template listing page
예상 코드 리뷰 노력🎯 3 (중간) | ⏱️ ~25분 시
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@application/src/main/java/com/yapp/ndgl/application/domains/admin/controller/AdminUserSuggestedTemplateViewController.java`:
- Around line 30-31: The controller AdminUserSuggestedTemplateViewController
accepts query params page and size without validation; add input constraints
(e.g., annotate the method parameters page and size with javax.validation
annotations like `@Min`(0) for page and `@Min`(1) plus a sensible `@Max`(100> or
configured limit for size) or explicitly clamp the values at the start of the
handler) and ensure `@Validated` is present on the controller class (or method) so
those annotations are enforced; update the signatures for the parameters named
page and size and/or add an initial normalization step to bound invalid values
to safe defaults.
In
`@application/src/main/resources/templates/admin/user-suggested-template-list.html`:
- Line 231: The template directly binds user input t.videoLink into href,
exposing stored XSS via malicious schemes; update the code so the view only
renders the anchor when the server has validated/normalized t.videoLink (accept
only https and allowlisted hostnames such as youtube.com / youtu.be) and rejects
or clears any other schemes/domains — implement validation/normalization in the
backend where t.videoLink is set (or add a helper/validator used by the
controller) and ensure the template only uses the validated field (or a boolean
like isVideoLinkValid) so that if validation fails the anchor is not rendered;
also ensure output is HTML-escaped if any fallback rendering occurs.
In `@common/src/main/java/com/yapp/ndgl/common/response/PageResponse.java`:
- Around line 41-50: PageResponse.of currently accepts negative inputs leading
to bad metadata; add input validation at the start of the PageResponse.of(...)
method to assert that size >= 0, page >= 0 and totalElements >= 0 and throw an
IllegalArgumentException (with a clear message naming the offending parameter)
if any check fails; keep size == 0 allowed (it already produces totalPages == 0)
and perform these checks before computing totalPages/hasNext/hasPrevious so
invalid values are rejected early.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 05ea173d-065e-4def-a6bb-3e7effd7a4ab
📒 Files selected for processing (15)
.gitignoreapplication/build.gradleapplication/src/main/java/com/yapp/ndgl/application/domains/admin/controller/AdminUserSuggestedTemplateViewController.javaapplication/src/main/java/com/yapp/ndgl/application/domains/travel/controller/dto/AdminUserSuggestedTemplateResponse.javaapplication/src/main/java/com/yapp/ndgl/application/domains/travel/facade/UserSuggestedTemplateFacade.javaapplication/src/main/java/com/yapp/ndgl/application/domains/travel/service/UserSuggestedTemplateService.javaapplication/src/main/resources/templates/admin/travel-template-list.htmlapplication/src/main/resources/templates/admin/user-suggested-template-list.htmlcommon/src/main/java/com/yapp/ndgl/common/response/PageResponse.javadomain/domain-rdb/src/main/java/com/yapp/ndgl/domain/travel/repository/UserSuggestedTemplateRepository.javadomain/domain-rdb/src/main/java/com/yapp/ndgl/domain/travel/repository/UserSuggestedTemplateRepositoryCustom.javadomain/domain-rdb/src/main/java/com/yapp/ndgl/domain/travel/repository/UserSuggestedTemplateRepositoryImpl.javadomain/domain-service/src/main/java/com/yapp/ndgl/domain/travel/UserSuggestedTemplate.javadomain/domain-service/src/main/java/com/yapp/ndgl/domain/travel/mapper/UserSuggestedTemplateMapper.javadomain/domain-service/src/main/java/com/yapp/ndgl/domain/travel/service/UserSuggestedTemplateDomainService.java
요약
관리자에서 사용자 제안 영상 템플릿을 조회·필터링·페이징할 수 있는 목록 페이지와 관련 백엔드 흐름을 추가합니다.
변경 내용
Summary by CodeRabbit
릴리스 노트
새로운 기능
Chores