Skip to content

feat: 매거진, 투데이 2차 api 구현 - #43

Merged
yxpjseo merged 13 commits into
developfrom
36/feature/place-course
Aug 6, 2026
Merged

yxpjseo merged 13 commits into
developfrom
36/feature/place-course

Conversation

@yxpjseo

@yxpjseo yxpjseo commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

📌 관련 이슈


🔎 What is this PR?

매거진(한국관광공사 KorService2 연동) 조회·장소 저장과 투데이 코스 장소 추가/순서 변경 API를 구현했습니다.

✨ Changes

  • 매거진 API: 목록(오늘의 Pick)·상세·사진을 KorService2로 실시간 프록시. Magazine 경량 테이블로 광고 오버레이, Region에 관광 지역코드 매핑 추가
  • 장소 저장(북마크): 저장/해제. 관광 contentId로 Place lazy upsert 후 BookmarkPlace 생성
  • 투데이 코스: 장소 추가(TDY-006)·순서 변경(TDY-004). 추천 담기와 공통 append 로직 재사용
  • 인증 전환: 저장 목록·오늘의 코스 API를 임시 X-User-Id 헤더 → JWT(@AuthenticationPrincipal)
  • 기타: Swagger 태그·요약 추가, 탈퇴 정리의 죽은 참조 정리, stale 테스트 보정

📷 Result


💬 To. Reviewer


✅ 체크 리스트

  • base 브랜치(develop 또는 main) 최신 상태 pull 및 충돌 확인 완료
  • Reviewers 설정
  • Assignees 설정
  • Labels 설정

Summary by CodeRabbit

  • New Features
    • Browse curated magazine picks, view details, and access additional photos.
    • Add or remove place bookmarks.
    • Add places to courses and reorder course places.
    • Save course memory photos and view updated course information.
  • Improvements
    • Course and bookmark actions now provide clearer validation and ownership handling.
    • Today’s course features require authentication for improved security.
    • Place and magazine information is enriched with tourism data and imagery.

@yxpjseo yxpjseo self-assigned this Aug 3, 2026
@yxpjseo yxpjseo added the ✨ feature 새로운 기능을 추가하는 작업 label Aug 3, 2026
@yxpjseo yxpjseo linked an issue Aug 3, 2026 that may be closed by this pull request
7 tasks
@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d79ddd7-981f-454c-a9da-4431dc8b2d3c

📥 Commits

Reviewing files that changed from the base of the PR and between 2c76d9a and 02040ea.

📒 Files selected for processing (1)
  • src/main/java/com/daytodo/domain/course/exception/code/CourseErrorCode.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/daytodo/domain/course/exception/code/CourseErrorCode.java

📝 Walkthrough

Walkthrough

The change adds tourism magazine and bookmark APIs, tourism API integration, and authenticated course-place addition and reordering. It also replaces legacy course DTOs and updates persistence, security, configuration, and tests.

Changes

Course APIs

