[refactor] #105 RESTful URI 구조로 통일 및 Admin API 분리#106
Conversation
WalkthroughThis update introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant Admin
participant AdminController
participant JwtService
participant FestivalFacade
participant ParticipantFacade
participant PointFacade
Admin->>AdminController: POST /v1/admin/festivals (createFestival)
AdminController->>JwtService: parseTokenAndGetUserId(token)
AdminController->>FestivalFacade: createFestival(userId, request)
FestivalFacade-->>AdminController: FestivalResponse
AdminController-->>Admin: ApiResponse<FestivalResponse>
Admin->>AdminController: GET /v1/admin/festivals (getAllFestivals)
AdminController->>JwtService: parseTokenAndGetUserId(token)
AdminController->>FestivalFacade: getAllFestivals(userId)
FestivalFacade-->>AdminController: List<AdminFestivalResponse>
AdminController-->>Admin: ApiResponse<List<AdminFestivalResponse>>
Admin->>AdminController: POST /v1/admin/festivals/{festivalId}/points (rechargePoints)
AdminController->>JwtService: parseTokenAndGetUserId(token)
AdminController->>PointFacade: rechargePoints(userId, festivalId, request)
PointFacade-->>AdminController: void
AdminController-->>Admin: ApiResponse<Void>
Assessment against linked issues
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Test Results40 tests 40 ✅ 1s ⏱️ Results for commit 05e3780. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
src/main/java/org/festimate/team/api/festival/FestivalController.java (1)
24-25: Consider storing and passing the userId to the facade.The method parses the user ID from the token but doesn't store or pass it to the facade. For consistency with other methods, consider passing the user ID to the facade method.
- jwtService.parseTokenAndGetUserId(accessToken); - FestivalVerifyResponse response = festivalFacade.verifyFestival(request); + Long userId = jwtService.parseTokenAndGetUserId(accessToken); + FestivalVerifyResponse response = festivalFacade.verifyFestival(userId, request);src/main/java/org/festimate/team/api/admin/AdminController.java (1)
56-66: Consistent error handling should be implemented.While the controller properly delegates to facade methods, there's no explicit error handling. Consider implementing global exception handling or adding try-catch blocks to handle potential errors from the facade layer.
src/main/java/org/festimate/team/api/participant/ParticipantController.java (2)
87-97: Consider response status for the modify endpoint.The
modifyMyMessageendpoint returnsResponseBuilder.created(null)which suggests resource creation, but this method is performing an update. Consider usingResponseBuilder.ok(null)to better reflect the HTTP semantics.- return ResponseBuilder.created(null); + return ResponseBuilder.ok(null);
22-31: Inconsistent parameter naming style.In the
getFestivalTypemethod, thefestivalIdparameter is defined as@PathVariable Long festivalId, whereas in other methods it's defined with the explicit name, e.g.,@PathVariable("festivalId") Long festivalId. Consider standardizing this approach throughout the controller for better consistency.- @PathVariable Long festivalId, + @PathVariable("festivalId") Long festivalId,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
src/main/java/org/festimate/team/api/admin/AdminController.java(1 hunks)src/main/java/org/festimate/team/api/admin/dto/AdminFestivalDetailResponse.java(1 hunks)src/main/java/org/festimate/team/api/admin/dto/AdminFestivalResponse.java(1 hunks)src/main/java/org/festimate/team/api/admin/dto/FestivalRequest.java(1 hunks)src/main/java/org/festimate/team/api/admin/dto/FestivalResponse.java(1 hunks)src/main/java/org/festimate/team/api/admin/dto/SearchParticipantResponse.java(1 hunks)src/main/java/org/festimate/team/api/facade/FestivalFacade.java(1 hunks)src/main/java/org/festimate/team/api/facade/ParticipantFacade.java(1 hunks)src/main/java/org/festimate/team/api/festival/FestivalController.java(1 hunks)src/main/java/org/festimate/team/api/participant/ParticipantController.java(6 hunks)src/main/java/org/festimate/team/api/point/PointController.java(1 hunks)src/main/java/org/festimate/team/domain/festival/service/FestivalService.java(1 hunks)src/main/java/org/festimate/team/domain/festival/service/impl/FestivalServiceImpl.java(1 hunks)src/test/java/org/festimate/team/api/facade/FestivalFacadeTest.java(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/main/java/org/festimate/team/api/admin/AdminController.java (1)
src/main/java/org/festimate/team/global/response/ResponseBuilder.java (1)
ResponseBuilder(5-19)
src/main/java/org/festimate/team/api/participant/ParticipantController.java (1)
src/main/java/org/festimate/team/global/response/ResponseBuilder.java (1)
ResponseBuilder(5-19)
🔇 Additional comments (17)
src/main/java/org/festimate/team/api/admin/dto/AdminFestivalResponse.java (1)
1-1: Package Declaration Updated for Admin ContextThe package has been changed to
org.festimate.team.api.admin.dtoto reflect the new AdminController boundary. Confirm that the directory path (.../api/admin/dto/) matches this declaration and that all references to this class in facades and controllers are updated.src/main/java/org/festimate/team/api/admin/dto/SearchParticipantResponse.java (1)
1-1: Package Declaration Updated for Admin Participant SearchThe package change to
org.festimate.team.api.admin.dtocorrectly isolates admin-specific DTOs. Ensure theParticipantControllerno longer references this DTO and that theAdminControllerimports it from the new location.src/main/java/org/festimate/team/api/facade/ParticipantFacade.java (1)
4-4: Import Updated to Admin DTO for Participant SearchThe import for
SearchParticipantResponsenow points to the admin DTO package, aligning with the newAdminController. Verify that no stale imports of the old package remain and that any controller or service using this DTO references the updated path.src/main/java/org/festimate/team/domain/festival/service/impl/FestivalServiceImpl.java (1)
7-7: Import Updated to Admin DTO for FestivalRequestThe
FestivalRequestimport now references the admin-specific DTO package, matching the shift of festival management endpoints toAdminController. Confirm that validation and mapping logic consume the correct DTO and that the original non-admin endpoints no longer rely on this class.src/main/java/org/festimate/team/domain/festival/service/FestivalService.java (1)
3-3: Interface Signature Adjusted to Admin FestivalRequestThe service interface now accepts
FestivalRequestfromorg.festimate.team.api.admin.dto. Ensure downstream implementations and callers (including facades and controllers) are updated to use the admin DTO and that no legacy imports remain.src/test/java/org/festimate/team/api/facade/FestivalFacadeTest.java (1)
3-3: Correct import for relocatedFestivalRequest.
The import has been updated toorg.festimate.team.api.admin.dto.FestivalRequestto reflect the DTO move under the admin package.src/main/java/org/festimate/team/api/admin/dto/FestivalRequest.java (1)
1-1: Package declaration updated for admin scope.
MovingFestivalRequestintoorg.festimate.team.api.admin.dtoaligns with separating admin APIs into their own controller.src/main/java/org/festimate/team/api/admin/dto/AdminFestivalDetailResponse.java (1)
1-1: Package declaration aligned with admin DTOs.
AdminFestivalDetailResponsehas been moved to theadmin.dtopackage, matching the new AdminController structure.src/main/java/org/festimate/team/api/admin/dto/FestivalResponse.java (1)
1-1: Admin DTO package placement confirmed.
FestivalResponsenow resides underorg.festimate.team.api.admin.dtoas part of the admin API refactoring.src/main/java/org/festimate/team/api/facade/FestivalFacade.java (1)
4-10: Explicit DTO imports for improved clarity.
Replacing the wildcard import with explicit imports fromadmin.dtoandfestival.dtoensures that it's clear which controllers use which DTOs, supporting the separation of admin and public APIs.src/main/java/org/festimate/team/api/point/PointController.java (2)
20-20: Good refactoring to RESTful URI structure.The endpoint path now follows a more consistent RESTful pattern with nested resources. The change from
/festivals/{festivalId}/me/pointsto/festivals/{festivalId}/participants/me/pointsclearly identifies the resource hierarchy.
1-28: Excellent job isolating admin endpoints.The controller now focuses solely on user-specific point operations, with admin functionality properly moved to a dedicated AdminController. This separation of concerns follows good API design principles.
src/main/java/org/festimate/team/api/festival/FestivalController.java (1)
19-19: Good simplification of the endpoint name.Changing from
/verify-codeto/verifycreates a cleaner, more concise URI that still clearly communicates the endpoint's purpose.src/main/java/org/festimate/team/api/admin/AdminController.java (2)
1-89: Well-structured admin controller with consolidated endpoints.The new AdminController successfully centralizes all administrative operations for festivals, participants, and points under a single, dedicated controller. The URI structure is consistent, following REST best practices with clear resource hierarchies.
19-19: Good choice of base request mapping.Using
/v1/admin/festivalsas the base path clearly separates admin APIs from regular user APIs and establishes festivals as the primary resource.src/main/java/org/festimate/team/api/participant/ParticipantController.java (2)
14-14: Good refactoring of base request mapping.Changing from
/v1to/v1/festivalsprovides a clearer resource hierarchy and better aligns with RESTful URI conventions.
33-42: Appropriate change from POST to GET for resource retrieval.The
entryFestivalendpoint now correctly uses GET instead of POST, following HTTP method semantics since it retrieves a participant's entry status rather than creating a resource.
📌 PR 제목
[refactor] #105 RESTful URI 구조로 통일 및 Admin API 분리
📌 PR 내용
🛠 작업 내용
🔍 관련 이슈
Closes #105
📸 스크린샷 (Optional)
📚 레퍼런스 (Optional)
N/A
Summary by CodeRabbit
New Features
Refactor
Bug Fixes
Style