Skip to content

[Feat] 등산 기록 응답에 트래킹 세션 ID를 추가#146

Merged
pooreumjung merged 3 commits into
developfrom
feat/#145-hiking-record-session-id
May 28, 2026
Merged

[Feat] 등산 기록 응답에 트래킹 세션 ID를 추가#146
pooreumjung merged 3 commits into
developfrom
feat/#145-hiking-record-session-id

Conversation

@pooreumjung

Copy link
Copy Markdown
Member

🧾 요약

  • 등산 기록 응답에 트래킹 세션 ID를 추가해, 트래킹 사진 조회 API와 바로 연결할 수 있도록 함

🔗 이슈

✨ 변경 내용

  • GetUserHikingRecordResponsesessionId 필드 추가
  • UserHikingRecordProjectionsessionId 조회 필드 추가
  • 등산 기록 목록 조회 쿼리 2곳에 hr.tracking_session_id AS sessionId 반영
  • DTO 변환 로직에서 sessionId 매핑 추가
  • GetUserHikingRecordResponse 매핑 테스트 추가

✅ 확인

  • 빌드 OK
  • 테스트 OK

@pooreumjung pooreumjung self-assigned this May 28, 2026
@pooreumjung pooreumjung added the enhancement New feature or request label May 28, 2026
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a72c8bd-78ef-4d45-a766-dff70e353c55

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#145-hiking-record-session-id

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

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

본 PR은 등산 기록 응답 데이터에 트래킹 세션 ID를 포함시켜, 클라이언트가 등산 기록에서 바로 관련 트래킹 사진 조회 API로 연결할 수 있도록 기능을 개선하였습니다. 이를 위해 데이터베이스 쿼리, DTO 매핑 로직, 그리고 관련 테스트 코드를 업데이트하였습니다.

Highlights

  • API 응답 필드 추가: 등산 기록 조회 응답(GetUserHikingRecordResponse)에 트래킹 세션 ID(sessionId)를 추가하여 트래킹 사진 조회 API와의 연동성을 강화했습니다.
  • 데이터베이스 쿼리 업데이트: HikingRecordRepository의 등산 기록 목록 조회 쿼리에 tracking_session_id를 포함하도록 수정했습니다.
  • 테스트 코드 추가: 새로 추가된 sessionId 필드가 DTO 변환 시 올바르게 매핑되는지 검증하기 위한 단위 테스트를 작성했습니다.
  • 유틸리티 개선: DemoService에 음수 입력값에 대해 안전하게 동작하는 safeRandomPhotoCount 메서드를 추가했습니다.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@pooreumjung
pooreumjung merged commit e6245c8 into develop May 28, 2026
3 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

이번 PR은 데모 서비스에서 음수 count 요청 시 발생할 수 있는 인덱스 초과 오류를 방지하는 안전장치를 추가하고, 사용자 하이킹 기록 조회 시 세션 ID(sessionId)를 함께 반환하도록 DTO, Repository, Projection을 수정하며 관련 테스트 코드를 추가했습니다. 리뷰에서는 테스트 코드에서 인터페이스 기반 Projection을 모킹할 때 익명 클래스를 직접 구현하는 대신 Spring Data의 SpelAwareProxyProjectionFactory를 사용하여 보일러플레이트 코드를 줄이고 가독성을 높일 것을 제안했습니다.

Comment on lines +22 to +79
private UserHikingRecordProjection projection() {
return new UserHikingRecordProjection() {
@Override
public Long getHikingRecordId() {
return 1L;
}

@Override
public Long getSessionId() {
return 10L;
}

@Override
public Long getMountainId() {
return 2L;
}

@Override
public String getMountainName() {
return "관악산";
}

@Override
public Long getCourseId() {
return 3L;
}

@Override
public String getCourseName() {
return "연주대 코스";
}

@Override
public String getPhotoReportImageUrl() {
return "photo-report";
}

@Override
public String getCliveImageUrl() {
return "clive";
}

@Override
public Double getDistance() {
return 6200.0;
}

@Override
public Integer getDuration() {
return 3600;
}

@Override
public LocalDateTime getHikedAt() {
return LocalDateTime.of(2026, 5, 28, 10, 0);
}
};
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

테스트에서 인터페이스 기반의 Projection을 모킹하기 위해 익명 클래스를 직접 구현하는 방식은 코드가 매우 길어지고 유지보수하기 어렵습니다.

Spring Data에서 제공하는 SpelAwareProxyProjectionFactory를 사용하면 Map을 기반으로 Projection 프록시 객체를 간단하게 생성할 수 있습니다. 이를 통해 보일러플레이트 코드를 크게 줄이고 테스트 코드의 가독성을 높일 수 있습니다.

    private UserHikingRecordProjection projection() {
        org.springframework.data.projection.ProjectionFactory factory = new org.springframework.data.projection.SpelAwareProxyProjectionFactory();
        return factory.createProjection(UserHikingRecordProjection.class, java.util.Map.ofEntries(
                java.util.Map.entry("hikingRecordId", 1L),
                java.util.Map.entry("sessionId", 10L),
                java.util.Map.entry("mountainId", 2L),
                java.util.Map.entry("mountainName", "관악산"),
                java.util.Map.entry("courseId", 3L),
                java.util.Map.entry("courseName", "연주대 코스"),
                java.util.Map.entry("photoReportImageUrl", "photo-report"),
                java.util.Map.entry("cliveImageUrl", "clive"),
                java.util.Map.entry("distance", 6200.0),
                java.util.Map.entry("duration", 3600),
                java.util.Map.entry("hikedAt", LocalDateTime.of(2026, 5, 28, 10, 0))
        ));
    }

@howooyeon
howooyeon deleted the feat/#145-hiking-record-session-id branch June 3, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 등산 기록 응답에 트래킹 세션 ID를 추가

1 participant