Skip to content

[FEAT] 모임 위도와 경도 추가#219

Merged
LimdaeIl merged 1 commit intomainfrom
feat/map
Feb 1, 2026
Merged

[FEAT] 모임 위도와 경도 추가#219
LimdaeIl merged 1 commit intomainfrom
feat/map

Conversation

@LimdaeIl
Copy link
Collaborator

@LimdaeIl LimdaeIl commented Feb 1, 2026

📝 Pull Request

📌 PR 종류

해당하는 항목에 체크해주세요.

  • 기능 추가 (Feature)
  • 버그 수정 (Fix)
  • 문서 수정 (Docs)
  • 코드 리팩터링 (Refactor)
  • 테스트 추가 (Test)
  • 기타 변경 (Chore)

✨ 변경 내용

  • 모임 생성

  • 모임 수정

  • 모임 상세 조회 시, 위도와 경도 응답

여기에 추가 합니다. 모임 엔티티에 위도 경도 컬럼을 추가했습니다.

🔍 관련 이슈

🧪 테스트

변경된 기능에 대한 테스트 범위 또는 테스트 결과를 작성해주세요.

  • 유닛 테스트 추가 / 수정
  • 통합 테스트 검증
  • 수동 테스트 완료

🚨 확인해야 할 사항 (Checklist)

PR을 제출하기 전에 아래 항목들을 확인해주세요.

  • 코드 포매팅 완료
  • 불필요한 파일/코드 제거
  • 로직 검증 완료
  • 프로젝트 빌드 성공
  • 린트/정적 분석 통과 (해당 시)

🙋 기타 참고 사항

리뷰어가 참고하면 좋을 만한 추가 설명이 있다면 적어주세요.

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 그룹 생성 및 수정 시 지리적 좌표(위도/경도) 입력 지원 추가
  • 버그 수정

    • 위치 좌표 유효성 검증 강화 (위도: -9090, 경도: -180180 범위 확인)

✏️ Tip: You can customize this high-level summary in your review settings.

- 모임 생성
- 모임 수정

- 모임 상세 조회 시, 위도와 경도 응답

여기에 추가 합니다.
@LimdaeIl LimdaeIl self-assigned this Feb 1, 2026
Copilot AI review requested due to automatic review settings February 1, 2026 06:48
@LimdaeIl LimdaeIl added the ✨enhancement New feature or request label Feb 1, 2026
@LimdaeIl LimdaeIl moved this from Backlog to In progress in WeGo-Together Backend Feb 1, 2026
@LimdaeIl LimdaeIl merged commit ef9f446 into main Feb 1, 2026
4 of 5 checks passed
@LimdaeIl LimdaeIl deleted the feat/map branch February 1, 2026 06:48
@github-project-automation github-project-automation bot moved this from In progress to Done in WeGo-Together Backend Feb 1, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 1, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

이 PR은 그룹 주소 엔티티와 관련 DTO에 위도/경도 필드를 추가하고, 위치 검증을 위한 오류 코드를 확장하며, 서비스 클래스의 포맷팅을 개선합니다.

Changes

