Skip to content

Conversation

@seung-in-Yoo
Copy link
Member

@seung-in-Yoo seung-in-Yoo commented Aug 19, 2025

✔️ 연관 이슈

📝 작업 내용

1) 유저 장소 저장 API 이름, 역할 수정

POST => /api/v1/users/places

의미: 웨이블존을 저장할 리스트 생성

(기존) 웨이블존을 즉시 저장 -> (변경) 웨이블존을 저장하기 위한 리스트만 생성 (여기서 웨이블존 저장 X)

Request Body:

{
  "title": "장애인 전용 카페",
  "color": "PINK"
}

Response Body:

{
  "data": {
    "placeId": 5,
    "title": "장애인 전용 카페",
    "color": "PINK",
    "message": "리스트가 생성되었습니다."
  }
}

2) 리스트에 웨이블존 추가 API 구현

POST => /api/v1/users/places/zones

의미: 기존에 만든 리스트에 웨이블존을 추가 (여러개 가능)

Request Body:

{
  "placeId": 5,
  "waybleZoneIds": [280, 281, 282]
}

Response Body:

{
  "message": "리스트에 웨이블존이 추가되었습니다."
}

3) 특정 장소 리스트에 대하여 페이징 조회 테스트
리스트에 웨이블존 여러개 저장하고 페이징 조회 해보면 각각 웨이블존에 대해서 여러개 조회 완료

🖼️스크린샷 (선택)

웨이블존 저장할 리스트 생성 성공

리스트생성성공

리스트에 웨이블존 추가 성공

리스트에웨이블존추가성공

특정 장소 리스트에 대하여 페이징 조회 성공

특정장소리스트에대해서페이징조회성공

리스트에서 저장한 웨이블존 삭제 성공

리스트에서웨이블존제거성공

Summary by CodeRabbit

  • New Features
    • 장소 리스트 생성 API 추가 및 placeId 포함 응답 제공
    • 리스트에 웨이블존 일괄 추가 API, 리스트에서 웨이블존 제거 API 추가
    • 리스트 생성 시 색상 미지정이면 GRAY 기본값 적용
  • Refactor
    • 기존 “웨이블존 저장” 흐름을 리스트 생성과 존 추가로 분리
    • 리스트 생성 시 제목 중복 검증 도입
  • Documentation
    • 리스트 생성 관련 설명과 응답 메시지/코드 예시 업데이트
  • Chores
    • 인증 UNAUTHORIZED 오류 코드 변경
    • 리스트 제목 중복 오류 케이스 추가

@seung-in-Yoo seung-in-Yoo self-assigned this Aug 19, 2025
@seung-in-Yoo seung-in-Yoo added 💡 feature 기능 구현 및 개발 🛠️ fix 기능 오류 및 코드 개선이 필요한 곳 수정 labels Aug 19, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 19, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

사용자 장소 기능을 분리/확장: 기존 저장 API를 “리스트 생성”으로 전환하고, 리스트에 웨이블존 추가/삭제 엔드포인트를 도입. 서비스는 리스트 생성과 존 추가 로직을 분리 구현. 사용자 에러에 중복 제목 코드 추가. 인증 에러의 UNAUTHORIZED 코드 값을 변경.

Changes

Cohort / File(s) Summary
Auth 에러 코드 조정
src/main/java/com/wayble/server/auth/exception/AuthErrorCase.java
UNAUTHORIZED의 errorCode를 1001→7001로 변경(HTTP 401, 메시지 동일).
UserPlace 컨트롤러 API 개편
src/main/java/com/wayble/server/user/controller/UserPlaceController.java
POST를 “리스트 생성”으로 변경(요청/응답 DTO 교체, 메서드명 변경). 신규 엔드포인트 추가: DELETE /users/places(존 제거), POST /users/places/zones(다중 존 추가). 중복 remove 엔드포인트 제거. Swagger 문구/응답 코드 업데이트.
DTO 추가(리스트 생성/존 추가)
src/main/java/com/wayble/server/user/dto/UserPlaceCreateRequestDto.java, .../UserPlaceCreateResponseDto.java, .../UserPlaceAddZonesRequestDto.java
신규 레코드 DTO 3종 추가: 리스트 생성 요청(NotBlank title)/응답(placeId,title,color,message @builder), 리스트에 다중 존 추가 요청(placeId @NotNull, waybleZoneIds @notempty).
User 에러 케이스 추가
src/main/java/com/wayble/server/user/exception/UserErrorCase.java
PLACE_TITLE_DUPLICATED(400,1016,"동일한 이름의 리스트가 이미 있습니다.") 추가. 기존 마지막 상수 구분자 수정(세미콜론→콤마).
UserPlace 서비스 분리/확장
src/main/java/com/wayble/server/user/service/UserPlaceService.java
saveUserPlace 제거 후 분리: createPlaceList(user,title,color)→중복 제목 검사, 색상 기본값 GRAY, 새 place 생성 후 ID 반환. addZonesToPlace(user,placeId,zoneIds)→place 검증, 입력 존 ID 중복 제거, 존재/중복 매핑 체크, 신규 매핑 생성, 카운트/좋아요 갱신.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant UC as UserPlaceController
  participant US as UserPlaceService
  participant UR as UserRepository
  participant PR as UserPlaceRepository

  C->>UC: POST /api/v1/users/places (title,color)
  UC->>US: createPlaceList(userId, request)
  US->>UR: findById(userId)
  UR-->>US: User
  US->>PR: existsByUserAndTitle(user,title)
  PR-->>US: boolean
  alt 제목 중복
    US-->>UC: throw PLACE_TITLE_DUPLICATED (400)
    UC-->>C: Error response
  else 생성
    US->>PR: save(new UserPlace(title,colorOrGRAY))
    PR-->>US: saved Place (id)
    US-->>UC: placeId
    UC-->>C: 200 {placeId,title,color,message}
  end
