-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from ShwimPing/refactor/ldy/deploy
[REFACTOR] CDN+ 적용
- Loading branch information
Showing
8 changed files
with
156 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/com/shwimping/be/review/exception/CanNotDeleteReviewException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.shwimping.be.review.exception; | ||
|
||
import com.shwimping.be.global.exception.errorcode.ErrorCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class CanNotDeleteReviewException extends RuntimeException { | ||
private final ErrorCode errorCode; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/shwimping/be/review/exception/ReviewNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.shwimping.be.review.exception; | ||
|
||
import com.shwimping.be.global.exception.errorcode.ErrorCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class ReviewNotFoundException extends RuntimeException { | ||
private final ErrorCode errorCode; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/shwimping/be/review/exception/errorcode/ReviewErrorCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.shwimping.be.review.exception.errorcode; | ||
|
||
import com.shwimping.be.global.exception.errorcode.ErrorCode; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum ReviewErrorCode implements ErrorCode { | ||
|
||
REVIEW_NOT_FOUND(HttpStatus.NOT_FOUND, "Review not found"), | ||
CANNOT_DELETE_REVIEW(HttpStatus.FORBIDDEN, "Author of the review can only delete the review"), | ||
; | ||
|
||
private final HttpStatus httpStatus; | ||
private final String message; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,29 +2,30 @@ | |
|
||
|
||
import com.shwimping.be.global.util.DummyDataInit; | ||
import com.shwimping.be.global.util.NCPProperties; | ||
import com.shwimping.be.user.domain.User; | ||
import com.shwimping.be.user.domain.type.Provider; | ||
import com.shwimping.be.user.repository.UserRepository; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.ApplicationArguments; | ||
import org.springframework.boot.ApplicationRunner; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Slf4j | ||
@RequiredArgsConstructor | ||
@Order(1) | ||
@DummyDataInit | ||
public class UserInitializer implements ApplicationRunner { | ||
|
||
@Value("${cloud.aws.cdn.domain}") | ||
private String defaultProfileImageUrl; | ||
|
||
private final UserRepository userRepository; | ||
private final PasswordEncoder passwordEncoder; | ||
private final NCPProperties ncpProperties; | ||
|
||
private static final String DUMMY_PROFILE_IMAGE_URL = "/profile/ic_profile.svg"; | ||
|
||
|
@@ -39,7 +40,7 @@ public void run(ApplicationArguments args) { | |
.nickname("관리자") | ||
.fcmToken("fcmToken") | ||
.isAlarmAllowed(true) | ||
.profileImageUrl(ncpProperties.s3().endpoint() + ncpProperties.s3().bucket() + DUMMY_PROFILE_IMAGE_URL) | ||
.profileImageUrl(defaultProfileImageUrl + DUMMY_PROFILE_IMAGE_URL) | ||
.email("[email protected]") | ||
.password(passwordEncoder.encode("adminPassword")) | ||
.provider(Provider.SELF) | ||
|
@@ -50,7 +51,7 @@ public void run(ApplicationArguments args) { | |
.nickname("user1") | ||
.fcmToken("fcmToken") | ||
.isAlarmAllowed(true) | ||
.profileImageUrl(ncpProperties.s3().endpoint() + ncpProperties.s3().bucket() + DUMMY_PROFILE_IMAGE_URL) | ||
.profileImageUrl(defaultProfileImageUrl + DUMMY_PROFILE_IMAGE_URL) | ||
.email("[email protected]") | ||
.password(passwordEncoder.encode("user1Password")) | ||
.provider(Provider.SELF) | ||
|
@@ -61,7 +62,7 @@ public void run(ApplicationArguments args) { | |
.nickname("user2") | ||
.fcmToken("fcmToken") | ||
.isAlarmAllowed(true) | ||
.profileImageUrl(ncpProperties.s3().endpoint() + ncpProperties.s3().bucket() + DUMMY_PROFILE_IMAGE_URL) | ||
.profileImageUrl(defaultProfileImageUrl + DUMMY_PROFILE_IMAGE_URL) | ||
.email("[email protected]") | ||
.password(passwordEncoder.encode("user2Password")) | ||
.provider(Provider.SELF) | ||
|