Cohort / File(s) Summary
위치 검증 오류 코드
src/main/java/team/wego/wegobackend/group/domain/exception/GroupErrorCode.java
위치 좌표 검증을 위한 세 개의 새 enum 상수 추가: LOCATION_COORDINATES_INVALID, LOCATION_LATITUDE_OUT_OF_RANGE, LOCATION_LONGITUDE_OUT_OF_RANGE
V2 주소 DTO
src/main/java/team/wego/wegobackend/group/v2/application/dto/common/Address.java
latitude와 longitude 필드를 Address 레코드에 추가하고 from() 팩토리 메서드 업데이트
V2 요청 DTO
src/main/java/team/wego/wegobackend/group/v2/application/dto/request/CreateGroupV2Request.java, src/main/java/team/wego/wegobackend/group/v2/application/dto/request/UpdateGroupV2Request.java
CreateGroupV2Request와 UpdateGroupV2Request에 latitude, longitude 선택 필드 추가
V2 도메인 엔티티
src/main/java/team/wego/wegobackend/group/v2/domain/entity/GroupV2Address.java
latitude와 longitude 필드 추가, 데이터베이스 컬럼 매핑 추가, [-90, 90] 범위 위도 및 [-180, 180] 범위 경도 검증 로직 구현, of() 팩토리 메서드 시그니처 업데이트
V2 서비스 레이어
src/main/java/team/wego/wegobackend/group/v2/application/service/GroupV2Service.java, src/main/java/team/wego/wegobackend/group/v2/application/service/GroupV2UpdateService.java
GroupV2Address.of() 호출을 네 개의 매개변수(location, locationDetail, latitude, longitude)로 업데이트하고, UpdateService에서 부분 업데이트 로직 구현
서비스 포맷팅 및 정리
src/main/java/team/wego/wegobackend/group/v2/application/service/GroupV2AttendanceService.java, src/main/java/team/wego/wegobackend/group/v2/infrastructure/redis/PreUploadedGroupImageRedisRepository.java, src/main/java/team/wego/wegobackend/group/v2/application/service/PreUploadedGroupImageOrphanGcWorker.java
orElseThrow() 블록을 한 줄 람다식으로 축소, null 체크 포맷팅 정리, 주석 수정
GroupService 주석
src/main/java/team/wego/wegobackend/group/application/service/v1/GroupService.java
attendGroup 메서드에 인라인 주석 추가 (기능 변화 없음)
HTTP 테스트 파일
src/test/http/group/v2/v2-group-create.http, src/test/http/group/v2/v2-group-get.http
V2 그룹 생성 요청 페이로드에 latitude, longitude 필드 추가

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 좌표가 추가되고 지도 위에 춤을 춘다네,
위도와 경도로 모임의 위치가 반짝반짝,
북쪽에서 남쪽까지, 동쪽에서 서쪽까지,
우리의 그룹들이 지도 위에 자리 잡았네! 🗺️✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/map

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 and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds latitude and longitude support to the Group V2 entity to enable map-based features for groups. The changes introduce optional coordinate fields that can be provided during group creation and modification, with validation to ensure both coordinates are provided together and fall within valid geographic ranges.

Changes:

  • Added latitude and longitude fields to GroupV2Address entity with validation for coordinate ranges (-90 to 90 for latitude, -180 to 180 for longitude)
  • Updated group creation and update DTOs and service methods to handle coordinate data
  • Added three new error codes for coordinate validation failures
  • Included unrelated code formatting changes and comment updates

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/main/java/team/wego/wegobackend/group/v2/domain/entity/GroupV2Address.java Added latitude/longitude fields with validation logic ensuring both are present or both are null, and coordinates are within valid ranges
src/main/java/team/wego/wegobackend/group/v2/application/dto/request/CreateGroupV2Request.java Added optional latitude and longitude fields to group creation request
src/main/java/team/wego/wegobackend/group/v2/application/dto/request/UpdateGroupV2Request.java Added optional latitude and longitude fields to group update request
src/main/java/team/wego/wegobackend/group/v2/application/dto/common/Address.java Added latitude and longitude to the Address response DTO
src/main/java/team/wego/wegobackend/group/v2/application/service/GroupV2Service.java Updated group creation to pass latitude and longitude to entity
src/main/java/team/wego/wegobackend/group/v2/application/service/GroupV2UpdateService.java Updated group modification logic to handle coordinate updates
src/main/java/team/wego/wegobackend/group/domain/exception/GroupErrorCode.java Added three new error codes for coordinate validation
src/test/http/group/v2/v2-group-create.http Updated test request with sample coordinates
src/test/http/group/v2/v2-group-get.http Updated expected response to include coordinates
src/main/java/team/wego/wegobackend/group/v2/application/service/GroupV2AttendanceService.java Code formatting changes (single-line orElseThrow calls)
src/main/java/team/wego/wegobackend/group/v2/infrastructure/redis/PreUploadedGroupImageRedisRepository.java Code formatting changes (single-line if statement)
src/main/java/team/wego/wegobackend/group/v2/application/service/PreUploadedGroupImageOrphanGcWorker.java Minor comment wording change
src/main/java/team/wego/wegobackend/group/application/service/v1/GroupService.java Added algorithm step comments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +150 to +154
Double newLat = (request.latitude() != null || request.longitude() != null)
? request.latitude()
: cur.getLatitude();

