-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/innovationacademy-kr/42cabi …
…into dev
- Loading branch information
Showing
16 changed files
with
455 additions
and
233 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
24 changes: 24 additions & 0 deletions
24
backend/src/main/java/org/ftclub/cabinet/event/BlackholedUserLentEventListener.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,24 @@ | ||
package org.ftclub.cabinet.event; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.ftclub.cabinet.dto.UserBlackholeInfoDto; | ||
import org.ftclub.cabinet.utils.blackhole.manager.BlackholeManager; | ||
import org.springframework.context.event.EventListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Log4j2 | ||
@Component | ||
//@EnableAsync | ||
@RequiredArgsConstructor | ||
public class BlackholedUserLentEventListener { | ||
|
||
private final BlackholeManager blackholeManager; | ||
|
||
// @Async | ||
@EventListener | ||
public void handleBlackholedUserLentAttemptingEvent(UserBlackholeInfoDto userBlackholeInfoDto) { | ||
log.info("Called handleBlackholedUserLentAttemptingEvent"); | ||
blackholeManager.handleBlackhole(userBlackholeInfoDto); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
backend/src/main/java/org/ftclub/cabinet/exception/CustomExceptionStatus.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,30 @@ | ||
package org.ftclub.cabinet.exception; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
|
||
/** | ||
* {@link CustomServiceException}을 위한 exception 클래스. 생성할 exception에 대한 정보를 담고있다. | ||
*/ | ||
@JsonFormat(shape = JsonFormat.Shape.OBJECT) | ||
@RequiredArgsConstructor | ||
@Getter | ||
public class CustomExceptionStatus { | ||
private final int statusCode; | ||
private final String message; | ||
private final String error; | ||
|
||
public CustomExceptionStatus(HttpStatus status, String message) { | ||
this.statusCode = status.value(); | ||
this.message = message; | ||
this.error = status.getReasonPhrase(); | ||
} | ||
|
||
public CustomExceptionStatus(ExceptionStatus status, String message) { | ||
this.statusCode = status.getStatusCode(); | ||
this.message = status.getMessage() + "\n" + message; | ||
this.error = status.getError(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
backend/src/main/java/org/ftclub/cabinet/exception/CustomServiceException.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,21 @@ | ||
package org.ftclub.cabinet.exception; | ||
|
||
/** | ||
* Service에서 throw 하는 Exception 중 오류메세지를 커스텀 가능한 Exception | ||
* @see CustomExceptionStatus | ||
*/ | ||
public class CustomServiceException extends RuntimeException { | ||
|
||
final CustomExceptionStatus status; | ||
|
||
/** | ||
* @param status exception에 대한 정보에 대한 enum | ||
*/ | ||
public CustomServiceException(CustomExceptionStatus status) { | ||
this.status = status; | ||
} | ||
|
||
public CustomExceptionStatus getStatus() { | ||
return status; | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
backend/src/main/java/org/ftclub/cabinet/exception/UtilException.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,23 @@ | ||
package org.ftclub.cabinet.exception; | ||
|
||
/** | ||
* Util에서 throw하는 exception들을 위한 exception 사용 예시: | ||
* <pre> | ||
* {@code throw new UtilException(ExceptionStatus.NOT_FOUND_USER);} | ||
*</pre> | ||
* 만약 새로운 exception을 만들 필요가 있다면 {@link ExceptionStatus}에서 새로운 enum값을 추가하면 된다. | ||
* @see org.ftclub.cabinet.exception.ExceptionStatus | ||
*/ | ||
|
||
public class UtilException extends RuntimeException { | ||
|
||
final ExceptionStatus status; | ||
|
||
/** | ||
* @param status exception에 대한 정보에 대한 enum | ||
*/ | ||
public UtilException(ExceptionStatus status) { | ||
this.status = status; | ||
} | ||
|
||
} |
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
Oops, something went wrong.