Layer / File(s) Summary
Course request and response contracts
src/main/java/com/daytodo/domain/course/dto/*, src/main/java/com/daytodo/domain/course/exception/code/CourseErrorCode.java
Dedicated request and response DTOs replace the legacy course DTO. The response adds ordered course places and validation errors.
Course-place append and reorder flow
src/main/java/com/daytodo/domain/course/service/*, src/main/java/com/daytodo/domain/course/entity/CoursePlace.java, src/main/java/com/daytodo/domain/course/converter/*
The services append course places, validate reorder requests, update order values, and return ordered place responses.
Authenticated course endpoints and tests
src/main/java/com/daytodo/domain/course/controller/TodayCourseController.java, src/main/java/com/daytodo/global/config/SecurityConfig.java, src/test/java/com/daytodo/domain/course/*
Course endpoints use @AuthenticationPrincipal, expose place-management routes, and update test wiring.

Place APIs

Layer / File(s) Summary
Tour API integration and configuration
src/main/java/com/daytodo/domain/place/infra/*, src/main/java/com/daytodo/global/config/*, src/main/resources/application.yml, .env.example, src/main/java/com/daytodo/domain/region/*
The application configures KorService2 access, typed responses, REST timeouts, and tourism region codes.
Magazine persistence and response mapping
src/main/java/com/daytodo/domain/place/entity/*, src/main/java/com/daytodo/domain/place/enums/*, src/main/java/com/daytodo/domain/place/repository/MagazineRepository.java, src/main/java/com/daytodo/domain/place/dto/response/MagazineResDTO.java, src/main/java/com/daytodo/domain/place/converter/MagazineConverter.java
Magazine records, visibility states, repositories, and converters support list, detail, and photo responses.
Magazine retrieval and bookmark lifecycle
src/main/java/com/daytodo/domain/place/service/*, src/main/java/com/daytodo/domain/place/repository/*, src/main/java/com/daytodo/domain/place/dto/*, src/main/java/com/daytodo/domain/place/exception/code/PlaceErrorCode.java, src/main/java/com/daytodo/domain/user/repository/WithdrawnUserCleanupRepository.java
Magazine retrieval resolves regions and advertisement flags. Bookmark operations create tourism-backed places, prevent duplicates, enforce ownership, and return operation results.
Place controller endpoints
src/main/java/com/daytodo/domain/place/controller/PlaceController.java
The controller adds magazine and bookmark endpoints and uses authenticated principals.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant PlaceController
  participant MagazineService
  participant TourApiClient
  participant PlaceBookmarkService
  participant BookmarkPlaceRepository
  Client->>PlaceController: request magazine or bookmark operation
  PlaceController->>MagazineService: retrieve magazine data
  MagazineService->>TourApiClient: query tourism API
  TourApiClient-->>MagazineService: return typed tourism data
  PlaceController->>PlaceBookmarkService: create or delete bookmark
  PlaceBookmarkService->>BookmarkPlaceRepository: validate ownership or persist bookmark
  BookmarkPlaceRepository-->>PlaceBookmarkService: return bookmark state
  PlaceBookmarkService-->>Client: return operation response
Loading

Possibly related PRs

  • DayTodo/DayTodo_BE#5: Introduced the CoursePlace entity extended by the course-place ordering changes.
  • DayTodo/DayTodo_BE#23: Shares the place bookmark controller, DTO, entity, service, and repository areas.
  • DayTodo/DayTodo_BE#30: Shares the migration from X-User-Id to @AuthenticationPrincipal for course APIs.

Suggested reviewers: kwonwnsduf

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 implementation of the magazine and Today Course second-phase APIs.
Linked Issues check ✅ Passed The changes implement all listed magazine, bookmark, and course-place APIs required by issue #36.
Out of Scope Changes check ✅ Passed The changes support the stated API implementation, authentication migration, documentation, cleanup, configuration, and test updates.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 36/feature/place-course

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.

@yxpjseo
yxpjseo force-pushed the 36/feature/place-course branch from 5969e32 to 3fa3bd4 Compare August 3, 2026 08:44

@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: 12

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/daytodo/domain/region/entity/Region.java (1)

29-40: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Populate KorService2 region codes before relying on them.

Region exposes areaCode and sigunguCode, but the constructor leaves them unset and no code populates existing rows. In production with ddl-auto: update, MagazineService.resolveInterestRegion filters out interest regions because their regions lack non-null codes, so magazine listings use the nationwide query. PlaceBookmarkService.resolveRegion also fails to match bookmarked tourism places against RegionRepository.findFirstByAreaCodeAndSigunguCode. Add a migration or seed step for existing regions and set these fields on new Region creation.

🤖 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/daytodo/domain/region/entity/Region.java` around lines 29 -
40, Populate areaCode and sigunguCode for existing Region records through a
migration or seed step, and update the Region constructor to assign these values
when creating new regions. Ensure the values match KorService2 mappings so
MagazineService.resolveInterestRegion and PlaceBookmarkService.resolveRegion can
use non-null codes.
🧹 Nitpick comments (4)
src/main/java/com/daytodo/domain/place/service/PlaceBookmarkService.java (1)

141-150: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Log when coordinate parsing falls back to (0.0, 0.0).

parseCoordinate returns 0.0 when mapx/mapy is null, blank, or unparsable. Latitude and longitude 0.0 point to a real location, not to a "missing data" marker. A place created with a missing or malformed coordinate from the tourism API silently gets a valid-looking but wrong position. Add a log statement when parsing fails, so bad upstream data is visible in operational logs instead of only appearing as a misplaced marker later.

🤖 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/daytodo/domain/place/service/PlaceBookmarkService.java`
around lines 141 - 150, Update PlaceBookmarkService.parseCoordinate to log when
the input is null, blank, or causes NumberFormatException before returning the
0.0 fallback. Include the supplied value and enough context to identify
coordinate parsing failures, while preserving the existing successful parsing
and fallback behavior.
src/main/java/com/daytodo/global/config/RestClientConfig.java (1)

13-13: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Mark the RestClient beans with @Qualifier to make injection explicit.

Two RestClient beans now exist. TourApiClient injects RestClient tourRestClient through a Lombok-generated constructor, so resolution depends on the parameter name matching the bean name. That match requires compilation with -parameters. Add @Qualifier("tourRestClient") at the injection point, or annotate the beans, so injection does not depend on parameter-name retention.

Also applies to: 23-23

🤖 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/daytodo/global/config/RestClientConfig.java` at line 13,
Add explicit `@Qualifier` annotations for both RestClient beans in
RestClientConfig, using their bean names such as “naverRestClient” and
“tourRestClient”, and ensure TourApiClient’s RestClient injection point
explicitly uses `@Qualifier`("tourRestClient"). Do not rely on constructor
parameter names or -parameters for bean resolution.
src/main/java/com/daytodo/domain/place/service/MagazineService.java (1)

1-140: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add unit tests for MagazineService's branch logic.

Cover resolveInterestRegion with multiple interest regions where only a non-first one has an area code, and cover fetchOverview with a simulated external failure other than ProjectException. These paths hide the two issues raised above.

🤖 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/daytodo/domain/place/service/MagazineService.java` around
lines 1 - 140, Add unit tests for MagazineService covering resolveInterestRegion
with multiple interest regions where only a later region has an area code, and
fetchOverview when tourApiClient.detailCommon throws a non-ProjectException
failure. Assert the expected region selection and overview fallback behavior,
using mocks for the repositories and TourApiClient.
src/test/java/com/daytodo/domain/course/controller/TodayCourseControllerTest.java (1)

36-62: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add test coverage for the new place-management endpoints.

This file has tests for getTodayCourse and saveMemoryPhotos, but no tests for the new POST /courses/{courseId}/today-places (addPlaceToCourse) or PATCH /courses/{courseId}/today-places/order (reorderCoursePlaces) endpoints added in this cohort. Add WebMvc tests covering at least the success path and the MISSING_PLACE_ID/INVALID_PLACE_ORDER/COURSE_PLACE_NOT_FOUND error mappings, mirroring the existing emptyImageUrls test pattern.

🤖 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/test/java/com/daytodo/domain/course/controller/TodayCourseControllerTest.java`
around lines 36 - 62, Extend TodayCourseControllerTest with WebMvc tests for
addPlaceToCourse and reorderCoursePlaces, covering successful responses and
exception mappings for MISSING_PLACE_ID, INVALID_PLACE_ORDER, and
COURSE_PLACE_NOT_FOUND. Mirror the existing emptyImageUrls setup with mocked
service calls, endpoint requests, and assertions for HTTP status, error code,
and message; use the controller’s request payloads and response contracts.
🤖 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/daytodo/domain/course/service/CourseService.java`:
- Around line 529-544: Prevent concurrent place_order updates by locking the
course row before any read-modify-write operations: in
src/main/java/com/daytodo/domain/course/service/CourseService.java lines
529-544, update appendPlaceToCourse to call
courseRepository.findByIdForUpdate(course.getCourseId()) before the duplicate
check and maximum-order lookup; in
src/main/java/com/daytodo/domain/course/service/TodayCourseService.java lines
158-199, call courseRepository.findByIdForUpdate(courseId) before loading and
reassigning placeOrder.

In `@src/main/java/com/daytodo/domain/place/dto/request/PlaceReqDTO.java`:
- Around line 16-20: The CreateBookmark request field currently mislabels the
tourism content ID as placeId. Rename CreateBookmark.placeId to contentId,
update its validation/accessors and all request-handling references to use
contentId, while preserving the response DTO’s internal Place identifier.

In `@src/main/java/com/daytodo/domain/place/dto/response/PlaceResDTO.java`:
- Around line 24-29: Rename the response record field CreateBookmark.placeId to
distinguish the internal Place primary key from the request’s KorService2
contentId, and update its builder/accessor usages consistently. Preserve the
value sourced from place.getPlaceId() while aligning the response naming with
the request/response domain terminology.

In `@src/main/java/com/daytodo/domain/place/infra/TourApiClient.java`:
- Around line 81-91: Update TourApiClient.call to reject both a null response
body and a non-success KorService2 resultCode before returning the response. Use
the existing TourApiResponse/Header symbols to validate the result code, and
throw ProjectException with PlaceErrorCode.TOUR_API_ERROR for either failure
while preserving the existing RestClientException handling and logging.
- Around line 98-107: Update the URI construction in buildUri so the
request-supplied contentId is encoded or validated as an allowed content ID
before it reaches the builder, while preserving the existing query parameters
and call flow. Avoid treating unencoded client values as pre-encoded when
invoking builder.build(true), or reject invalid contentId values before URI
creation so reserved characters cannot alter the query or trigger an uncaught
IllegalArgumentException.

In `@src/main/java/com/daytodo/domain/place/service/MagazineService.java`:
- Around line 33-63: Update getMagazineList so the per-item fetchOverview calls
no longer run sequentially inside the stream; dispatch them concurrently using
CompletableFuture with a bounded executor, gather each result before
constructing MagazineItem values, and preserve item ordering and ad sorting.
Keep fetchOverview’s per-item failure isolation so one failed detailCommon call
does not fail the entire list response.
- Around line 89-101: Update resolveInterestRegion to preserve interest-region
priority: index the findAllByRegionIdIn(regionIds) results by region ID, then
iterate the already ordered regionIds and return the first mapped Region with a
non-null areaCode. Keep returning null when no ordered region has a valid area
code.

In `@src/main/java/com/daytodo/domain/place/service/PlaceBookmarkService.java`:
- Around line 58-76: Update createBookmark to handle
DataIntegrityViolationException from both the lazy Place upsert and
BookmarkPlace insertion: after a place insert conflict, retrieve the existing
Place by tour content ID, and after a bookmark insert conflict, raise the
existing DUPLICATE_BOOKMARK business error. Preserve the normal lookup,
duplicate pre-check, and successful response paths while ensuring concurrent
requests receive controlled outcomes.

In `@src/main/java/com/daytodo/domain/region/repository/RegionRepository.java`:
- Around line 15-16: Update PlaceBookmarkService.resolveRegion before calling
RegionRepository.findFirstByAreaCodeAndSigunguCode so a null sigunguCode returns
Optional.empty() instead of executing the derived query; retain the existing
lookup for non-null values. Also ensure the repository lookup has deterministic
ordering when multiple regions share the codes, using the established ordering
field or query mechanism.

In `@src/main/java/com/daytodo/global/config/RestClientConfig.java`:
- Around line 20-27: The tourRestClient bean currently relies on default request
timeouts. Update tourRestClient in RestClientConfig to build and configure a
RestClient request factory using the Spring Boot 4 timeout settings, applying
both connect and read timeouts while preserving the existing baseUrl
configuration used by TourApiClient, MagazineService, and PlaceBookmarkService.

In `@src/main/resources/application.yml`:
- Around line 5-8: Remove the global
jackson.deserialization.accept-empty-string-as-null-object setting from
application.yml. Configure a dedicated JsonMapper and
JacksonJsonHttpMessageConverter for the KorService2 REST client or flow,
enabling empty-string-as-null-object only there while leaving the
application-wide Jackson mapper unchanged.

---

Outside diff comments:
In `@src/main/java/com/daytodo/domain/region/entity/Region.java`:
- Around line 29-40: Populate areaCode and sigunguCode for existing Region
records through a migration or seed step, and update the Region constructor to
assign these values when creating new regions. Ensure the values match
KorService2 mappings so MagazineService.resolveInterestRegion and
PlaceBookmarkService.resolveRegion can use non-null codes.

---

Nitpick comments:
In `@src/main/java/com/daytodo/domain/place/service/MagazineService.java`:
- Around line 1-140: Add unit tests for MagazineService covering
resolveInterestRegion with multiple interest regions where only a later region
has an area code, and fetchOverview when tourApiClient.detailCommon throws a
non-ProjectException failure. Assert the expected region selection and overview
fallback behavior, using mocks for the repositories and TourApiClient.

In `@src/main/java/com/daytodo/domain/place/service/PlaceBookmarkService.java`:
- Around line 141-150: Update PlaceBookmarkService.parseCoordinate to log when
the input is null, blank, or causes NumberFormatException before returning the
0.0 fallback. Include the supplied value and enough context to identify
coordinate parsing failures, while preserving the existing successful parsing
and fallback behavior.

In `@src/main/java/com/daytodo/global/config/RestClientConfig.java`:
- Line 13: Add explicit `@Qualifier` annotations for both RestClient beans in
RestClientConfig, using their bean names such as “naverRestClient” and
“tourRestClient”, and ensure TourApiClient’s RestClient injection point
explicitly uses `@Qualifier`("tourRestClient"). Do not rely on constructor
parameter names or -parameters for bean resolution.

In
`@src/test/java/com/daytodo/domain/course/controller/TodayCourseControllerTest.java`:
- Around line 36-62: Extend TodayCourseControllerTest with WebMvc tests for
addPlaceToCourse and reorderCoursePlaces, covering successful responses and
exception mappings for MISSING_PLACE_ID, INVALID_PLACE_ORDER, and
COURSE_PLACE_NOT_FOUND. Mirror the existing emptyImageUrls setup with mocked
service calls, endpoint requests, and assertions for HTTP status, error code,
and message; use the controller’s request payloads and response contracts.
🪄 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: 9567706e-48ec-41b2-a6ee-47fccc6958ff

📥 Commits

Reviewing files that changed from the base of the PR and between a73b152 and 5969e32.

📒 Files selected for processing (36)
  • .env.example
  • src/main/java/com/daytodo/domain/course/controller/TodayCourseController.java
  • src/main/java/com/daytodo/domain/course/converter/MemoryPhotoConverter.java
  • src/main/java/com/daytodo/domain/course/converter/TodayCourseConverter.java
  • src/main/java/com/daytodo/domain/course/dto/request/CourseReqDTO.java
  • src/main/java/com/daytodo/domain/course/dto/request/TodayCourseRequest.java
  • src/main/java/com/daytodo/domain/course/dto/response/TodayCourseResponse.java
  • src/main/java/com/daytodo/domain/course/entity/CoursePlace.java
  • src/main/java/com/daytodo/domain/course/exception/code/CourseErrorCode.java
  • src/main/java/com/daytodo/domain/course/service/CourseService.java
  • src/main/java/com/daytodo/domain/course/service/TodayCourseService.java
  • src/main/java/com/daytodo/domain/place/controller/PlaceController.java
  • src/main/java/com/daytodo/domain/place/converter/MagazineConverter.java
  • src/main/java/com/daytodo/domain/place/dto/request/PlaceReqDTO.java
  • src/main/java/com/daytodo/domain/place/dto/response/MagazineResDTO.java
  • src/main/java/com/daytodo/domain/place/dto/response/PlaceResDTO.java
  • src/main/java/com/daytodo/domain/place/entity/Magazine.java
  • src/main/java/com/daytodo/domain/place/entity/Place.java
  • src/main/java/com/daytodo/domain/place/enums/MagazineStatus.java
  • src/main/java/com/daytodo/domain/place/exception/code/PlaceErrorCode.java
  • src/main/java/com/daytodo/domain/place/infra/TourApiClient.java
  • src/main/java/com/daytodo/domain/place/infra/TourApiResponse.java
  • src/main/java/com/daytodo/domain/place/repository/BookmarkPlaceRepository.java
  • src/main/java/com/daytodo/domain/place/repository/MagazineRepository.java
  • src/main/java/com/daytodo/domain/place/repository/PlaceRepository.java
  • src/main/java/com/daytodo/domain/place/service/MagazineService.java
  • src/main/java/com/daytodo/domain/place/service/PlaceBookmarkService.java
  • src/main/java/com/daytodo/domain/region/entity/Region.java
  • src/main/java/com/daytodo/domain/region/repository/RegionRepository.java
  • src/main/java/com/daytodo/domain/user/repository/WithdrawnUserCleanupRepository.java
  • src/main/java/com/daytodo/global/config/RestClientConfig.java
  • src/main/java/com/daytodo/global/config/SecurityConfig.java
  • src/main/java/com/daytodo/global/config/TourApiProperties.java
  • src/main/resources/application.yml
  • src/test/java/com/daytodo/domain/course/controller/TodayCourseControllerTest.java
  • src/test/java/com/daytodo/domain/course/service/CourseServiceTest.java
💤 Files with no reviewable changes (1)
  • src/main/java/com/daytodo/domain/course/dto/request/CourseReqDTO.java

Comment thread src/main/java/com/daytodo/domain/course/service/CourseService.java
Comment thread src/main/java/com/daytodo/domain/place/dto/request/PlaceReqDTO.java Outdated
Comment thread src/main/java/com/daytodo/domain/place/dto/response/PlaceResDTO.java Outdated
Comment thread src/main/java/com/daytodo/domain/place/infra/TourApiClient.java
Comment thread src/main/java/com/daytodo/domain/place/infra/TourApiClient.java
Comment thread src/main/java/com/daytodo/global/config/RestClientConfig.java
Comment thread src/main/resources/application.yml

@kwonwnsduf kwonwnsduf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

appendPlaceToCourse()는 현재 placeOrder의 최대값을 조회한 뒤 +1을 해서 저장하고 있습니다. 동시에 여러 요청이 들어오면 동일한 placeOrder가 할당될 수 있습니다.
saveMemoryPhotos()에서 사용한 것처럼 Course를 FOR UPDATE로 조회한 뒤 placeOrder를 계산하도록 변경하는 것이 안전해 보입니다.
2.
현재는 존재 여부를 확인한 뒤 insert하는(check-then-insert) 구조입니다.
동시에 동일한 요청이 들어오면 Place 생성이나 Bookmark 생성 시 Unique Constraint 예외가 발생할 수 있으므로 DataIntegrityViolationException을 처리해 Place는 재조회하고, Bookmark는 DUPLICATE_BOOKMARK로 변환하는 처리가 필요해 보입니다.
3.
CreateBookmark의 placeId는 실제로는 내부 Place PK가 아니라 KorService2의 contentId를 의미합니다.
placeId라는 이름은 혼동의 여지가 있으므로 contentId로 변경하는 것이 API 의미를 더 명확하게 전달할 수 있을 것 같습니다.
4.
요청에서는 관광 콘텐츠의 contentId를 받고, 응답에서는 내부 Place PK를 반환하고 있는데 둘 다 placeId라는 이름을 사용하고 있습니다.
요청과 응답의 의미가 다르므로 필드명을 구분하는 것이 API 사용 시 혼동을 줄일 수 있을 것 같습니다.
5.
body()는 응답 본문이 없으면 null을 반환할 수 있는데 현재는 이에 대한 처리가 없습니다.
또한 KorService2는 HTTP 200이어도 resultCode가 0000이 아닌 경우가 있으므로 응답 body의 null 여부와 resultCode를 함께 검증하는 것이 필요해 보입니다.
6.
build(true)는 모든 쿼리 파라미터가 이미 인코딩되어 있다고 가정합니다.
contentId는 외부 입력값이므로 적절한 인코딩 또는 값 검증을 수행한 뒤 URI를 생성하는 것이 안전해 보입니다.
7.
현재 RestClient는 timeout 설정 없이 기본값을 사용하고 있습니다.
외부 API 응답이 지연될 경우 요청 스레드가 장시간 점유될 수 있으므로 connect timeout과 read timeout을 명시적으로 설정하는 것을 고려해 주시면 감사하겠습니다!
한 번 참고해주세요!

@yxpjseo
yxpjseo requested a review from kwonwnsduf August 4, 2026 08:22

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/daytodo/domain/course/exception/code/CourseErrorCode.java (1)

40-47: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Fix the enum declaration syntax before merging.

The last enum constant before COURSE_RECOMMENDATION_FAILED still ends with ;. Replace it with , unless it is explicitly the final constant, then run the project compile check.

🤖 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/daytodo/domain/course/exception/code/CourseErrorCode.java`
around lines 40 - 47, Fix the enum declaration in CourseErrorCode by replacing
the semicolon after COURSE_PLACE_NOT_FOUND with a comma so
COURSE_RECOMMENDATION_FAILED remains part of the enum constants, then run the
project compile check.

Source: Linters/SAST tools

🧹 Nitpick comments (1)
src/test/java/com/daytodo/domain/course/service/CourseServiceTest.java (1)

28-31: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consolidate the duplicate repository imports.

CourseServiceTest.java imports PlaceRecommendationRepository, RecommendationLikeRepository, PlaceRepository, and RecommendationCommentRepository twice. Remove one set of these declarations to avoid redundant imports.

🤖 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/test/java/com/daytodo/domain/course/service/CourseServiceTest.java`
around lines 28 - 31, Remove the duplicate imports for
PlaceRecommendationRepository, RecommendationLikeRepository, PlaceRepository,
and RecommendationCommentRepository in CourseServiceTest, retaining exactly one
declaration of each.
🤖 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.

Outside diff comments:
In `@src/main/java/com/daytodo/domain/course/exception/code/CourseErrorCode.java`:
- Around line 40-47: Fix the enum declaration in CourseErrorCode by replacing
the semicolon after COURSE_PLACE_NOT_FOUND with a comma so
COURSE_RECOMMENDATION_FAILED remains part of the enum constants, then run the
project compile check.

---

Nitpick comments:
In `@src/test/java/com/daytodo/domain/course/service/CourseServiceTest.java`:
- Around line 28-31: Remove the duplicate imports for
PlaceRecommendationRepository, RecommendationLikeRepository, PlaceRepository,
and RecommendationCommentRepository in CourseServiceTest, retaining exactly one
declaration of each.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 113002dd-9786-4953-9bb8-24cdbc56875d

📥 Commits

Reviewing files that changed from the base of the PR and between 6229a8d and 2c76d9a.

📒 Files selected for processing (4)
  • src/main/java/com/daytodo/domain/course/exception/code/CourseErrorCode.java
  • src/main/java/com/daytodo/domain/place/entity/Place.java
  • src/main/java/com/daytodo/domain/place/repository/PlaceRepository.java
  • src/test/java/com/daytodo/domain/course/service/CourseServiceTest.java
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/java/com/daytodo/domain/place/entity/Place.java
  • src/main/java/com/daytodo/domain/place/repository/PlaceRepository.java

@kwonwnsduf kwonwnsduf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

수고하셨습니다!!

@yxpjseo
yxpjseo merged commit 3638ded into develop Aug 6, 2026
1 check passed
@yxpjseo
yxpjseo deleted the 36/feature/place-course branch August 6, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feature 새로운 기능을 추가하는 작업

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] place, course 도메인 2차 api 구현

2 participants