Skip to content

[feat] 배달팟 참여자 목록 조회 API 구현#99

Open
daekyochung wants to merge 1 commit into
developfrom
feature/party-participants-api
Open

[feat] 배달팟 참여자 목록 조회 API 구현#99
daekyochung wants to merge 1 commit into
developfrom
feature/party-participants-api

Conversation

@daekyochung

@daekyochung daekyochung commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

작업 내용

변경 사항

  • GET /api/v1/parties/{partyId}/participants 엔드포인트 추가
  • JOINED 상태의 참여자만 조회하고 CANCELED 상태는 제외
  • 방장 역할을 OWNER로 변환해 응답
  • 참여자 프로필 정보와 예외 응답 추가
  • 참여자 목록 조회 서비스 단위 테스트 추가

리뷰 포인트

  • 방장 정보는 delivery_parties.creatorId를 기준으로 구성
  • 도메인 역할 HOST와 API 응답 역할 OWNER의 변환 규칙
  • 참여자 목록 엔드포인트에만 인증을 적용한 Security 설정

체크리스트

  • 로컬에서 실행 확인
  • Swagger 문서 갱신

Closes #97

Summary by CodeRabbit

  • New Features
    • Added an endpoint to view a party’s participant list.
    • Participant details now include user ID, nickname, profile image, and role (owner or member).
    • Party APIs are accessible through both delivery-party and party URL paths.
  • Bug Fixes
    • Improved authentication responses for participant-list requests, including a clear login-required message.
    • Restricted public delivery-party access to specific supported routes and methods.

@daekyochung daekyochung self-assigned this Jul 26, 2026
@daekyochung daekyochung added the party(배달팟) 배달팟 label Jul 26, 2026
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds an authenticated party-participant listing API, response DTOs, service retrieval and role mapping, explicit security rules, and a dedicated unauthorized response for participant-list requests.

Changes

Party participant listing

