Skip to content

Commit

Permalink
feat: 내 참여 정보 조회 api에 시작 위치 위도, 경도 정보 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
yujung7768903 committed Feb 25, 2024
1 parent 8d78ffd commit e12be8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class SpaceParticipationsResponse {
private Long participationId;
private String userEmail;
private String userName;
private Double latitude;
private Double longitude;
private String locationName;
private String transportation;
private Boolean isAdmin;
Expand All @@ -25,15 +27,19 @@ public static SpaceParticipationsResponse toParticipateEntity(Space space, Parti
.participationId(participation.getParticipationId())
.userEmail(user.getEmail())
.userName(participation.getUserName())
.latitude(participation.getLatitude())
.longitude(participation.getLongitude())
.locationName(participation.getLocationName())
.transportation(participation.getTransportation().name())
.isAdmin(space.getAdminId() == participation.getUserId())
.build();
}

public static SpaceParticipationsResponse toResponse(Long participationId, String userEmail, String userName, String locationName, String transportation, Boolean isAdmin) {
public static SpaceParticipationsResponse toResponse(
Long participationId, String userEmail, String userName, Double latitude, Double longitude, String locationName, String transportation, Boolean isAdmin
) {
return new SpaceParticipationsResponse(
participationId, userEmail, userName, locationName, transportation, isAdmin
participationId, userEmail, userName, latitude, longitude, locationName, transportation, isAdmin
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ void getParticipationDetail() throws Exception {
.header(AUTHORIZATION, "Bearer {token}")
.param("groupId", String.valueOf(1L));
SpaceParticipationsResponse participation =
SpaceParticipationsResponse.toResponse(1L, "[email protected]", "김모임장", "서울 성북구 보문로34다길 2", "PUBLIC", true);
SpaceParticipationsResponse.toResponse(1L, "[email protected]", "김모임장", 37.4830372, 127.0133939, "서울 성북구 보문로34다길 2", "PUBLIC", true);

given(spaceService.getParticipationDetail(anyLong(), any()))
.willReturn(participation);
Expand All @@ -397,6 +397,8 @@ void getParticipationDetail() throws Exception {
fieldWithPath("data.participationId").type(NUMBER).description("참여 ID"),
fieldWithPath("data.userEmail").type(STRING).description("유저 이메일"),
fieldWithPath("data.userName").type(STRING).description("유저 이름"),
fieldWithPath("data.latitude").type(NUMBER).description("유저 시작 위치 위도"),
fieldWithPath("data.longitude").type(NUMBER).description("유저 시작 위치 경도"),
fieldWithPath("data.locationName").type(STRING).description("유저 출발지 이름"),
fieldWithPath("data.transportation").type(STRING).description("유저 교통수단"),
fieldWithPath("data.isAdmin").type(BOOLEAN).description("관리자 여부(true: 모임장, false: 모임원)"))
Expand Down Expand Up @@ -743,19 +745,19 @@ void keywordCentralizedMeetingSpot() throws Exception {
@Test
void readParticipateGroupByRegion() throws Exception {
SpaceParticipationsResponse participations1 =
SpaceParticipationsResponse.toResponse(1L, "[email protected]", "김모임장", "서울 성북구 보문로34다길 2", "PUBLIC", true);
SpaceParticipationsResponse.toResponse(1L, "[email protected]", "김모임장", 37.4830372, 127.0133939, "서울 성북구 보문로34다길 2", "PUBLIC", true);
SpaceParticipationsResponse participations2 =
SpaceParticipationsResponse.toResponse(2L, "[email protected]", "박이람이", "서울 성북구 보문로34다길 2", "PUBLIC", false);
SpaceParticipationsResponse.toResponse(2L, "[email protected]", "박이람이", 37.4830372, 127.0133939, "서울 성북구 보문로34다길 2", "PUBLIC", false);
SpaceRegionResponse region1 = SpaceRegionResponse.toResponse("서울 성북구", List.of(participations1, participations2));

SpaceParticipationsResponse participations3 =
SpaceParticipationsResponse.toResponse(3L, "[email protected]", "천수제비", "서울 강북구 도봉로 76가길 55", "PERSONAL", false);
SpaceParticipationsResponse.toResponse(3L, "[email protected]", "천수제비", 37.4830372, 127.0133939, "서울 강북구 도봉로 76가길 55", "PERSONAL", false);
SpaceParticipationsResponse participations4 =
SpaceParticipationsResponse.toResponse(4L, "[email protected]", "모람모람", "서울 강북구 도봉로 76가길 54", "PUBLIC", false);
SpaceParticipationsResponse.toResponse(4L, "[email protected]", "모람모람", 37.4830372, 127.0133939, "서울 강북구 도봉로 76가길 54", "PUBLIC", false);
SpaceRegionResponse region2 = SpaceRegionResponse.toResponse("서울 강북구", List.of(participations3, participations4));

SpaceParticipationsResponse participations5 =
SpaceParticipationsResponse.toResponse(3L, "[email protected]", "낭만 ENFP", "경기도 부천시 부천로 1", "PERSONAL", false);
SpaceParticipationsResponse.toResponse(3L, "[email protected]", "낭만 ENFP", 37.4830372, 127.0133939, "경기도 부천시 부천로 1", "PERSONAL", false);
SpaceRegionResponse region3 =
SpaceRegionResponse.toResponse("경기도 부천시", List.of(participations5));

Expand Down

0 comments on commit e12be8c

Please sign in to comment.