Double newLng = (request.latitude() != null || request.longitude() != null)
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The update logic for latitude and longitude is incorrect. The condition (request.latitude() != null || request.longitude() != null) on lines 150 and 154 is used to determine whether to update coordinates, but this causes a bug:

If a user wants to update ONLY latitude (sending latitude=37.5 and longitude=null), the condition becomes true and newLat gets the new value (37.5), but newLng gets request.longitude() which is null, not the current value.

The logic should be:

  • newLat should use request.latitude() if it's not null, otherwise cur.getLatitude()
  • newLng should use request.longitude() if it's not null, otherwise cur.getLongitude()

Lines 150-156 should be:

Double newLat = (request.latitude() != null)
        ? request.latitude()
        : cur.getLatitude();

Double newLng = (request.longitude() != null)
        ? request.longitude()
        : cur.getLongitude();

This matches the pattern used for location and locationDetail on lines 142-148.

Suggested change
Double newLat = (request.latitude() != null || request.longitude() != null)
? request.latitude()
: cur.getLatitude();
Double newLng = (request.latitude() != null || request.longitude() != null)
Double newLat = (request.latitude() != null)
? request.latitude()
: cur.getLatitude();
Double newLng = (request.longitude() != null)

Copilot uses AI. Check for mistakes.
}

this.location = location.trim();
this.locationDetail = locationDetail;
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

On line 49, the location field is trimmed before assignment, but locationDetail is not trimmed on line 50. For consistency and to prevent potential whitespace-only values, consider also trimming locationDetail if it's not null:

this.locationDetail = (locationDetail != null) ? locationDetail.trim() : null;

This ensures consistent handling of string fields and prevents unintended whitespace issues.

Suggested change
this.locationDetail = locationDetail;
this.locationDetail = (locationDetail != null) ? locationDetail.trim() : null;

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +67
"latitude": 33.450701,
"longitude": 126.570667,
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The test coordinates (latitude: 33.450701, longitude: 126.570667) appear to be for Jeju Island, South Korea, but the location text says "서울 강남구" (Seoul, Gangnam-gu). These coordinates don't match the location description.

For accurate testing, the coordinates should match the stated location. Seoul Gangnam Station area coordinates would be approximately:

  • Latitude: 37.498
  • Longitude: 127.028

Consider updating the test data to use coordinates that match the location description for more realistic testing.

Suggested change
"latitude": 33.450701,
"longitude": 126.570667,
"latitude": 37.498,
"longitude": 127.028,

Copilot uses AI. Check for mistakes.
private static final int BATCH_LIMIT = 200;

// 10분마다 정도면 충분히 안정적
// 10분마다 정도면 충분히 안정적으로 판단
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The comment change from "10분마다 정도면 충분히 안정적" to "10분마다 정도면 충분히 안정적으로 판단" doesn't add significant meaning and appears to be an unnecessary modification. The original comment was clear enough.

This change is unrelated to the PR's stated purpose of adding latitude and longitude to groups. Consider keeping the original comment or removing this change from this PR.

Suggested change
// 10분마다 정도면 충분히 안정적으로 판단
// 10분마다 정도면 충분히 안정적

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +25
@Column(name = "latitude", length = 255)
private Double latitude;

@Column(name = "longitude", length = 255)
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The column type for latitude and longitude should be a numeric type (like DECIMAL or DOUBLE) rather than VARCHAR(255). Using length = 255 on a Double column is incorrect and may cause unexpected behavior. For numeric columns in JPA, you should use precision and scale attributes instead.