Layer / File(s) Summary
Participant response and service logic
src/main/java/com/leets/tdd/party/dto/response/*, src/main/java/com/leets/tdd/party/exception/PartyErrorCode.java, src/main/java/com/leets/tdd/party/service/DeliveryPartyService.java, src/test/java/com/leets/tdd/party/service/DeliveryPartyServiceTest.java
Defines participant response records, retrieves JOINED participants and users, maps owner/member roles, handles lookup failures, and tests successful retrieval.
Participant endpoint and routing
src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java
Supports both party base paths and adds GET /{partyId}/participants returning the wrapped participant list.
Endpoint authorization and authentication response
src/main/java/com/leets/tdd/global/config/SecurityConfig.java, src/main/java/com/leets/tdd/global/config/JwtAuthenticationEntryPoint.java
Replaces broad delivery-party access with explicit method-based rules and returns a JSON 401 response for unauthenticated participant-list requests.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant DeliveryPartyController
  participant DeliveryPartyService
  participant PartyParticipantRepository
  participant UserRepository
  Client->>DeliveryPartyController: GET /api/v1/parties/{partyId}/participants
  DeliveryPartyController->>DeliveryPartyService: getPartyParticipants(partyId)
  DeliveryPartyService->>PartyParticipantRepository: Find JOINED participants
  DeliveryPartyService->>UserRepository: Batch-load users
  UserRepository-->>DeliveryPartyService: User records
  DeliveryPartyService-->>DeliveryPartyController: PartyParticipantListResponse
  DeliveryPartyController-->>Client: ApiResponse success
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The API, auth, data mapping, and tests align with #97, but the required Swagger documentation update is still missing. Add or update the Swagger/OpenAPI documentation for GET /api/v1/parties/{partyId}/participants to match the implemented API.
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: implementing the delivery party participant list API.
Out of Scope Changes check ✅ Passed The changes stay focused on the participant-list API, related security, DTOs, service logic, and tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/party-participants-api

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@src/main/java/com/leets/tdd/global/config/JwtAuthenticationEntryPoint.java`:
- Around line 30-38: Update the request URI check in JwtAuthenticationEntryPoint
to match participant-list routes under both /api/v1/parties and
/api/v1/delivery-parties, while preserving the existing unauthorized JSON
response and Korean login-required message.

In `@src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java`:
- Around line 75-82: The getPartyParticipants endpoint lacks OpenAPI
documentation. Add `@Operation` and `@SecurityRequirement` annotations to document
bearer authentication, and include response documentation for successful
retrieval plus unauthorized and not-found failures, using the controller’s
existing Swagger annotation conventions.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 80a58e00-7f59-4c1f-9cc5-9777e377f895

📥 Commits

Reviewing files that changed from the base of the PR and between 4c1c509 and 077005a.

📒 Files selected for processing (8)
  • src/main/java/com/leets/tdd/global/config/JwtAuthenticationEntryPoint.java
  • src/main/java/com/leets/tdd/global/config/SecurityConfig.java
  • src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java
  • src/main/java/com/leets/tdd/party/dto/response/PartyParticipantListResponse.java
  • src/main/java/com/leets/tdd/party/dto/response/PartyParticipantResponse.java
  • src/main/java/com/leets/tdd/party/exception/PartyErrorCode.java
  • src/main/java/com/leets/tdd/party/service/DeliveryPartyService.java
  • src/test/java/com/leets/tdd/party/service/DeliveryPartyServiceTest.java

Comment on lines +30 to +38
if (request.getRequestURI().matches("/api/v1/parties/[^/]+/participants")) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding("UTF-8");
response.getWriter().write(
objectMapper.writeValueAsString(ApiResponse.fail("로그인이 필요합니다."))
);
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate file =="
fd -a 'JwtAuthenticationEntryPoint\.java$' . || true

echo "== locate participant endpoints =="
rg -n 'participants|delivery-parties|parties' src/main/java src/test/java --glob '*java' || true

echo "== git status =="
git status --short || true

Repository: Leets-Official/TDD-BE

Length of output: 8657


🏁 Script executed:

#!/bin/bash
set -euo pipefail

entrypoint=$(fd 'JwtAuthenticationEntryPoint\.java$' . | head -n 1)
echo "== entrypoint: $entrypoint =="
if [ -n "$entrypoint" ]; then
  wc -l "$entrypoint"
  cat -n "$entrypoint"
fi

echo "== candidate controller files =="
rg -l '`@RequestMapping`|`@GetMapping`|participants|delivery-parties' src/main/java --glob '*java' | head -n 50 || true

echo "== participant mappings outline/text snippets =="
for f in $(rg -l 'participants|delivery-parties' src/main/java --glob '*java' | head -n 20); do
  echo "--- $f ---"
  wc -l "$f"
  rg -n -C 4 'participants|delivery-parties|parties' "$f" || true
done

echo "== regex-only parse verifier from source =="
python3 - <<'PY'
import re, pathlib, sys
entrypoints=list(pathlib.Path('.').rglob('JwtAuthenticationEntryPoint.java'))
for p in entrypoints:
    text=p.read_text()
    m=re.search(r'request\.getRequestURI\(\)\.matches\("([^"]+)"\)', text)
    print(f"{p}: {m.group(1) if m else 'no route regex'}")
    if m:
        pattern=m.group(1)
        for path in [
            "/api/v1/parties/abc123/participants",
            "/api/v1/delivery-parties/abc123/participants",
            "/api/v1/parties/abc123",
        ]:
            print(f"  {path} -> {re.fullmatch(pattern, path)}")
PY

Repository: Leets-Official/TDD-BE

Length of output: 17286


Handle both registered participant-list routes.

DeliveryPartyController maps {partyId}/participants under both /api/v1/parties and /api/v1/delivery-parties, but this exception handler only matches the former. Missing-token requests to /api/v1/delivery-parties/{partyId}/participants fall through to the generic JWT error response instead of returning “로그인이 필요합니다.”

Proposed fix
-        if (request.getRequestURI().matches("/api/v1/parties/[^/]+/participants")) {
+        if (request.getRequestURI().matches(
+                "/api/v1/(?:parties|delivery-parties)/[^/]+/participants"
+        )) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (request.getRequestURI().matches("/api/v1/parties/[^/]+/participants")) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding("UTF-8");
response.getWriter().write(
objectMapper.writeValueAsString(ApiResponse.fail("로그인이 필요합니다."))
);
return;
}
if (request.getRequestURI().matches(
"/api/v1/(?:parties|delivery-parties)/[^/]+/participants"
)) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setCharacterEncoding("UTF-8");
response.getWriter().write(
objectMapper.writeValueAsString(ApiResponse.fail("로그인이 필요합니다."))
);
return;
}
🧰 Tools
🪛 ast-grep (0.44.1)

[warning] 33-35: Avoid writing untrusted input to the HTTP response
Context: response.getWriter().write(
objectMapper.writeValueAsString(ApiResponse.fail("로그인이 필요합니다."))
)
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').

(xss-protection-java)

🤖 Prompt for 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.

In `@src/main/java/com/leets/tdd/global/config/JwtAuthenticationEntryPoint.java`
around lines 30 - 38, Update the request URI check in
JwtAuthenticationEntryPoint to match participant-list routes under both
/api/v1/parties and /api/v1/delivery-parties, while preserving the existing
unauthorized JSON response and Korean login-required message.

Comment on lines +75 to +82
@GetMapping("/{partyId}/participants")
public ResponseEntity<ApiResponse<PartyParticipantListResponse>> getPartyParticipants(
@PathVariable Long partyId,
@AuthenticationPrincipal UserPrincipal currentUser
) {
PartyParticipantListResponse response = deliveryPartyService.getPartyParticipants(partyId);
return ResponseEntity.ok(ApiResponse.success("참여자 목록 조회에 성공했습니다.", response));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate file =="
fd -a 'DeliveryPartyController.java|DeliveryPartyService.java|.*Swagger.*|.*OpenApi.*|.*ApiDoc.*' . | sed 's#^\./##' | head -h 100

echo "== target controller outline =="
if [ -f src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java ]; then
  ast-grep outline src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java || true
  echo "== target controller relevant section =="
  cat -n src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java | sed -n '1,140p'
else
  echo "target file not found"
fi

echo "== swagger annotations around target =="
rg -n "@(Operation|ApiResponse|SecurityIgnore|SecurityScheme|SecurityRequirement|Tag|SecurityAspect|ApiSecurity|Authorization|ErrorResponse|SecurityResponse|SecuritySchema|SecurityResponse|SecurityResponses|SecurityResponse)" src/main/java || true

echo "== global/api docs mentions =="
rg -n "Swagger|OpenAPI|openapi|`@io`\.swagger|`@springdoc`|ApiResponse|SecurityResponse|`@SecurityAnnotation`|`@SecurityResponses`|`@Security`" src/main/java || true

Repository: Leets-Official/TDD-BE

Length of output: 245


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate file =="
fd 'DeliveryPartyController.java|DeliveryPartyService.java|.*Swagger.*|.*OpenApi.*|.*ApiDoc.*' . | sed 's#^\./##' | head -n 150

echo "== target controller outline =="
if [ -f src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java ]; then
  ast-grep outline src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java || true
  echo "== target controller relevant section =="
  cat -n src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java | sed -n '1,140p'
else
  echo "target file not found"
fi

echo "== swagger/security annotations around target =="
rg -n "@(Operation|ApiResponse|SecurityIgnore|SecurityScheme|SecurityRequirement|Tag|SecurityAspect|ApiSecurity|Authorization|ErrorResponse|SecurityResponse|SecuritySchema|SecurityResponses|SecurityResponse)" src/main/java || true

echo "== global/api docs mentions =="
rg -n "Swagger|OpenAPI|openapi|`@io`\.swagger|`@springdoc`|ApiResponse|SecurityResponse|`@SecurityAnnotation`|`@SecurityResponses`|`@Security`" src/main/java || true

Repository: Leets-Official/TDD-BE

Length of output: 31350


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== party service outline =="
ast-grep outline src/main/java/com/leets/tdd/party/service/DeliveryPartyService.java || true
echo "== party service getPartyParticipants section =="
cat -n src/main/java/com/leets/tdd/party/service/DeliveryPartyService.java | sed -n '1,220p'

echo "== party controller security annotations =="
cat -n src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java | sed -n '1,120p' | rg -n "@(Operation|ApiResponse|SecurityIgnore|SecurityScheme|SecurityRequirement|Tag|ApiResponse|SecurityResponses|SecurityResponse)" || true

echo "== comparable documented controller sections =="
for f in \
  src/main/java/com/leets/tdd/user/controller/UserController.java \
  src/main/java/com/leets/tdd/settlement/controller/SettlementController.java \
  src/main/java/com/leets/tdd/board/controller/PostController.java
do
  if [ -f "$f" ]; then
    echo "-- $f --"
    rg -n -C 8 "@(Operation|ApiResponse|SecurityRequirement|Tag)" "$f" || true
  fi
done

echo "== swagger config =="
cat -n src/main/java/com/leets/tdd/global/config/SwaggerConfig.java

Repository: Leets-Official/TDD-BE

Length of output: 24829


Add Swagger documentation for participants retrieval.

getPartyParticipants exposes participant data and accepts @AuthenticationPrincipal, but the endpoint has no @Operation, @SecurityRequirement, or failure response documentation. Add operation/response docs including the bearer-authenticated success path and unauthorized/not-found failures.

🤖 Prompt for 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.

In `@src/main/java/com/leets/tdd/party/controller/DeliveryPartyController.java`
around lines 75 - 82, The getPartyParticipants endpoint lacks OpenAPI
documentation. Add `@Operation` and `@SecurityRequirement` annotations to document
bearer authentication, and include response documentation for successful
retrieval plus unauthorized and not-found failures, using the controller’s
existing Swagger annotation conventions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 배달팟 참여자 목록 조회 API 구현

1 participant