Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cd_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
echo "LATEST_VERSION=${{ secrets.LATEST_VERSION }}" >> .env
echo "FORCE_UPDATE_VERSION=${{ secrets.FORCE_UPDATE_VERSION }}" >> .env
echo "GEOCODING_API=${{ secrets.GEOCODING_API }}" >> .env
echo "DEFAULT_IMAGE"=${{ secrets.DEFAULT_IMAGE }}" >> .env

echo "SPRING_PROFILES_ACTIVE=dev" >> .env

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cd_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
echo "LATEST_VERSION=${{ secrets.LATEST_VERSION_PROD }}" >> .env
echo "FORCE_UPDATE_VERSION=${{ secrets.FORCE_UPDATE_VERSION_PROD }}" >> .env
echo "GEOCODING_API=${{ secrets.GEOCODING_API }}" >> .env
echo "DEFAULT_IMAGE"=${{ secrets.DEFAULT_IMAGE }}" >> .env

- name: gradlew에 실행 권한 부여
run: chmod +x ./gradlew
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Response<?> putMyPlace(
@GetMapping("/{userId}")
public Response<List<MyPlaceResponse>> getMyPlace(
@Parameter(description = "찾고자 하는 userId", required = true)
@PathVariable Long userId
@PathVariable("userId") Long userId
) {
return Response.createSuccess(myPlaceService.getMyPlace(userId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ public class UserInfoRequest {
@Schema(description = "사용자 성별 (MALE, FEMALE)", example = "MALE")
private Gender gender;

@Schema(description = "프로필 이미지 default 체크", example = "1")
private int defaultCheck;

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.locationtech.jts.geom.Point;

import com.m3pro.groundflip.domain.entity.global.BaseTimeEntity;
import com.m3pro.groundflip.enums.Place;

import jakarta.persistence.Column;
Expand All @@ -27,7 +28,7 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Builder
public class MyPlace {
public class MyPlace extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "my_place_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.m3pro.groundflip.domain.entity.MyPlace;
import com.m3pro.groundflip.enums.Place;
Expand All @@ -12,16 +13,17 @@ public interface MyPlaceRepository extends JpaRepository<MyPlace, Long> {

@Query(value = """
SELECT mp.*
FROM my_place mp
JOIN (
SELECT place_name, MAX(my_place_id) AS max_place_mark_id
FROM my_place
GROUP BY place_name
) grouped_mp
ON mp.my_place_id = grouped_mp.max_place_mark_id
WHERE mp.user_id = :userId
FROM my_place mp
JOIN (
SELECT place_name, MAX(created_at) AS latest_created_at
FROM my_place
WHERE user_id = :userId
GROUP BY place_name
) grouped_mp
ON mp.place_name = grouped_mp.place_name AND mp.created_at = grouped_mp.latest_created_at
WHERE mp.user_id = :userId
""", nativeQuery = true)
List<MyPlace> findByUserId(Long userId);
List<MyPlace> findByUserId(@Param("userId") Long userId);

List<MyPlace> findByUserIdAndPlaceName(Long userId, Place placeName);
}
10 changes: 9 additions & 1 deletion src/main/java/com/m3pro/groundflip/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

Expand Down Expand Up @@ -48,6 +49,9 @@ public class UserService {
private final JwtProvider jwtProvider;
private final AppleApiClient appleApiClient;

@Value("${image.default}")
private String defaultImagePath;

/**
* 유저의 정보를 반환한다.
* @param userId 사용자 Id
Expand Down Expand Up @@ -93,7 +97,11 @@ public void putUserInfo(Long userId, UserInfoRequest userInfoRequest, MultipartF
if (multipartFile != null) {
fileS3Url = s3Uploader.uploadFiles(multipartFile, userId);
} else {
fileS3Url = user.getProfileImage();
if (userInfoRequest.getDefaultCheck() == 1) {
fileS3Url = defaultImagePath;
} else {
fileS3Url = user.getProfileImage();
}
}

user.updateGender(userInfoRequest.getGender());
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ version:
geocoding:
api: ${GEOCODING_API}

image:
default: ${DEFAULT_IMAGE}
3 changes: 3 additions & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ version:
geocoding:
api: ${GEOCODING_API}

image:
default: ${DEFAULT_IMAGE}

3 changes: 3 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ version:

geocoding:
api: ${GEOCODING_API}

image:
default: ${DEFAULT_IMAGE}
5 changes: 4 additions & 1 deletion src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,7 @@ version:
recommend: 1.0.0

geocoding:
api: "http://localhost:3030/find_district"
api: "http://localhost:3030/find_district"

image:
default: "https://ground-flip-prod-storage.s3.ap-northeast-2.amazonaws.com/static/default_profile_image.png"