Loading
sequenceDiagram
  autonumber
  participant C as Client
  participant UC as UserPlaceController
  participant US as UserPlaceService
  participant PR as UserPlaceRepository
  participant ZR as WaybleZoneRepository
  participant MR as UserPlaceWaybleZoneMappingRepository

  C->>UC: POST /api/v1/users/places/zones (placeId, zoneIds[])
  UC->>US: addZonesToPlace(userId, placeId, zoneIds)
  US->>PR: findByIdAndUser(placeId,user)
  PR-->>US: Place | null
  alt place 없음
    US-->>UC: throw PLACE_NOT_FOUND
    UC-->>C: Error response
  else 처리
    US->>US: LinkedHashSet으로 zoneIds 중복 제거
    loop 각 zoneId
      US->>ZR: findById(zoneId)
      ZR-->>US: Zone | null
      alt zone 없음
        US->>US: skip (WAYBLE_ZONE_NOT_FOUND throw 여부는 호출부 정의대로)
      else 존재
        US->>MR: existsByPlaceAndZone(place, zone)
        MR-->>US: boolean
        alt 미매핑
          US->>MR: save(new Mapping(place, zone))
          US->>US: place.savedCount++, zone.likes++
          US->>ZR: save(zone)
        else 이미 매핑
          US->>US: skip
        end
      end
    end
    US->>PR: save(place) (필요 시)
    US-->>UC: void
    UC-->>C: 200 "리스트에 웨이블존이 추가되었습니다."
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • KiSeungMin
  • hyoinYang
  • wonjun-lee-fcwj245

Poem

토끼는 귀를 세우고 색을 고르네, GRAY!
새 리스트 톡톡, 제목은 꼭 비워두지 말 것!
고유한 이름에 점프, 중복엔 살짝 멈칫—
존들도 줄지어 폴짝, 맵핑은 착착!
오늘도 웨이블 숲에 체크표시 하나 ✨🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cba4d8e and 9700c53.

📒 Files selected for processing (7)
  • src/main/java/com/wayble/server/auth/exception/AuthErrorCase.java (1 hunks)
  • src/main/java/com/wayble/server/user/controller/UserPlaceController.java (3 hunks)
  • src/main/java/com/wayble/server/user/dto/UserPlaceAddZonesRequestDto.java (1 hunks)
  • src/main/java/com/wayble/server/user/dto/UserPlaceCreateRequestDto.java (1 hunks)
  • src/main/java/com/wayble/server/user/dto/UserPlaceCreateResponseDto.java (1 hunks)
  • src/main/java/com/wayble/server/user/exception/UserErrorCase.java (1 hunks)
  • src/main/java/com/wayble/server/user/service/UserPlaceService.java (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/seungin

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@seung-in-Yoo seung-in-Yoo linked an issue Aug 19, 2025 that may be closed by this pull request
3 tasks
@seung-in-Yoo seung-in-Yoo merged commit 823d51b into develop Aug 19, 2025
1 check passed
Copy link
Member

@KiSeungMin KiSeungMin left a comment

Choose a reason for hiding this comment

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

수고 많으셨습니다!!

import java.util.List;

public record UserPlaceAddZonesRequestDto(
@NotNull Long placeId,
Copy link
Member

Choose a reason for hiding this comment

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

하나의 플래이스 리스트에 동시에 여러 개의 웨이블존을 추가하는 경우는 없을 것 같습니다!
반대로 하나의 웨이블존을 동시에 여러 개의 플레이스 리스트에 넣는 기능은 현재 화면이 구현되어 있는 상태입니다!

따라서 placeId는 리스트로, waybleZoneId는 단일 Long 값으로 받는게 좋을 것 같다는 생각입니다!

Copy link
Member Author

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋㅋ 반대로 했네요 ㅠ.ㅠ 수정했습니다

return CommonResponse.success(summaries);
}

@DeleteMapping
Copy link
Member

Choose a reason for hiding this comment

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

여기도 엔드포인트에 /zones가 붙어야 할 것 같아요!
현재 상태면 아예 장소 리스트를 삭제하는 걸로 오해할 것 같습니다!

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

Labels

💡 feature 기능 구현 및 개발 🛠️ fix 기능 오류 및 코드 개선이 필요한 곳 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FIX] 유저 웨이블존 저장 및 조회 관련 API 수정

3 participants