Consider changing to:

  • @Column(name = "latitude", precision = 10, scale = 8) for latitude
  • @Column(name = "longitude", precision = 11, scale = 8) for longitude

This provides sufficient precision for geographic coordinates (approximately 1.1mm accuracy).

Suggested change
@Column(name = "latitude", length = 255)
private Double latitude;
@Column(name = "longitude", length = 255)
@Column(name = "latitude", precision = 10, scale = 8)
private Double latitude;
@Column(name = "longitude", precision = 11, scale = 8)

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +100
"latitude": 33.450701,
"longitude": 126.570667,
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The test coordinates (latitude: 33.450701, longitude: 126.570667) appear to be for Jeju Island, South Korea, but the location text says "서울 강남구" (Seoul, Gangnam-gu). These coordinates don't match the location description.

For accurate testing, the coordinates should match the stated location. Seoul Gangnam Station area coordinates would be approximately:

  • Latitude: 37.498
  • Longitude: 127.028

Consider updating the test data to use coordinates that match the location description for more realistic testing.

Suggested change
"latitude": 33.450701,
"longitude": 126.570667,
"latitude": 37.498,
"longitude": 127.028,

Copilot uses AI. Check for mistakes.
Comment on lines +237 to +240
// 1. 현재 참석자 수(count)를 조회한다
// 2. count < maxParticipants면 참석 처리한다
// 3. 저장한다

Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

These TODO-style comments describing the algorithm steps are unrelated to the PR's purpose of adding latitude and longitude to groups. While they may be helpful for understanding the code flow, they should be in a separate commit or PR focused on code documentation improvements.

Consider removing these comments from this PR to keep changes focused on the latitude/longitude feature.

Suggested change
// 1. 현재 참석자 수(count)를 조회한다
// 2. count < maxParticipants면 참석 처리한다
// 3. 저장한다

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +25
Double latitude,

Double longitude,
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

Consider adding validation annotations to the latitude and longitude fields in the request DTOs to provide early validation and better error messages. While the entity performs validation, adding DTO-level validation would give clients faster feedback.

For example:

@DecimalMin(value = "-90.0", message = "모임: 위도는 -90 이상이어야 합니다.")
@DecimalMax(value = "90.0", message = "모임: 위도는 90 이하여야 합니다.")
Double latitude,

@DecimalMin(value = "-180.0", message = "모임: 경도는 -180 이상이어야 합니다.")
@DecimalMax(value = "180.0", message = "모임: 경도는 180 이하여야 합니다.")
Double longitude,

However, note that this would validate each field independently, while the entity requires both to be present or both to be null. You might need a custom class-level validator for the "both or neither" constraint.

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +29
Double latitude,
Double longitude,
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

Consider adding validation annotations to the latitude and longitude fields in the request DTOs to provide early validation and better error messages. While the entity performs validation, adding DTO-level validation would give clients faster feedback.

For example:

@DecimalMin(value = "-90.0", message = "모임: 위도는 -90 이상이어야 합니다.")
@DecimalMax(value = "90.0", message = "모임: 위도는 90 이하여야 합니다.")
Double latitude,

@DecimalMin(value = "-180.0", message = "모임: 경도는 -180 이상이어야 합니다.")
@DecimalMax(value = "180.0", message = "모임: 경도는 180 이하여야 합니다.")
Double longitude,

However, note that this would validate each field independently, while the entity requires both to be present or both to be null. You might need a custom class-level validator for the "both or neither" constraint.

Copilot uses AI. Check for mistakes.
if (latitude < -90 || latitude > 90) {
throw new GroupException(GroupErrorCode.LOCATION_LATITUDE_OUT_OF_RANGE);
}
if (longitude < -180 || longitude > 180) {
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

Variable longitude may be null at this access as suggested by this null guard.

Copilot uses AI. Check for mistakes.
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

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEAT] 모임 위도와 경도 추가

1 participant