diff --git a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/handler/CustomExceptionHandler.java b/dodam-api/src/main/java/b1nd/dodamapi/common/exception/CustomExceptionHandler.java similarity index 74% rename from dodam-core/src/main/java/b1nd/dodamcore/common/exception/handler/CustomExceptionHandler.java rename to dodam-api/src/main/java/b1nd/dodamapi/common/exception/CustomExceptionHandler.java index b604b5fc..a84d2caf 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/handler/CustomExceptionHandler.java +++ b/dodam-api/src/main/java/b1nd/dodamapi/common/exception/CustomExceptionHandler.java @@ -1,12 +1,15 @@ -package b1nd.dodamcore.common.exception.handler; +package b1nd.dodamapi.common.exception; import b1nd.dodamcore.common.exception.ErrorResponseEntity; import b1nd.dodamcore.common.exception.GlobalExceptionCode; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; +import jakarta.servlet.http.HttpServletRequest; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.FieldError; +import org.springframework.validation.ObjectError; import org.springframework.web.HttpMediaTypeNotSupportedException; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.MethodArgumentNotValidException; @@ -15,12 +18,17 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; -@Slf4j +import java.util.List; + @RestControllerAdvice +@Slf4j +@RequiredArgsConstructor public class CustomExceptionHandler { + private final ErrorNoticeSender errorNoticeSender; + @ExceptionHandler(CustomException.class) - protected ResponseEntity handleCustomException(CustomException e){ + protected ResponseEntity handleCustomException(CustomException e){ log.error("CustomException Status : {}", e.getExceptionCode().getHttpStatus()); log.error("CustomException Message : {}", e.getExceptionCode().getMessage()); @@ -28,29 +36,34 @@ protected ResponseEntity handleCustomException(CustomException e){ } @ExceptionHandler(MethodArgumentNotValidException.class) - protected ResponseEntity handleValidException(MethodArgumentNotValidException e) { - StringBuilder message = new StringBuilder(); - e.getBindingResult().getAllErrors().forEach( - error -> message - .append(((FieldError) error).getField()).append(" ") - .append(error.getDefaultMessage()).append(", ") - ); + protected ResponseEntity handleValidException(MethodArgumentNotValidException e) { + String message = getValidExceptionMessages(e.getBindingResult().getAllErrors()); log.error("Valid Fail Object : {}", e.getObjectName()); - log.error("Valid Fail Message : \"{}\"", message.substring(0, message.length() - 2)); + log.error("Valid Fail Message : \"{}\"", message); return ResponseEntity .status(e.getStatusCode()) .body(ErrorResponseEntity.builder() .status(e.getStatusCode().value()) .code(GlobalExceptionCode.PARAMETER_NOT_VALID.name()) - .message(message.substring(0, message.length() - 2)) + .message(message) .build() ); } + private String getValidExceptionMessages(List errors) { + StringBuilder message = new StringBuilder(); + errors.forEach( + error -> message + .append(((FieldError) error).getField()).append(" ") + .append(error.getDefaultMessage()).append(", ") + ); + return message.substring(0, message.length() - 2); + } + @ExceptionHandler(MissingServletRequestParameterException.class) - protected ResponseEntity handleMissingServletRequestParameterException(MissingServletRequestParameterException e) { + protected ResponseEntity handleMissingServletRequestParameterException(MissingServletRequestParameterException e) { return ResponseEntity .status(400) .body(ErrorResponseEntity.builder() @@ -61,7 +74,7 @@ protected ResponseEntity handleMissingServletRequestParameterException(MissingSe } @ExceptionHandler(HttpMessageNotReadableException.class) - protected ResponseEntity handleHttpMessageNotReadableException(HttpMessageNotReadableException e) { + protected ResponseEntity handleHttpMessageNotReadableException(HttpMessageNotReadableException e) { return ResponseEntity .status(400) .body(ErrorResponseEntity.builder() @@ -72,7 +85,7 @@ protected ResponseEntity handleHttpMessageNotReadableException(HttpMessageNotRea } @ExceptionHandler(HttpRequestMethodNotSupportedException.class) - protected ResponseEntity handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) { + protected ResponseEntity handleHttpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) { return ResponseEntity .status(400) .body(ErrorResponseEntity.builder() @@ -83,7 +96,7 @@ protected ResponseEntity handleHttpRequestMethodNotSupportedException(HttpReques } @ExceptionHandler(HttpMediaTypeNotSupportedException.class) - protected ResponseEntity handleHttpMediaTypeNotSupportedException() { + protected ResponseEntity handleHttpMediaTypeNotSupportedException() { return ResponseEntity .status(400) .body(ErrorResponseEntity.builder() @@ -94,7 +107,7 @@ protected ResponseEntity handleHttpMediaTypeNotSupportedException() { } @ExceptionHandler(MethodArgumentTypeMismatchException.class) - protected ResponseEntity handleMethodArgumentTypeMismatchException() { + protected ResponseEntity handleMethodArgumentTypeMismatchException() { return ResponseEntity .status(400) .body(ErrorResponseEntity.builder() @@ -105,8 +118,8 @@ protected ResponseEntity handleMethodArgumentTypeMismatchException() { } @ExceptionHandler(Exception.class) - protected ResponseEntity handleException(Exception e){ - log.error(e.toString()); + protected ResponseEntity handleException(Exception e, HttpServletRequest request){ + errorNoticeSender.send(e, request); return ResponseEntity .status(500) @@ -116,4 +129,5 @@ protected ResponseEntity handleException(Exception e){ .message(GlobalExceptionCode.INTERNAL_SERVER.getMessage()) .build()); } -} \ No newline at end of file + +} diff --git a/dodam-api/src/main/java/b1nd/dodamapi/common/exception/ErrorNoticeSender.java b/dodam-api/src/main/java/b1nd/dodamapi/common/exception/ErrorNoticeSender.java new file mode 100644 index 00000000..f34aefcc --- /dev/null +++ b/dodam-api/src/main/java/b1nd/dodamapi/common/exception/ErrorNoticeSender.java @@ -0,0 +1,56 @@ +package b1nd.dodamapi.common.exception; + +import b1nd.dodamcore.notice.NoticeClient; +import jakarta.servlet.http.HttpServletRequest; +import lombok.RequiredArgsConstructor; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.time.LocalDateTime; + +@Component +@RequiredArgsConstructor +public class ErrorNoticeSender { + + private final NoticeClient client; + + @Async + public void send(Exception e, HttpServletRequest request) { + LocalDateTime now = LocalDateTime.now(); + String requestPath = getRequestPath(request); + String title = "๐Ÿšจ OMG"; + String description = "### ๐Ÿ•– ๋ฐœ์ƒ ์‹œ๊ฐ„\n" + + now + + "\n" + + "### ๐Ÿ”— ์š”์ฒญ URL\n" + + requestPath + + "\n" + + "### ๐Ÿ“„ Stack Trace\n" + + "```\n" + + getStackTrace(e) + + "\n```"; + + client.notice("", title, description); + } + + private String getRequestPath(HttpServletRequest request) { + String path = request.getMethod() + " " + request.getRequestURL(); + + String queryString = request.getQueryString(); + if (queryString != null) { + path += "?" + queryString; + } + + return path; + } + + private String getStackTrace(Exception e) { + StringWriter stringWriter = new StringWriter(); + e.printStackTrace(new PrintWriter(stringWriter)); + + return stringWriter.toString().substring(0, 1000); + } + +} diff --git a/dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointSMSEventHelper.java b/dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointMessageMaker.java similarity index 97% rename from dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointSMSEventHelper.java rename to dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointMessageMaker.java index 9c0f80ed..2726d719 100644 --- a/dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointSMSEventHelper.java +++ b/dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointMessageMaker.java @@ -7,7 +7,7 @@ import b1nd.dodamcore.point.domain.event.PointCanceledEvent; import b1nd.dodamcore.point.domain.event.PointIssuedEvent; -final class PointSMSEventHelper { +final class PointMessageMaker { public static PointIssuedEvent createIssuedEvent(Member member, PointReason reason) { return new PointIssuedEvent( diff --git a/dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointUseCase.java b/dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointUseCase.java index 38a34569..4c69eaab 100644 --- a/dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointUseCase.java +++ b/dodam-api/src/main/java/b1nd/dodamapi/point/usecase/PointUseCase.java @@ -66,7 +66,7 @@ private void saveScores(List students, PointReason reason) { private void publishPointIssuedEvents(List students, PointReason reason) { students.forEach(s -> eventPublisher.publishEvent( - PointSMSEventHelper.createIssuedEvent(s.getMember(), reason) + PointMessageMaker.createIssuedEvent(s.getMember(), reason) )); } @@ -84,12 +84,11 @@ public Response cancel(Integer id) { } private void publishCanceledEvent(PointReason reason, Member member) { - eventPublisher.publishEvent(PointSMSEventHelper.createCanceledEvent(member, reason)); + eventPublisher.publishEvent(PointMessageMaker.createCanceledEvent(member, reason)); } public ResponseData> getMyPoints(PointType type) { Student student = memberService.getStudentFromSession(); - return ResponseData.ok("๋‚ด ์ƒ๋ฒŒ์  ์กฐํšŒ ์„ฑ๊ณต", getPointsBy(student, type)); } diff --git a/dodam-api/src/main/resources/application.yml b/dodam-api/src/main/resources/application.yml index 20d08de4..6029c17e 100644 --- a/dodam-api/src/main/resources/application.yml +++ b/dodam-api/src/main/resources/application.yml @@ -25,7 +25,7 @@ spring: ddl-auto: none properties: hibernate: - show_sql: true + show_sql: false format_sql: true data: redis.repositories.enabled: false @@ -72,6 +72,8 @@ app: url: ${CODENARY_URL} melon: url: ${MELON_URL} + discord: + url: ${DISCORD_URL} cloud: aws: diff --git a/dodam-core/src/main/java/b1nd/dodamcore/banner/domain/exception/BannerNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/banner/domain/exception/BannerNotFoundException.java index 0ddf6686..2510b0ef 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/banner/domain/exception/BannerNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/banner/domain/exception/BannerNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.banner.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusAlreadyApplyException.java b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusAlreadyApplyException.java index 89988aad..d72f5b1b 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusAlreadyApplyException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusAlreadyApplyException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.bus.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusFullOfSeatException.java b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusFullOfSeatException.java index 09f666cd..e8f0da34 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusFullOfSeatException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusFullOfSeatException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.bus.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusMemberNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusMemberNotFoundException.java index 27ee1f5f..b74f3a5a 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusMemberNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusMemberNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.bus.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusNotFoundException.java index aff6cb09..bdeb1137 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.bus.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusPeriodExpiredException.java b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusPeriodExpiredException.java index f74e2313..e9d1084d 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusPeriodExpiredException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/bus/domain/exception/BusPeriodExpiredException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.bus.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/common/enums/SchoolPlace.java b/dodam-core/src/main/java/b1nd/dodamcore/common/enums/SchoolPlace.java index cf50dcdc..4dff587c 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/common/enums/SchoolPlace.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/common/enums/SchoolPlace.java @@ -1,7 +1,7 @@ package b1nd.dodamcore.common.enums; import b1nd.dodamcore.common.exception.ExceptionCode; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/CustomException.java b/dodam-core/src/main/java/b1nd/dodamcore/common/exception/CustomException.java similarity index 78% rename from dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/CustomException.java rename to dodam-core/src/main/java/b1nd/dodamcore/common/exception/CustomException.java index 35100517..58725c08 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/CustomException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/common/exception/CustomException.java @@ -1,6 +1,5 @@ -package b1nd.dodamcore.common.exception.custom; +package b1nd.dodamcore.common.exception; -import b1nd.dodamcore.common.exception.ExceptionCode; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/InternalServerException.java b/dodam-core/src/main/java/b1nd/dodamcore/common/exception/InternalServerException.java similarity index 75% rename from dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/InternalServerException.java rename to dodam-core/src/main/java/b1nd/dodamcore/common/exception/InternalServerException.java index 0d587748..d628e817 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/InternalServerException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/common/exception/InternalServerException.java @@ -1,6 +1,5 @@ -package b1nd.dodamcore.common.exception.custom; +package b1nd.dodamcore.common.exception; -import b1nd.dodamcore.common.exception.GlobalExceptionCode; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/ParameterNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/ParameterNotFoundException.java deleted file mode 100644 index 7a5c7608..00000000 --- a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/ParameterNotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -package b1nd.dodamcore.common.exception.custom; - -import b1nd.dodamcore.common.exception.GlobalExceptionCode; -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.ResponseStatus; - -@ResponseStatus(value = HttpStatus.BAD_REQUEST) -public class ParameterNotFoundException extends CustomException { - - public ParameterNotFoundException() { - super(GlobalExceptionCode.PARAMETER_NOT_FOUND); - } -} diff --git a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/PermissionInvalidException.java b/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/PermissionInvalidException.java deleted file mode 100644 index 977eb11f..00000000 --- a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/PermissionInvalidException.java +++ /dev/null @@ -1,13 +0,0 @@ -package b1nd.dodamcore.common.exception.custom; - -import b1nd.dodamcore.common.exception.GlobalExceptionCode; -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.ResponseStatus; - -@ResponseStatus(value = HttpStatus.BAD_REQUEST) -public class PermissionInvalidException extends CustomException { - - public PermissionInvalidException() { - super(GlobalExceptionCode.INVALID_PERMISSION); - } -} diff --git a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/ResourceNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/ResourceNotFoundException.java deleted file mode 100644 index 0b0c26be..00000000 --- a/dodam-core/src/main/java/b1nd/dodamcore/common/exception/custom/ResourceNotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -package b1nd.dodamcore.common.exception.custom; - -import b1nd.dodamcore.common.exception.GlobalExceptionCode; -import org.springframework.http.HttpStatus; -import org.springframework.web.bind.annotation.ResponseStatus; - -@ResponseStatus(value = HttpStatus.NOT_FOUND) -public class ResourceNotFoundException extends CustomException{ - - public ResourceNotFoundException() { - super(GlobalExceptionCode.RESOURCE_NOT_FOUND); - } -} diff --git a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/ActiveMemberException.java b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/ActiveMemberException.java index e07756b9..35957192 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/ActiveMemberException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/ActiveMemberException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.member.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/BroadcastClubMemberDuplicateException.java b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/BroadcastClubMemberDuplicateException.java index 24226beb..cd3f6da3 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/BroadcastClubMemberDuplicateException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/BroadcastClubMemberDuplicateException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.member.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/DeactivateMemberException.java b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/DeactivateMemberException.java index ee84bd92..76b87663 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/DeactivateMemberException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/DeactivateMemberException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.member.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/MemberDuplicateException.java b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/MemberDuplicateException.java index 2f8620d7..c2b67059 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/MemberDuplicateException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/MemberDuplicateException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.member.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/MemberNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/MemberNotFoundException.java index de1293d8..5163970e 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/MemberNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/MemberNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.member.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/StudentNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/StudentNotFoundException.java index 60b39e4d..2565765b 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/StudentNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/StudentNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.member.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/TeacherNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/TeacherNotFoundException.java index 6a5fde91..93c7f44b 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/TeacherNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/TeacherNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.member.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/WrongPasswordException.java b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/WrongPasswordException.java index e69e1c81..36c74ade 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/WrongPasswordException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/member/domain/exception/WrongPasswordException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.member.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/InvalidNightStudyPeriodException.java b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/InvalidNightStudyPeriodException.java index c6e82dc3..5bc61b4c 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/InvalidNightStudyPeriodException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/InvalidNightStudyPeriodException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.nightstudy.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyApplicationDurationPassedException.java b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyApplicationDurationPassedException.java index a39d0c88..0dbf6547 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyApplicationDurationPassedException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyApplicationDurationPassedException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.nightstudy.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyDuplicateException.java b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyDuplicateException.java index 3afec918..e7c75c5b 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyDuplicateException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyDuplicateException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.nightstudy.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyNotFoundException.java index f86ca10f..1272ec2a 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NightStudyNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.nightstudy.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NotNightStudyApplicantException.java b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NotNightStudyApplicantException.java index 94cc5524..52474f17 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NotNightStudyApplicantException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/NotNightStudyApplicantException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.nightstudy.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/ReasonForPhoneMissingException.java b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/ReasonForPhoneMissingException.java index e3220e8e..3504f502 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/ReasonForPhoneMissingException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/nightstudy/domain/exception/ReasonForPhoneMissingException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.nightstudy.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/notice/NoticeClient.java b/dodam-core/src/main/java/b1nd/dodamcore/notice/NoticeClient.java new file mode 100644 index 00000000..25c8d1fd --- /dev/null +++ b/dodam-core/src/main/java/b1nd/dodamcore/notice/NoticeClient.java @@ -0,0 +1,7 @@ +package b1nd.dodamcore.notice; + +public interface NoticeClient { + + void notice(String content, String title, String description); + +} diff --git a/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/InvalidOutGoingDurationException.java b/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/InvalidOutGoingDurationException.java index d2345cb0..ee517c9e 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/InvalidOutGoingDurationException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/InvalidOutGoingDurationException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.outgoing.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/NotOutGoingApplicantException.java b/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/NotOutGoingApplicantException.java index 1cc9cdbb..e3477bfb 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/NotOutGoingApplicantException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/NotOutGoingApplicantException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.outgoing.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/OutGoingNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/OutGoingNotFoundException.java index 2fb6a19c..5f3042ca 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/OutGoingNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/outgoing/domain/exception/OutGoingNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.outgoing.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/InvalidOutSleepingPeriodException.java b/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/InvalidOutSleepingPeriodException.java index 3ad6cc1d..3ce4616f 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/InvalidOutSleepingPeriodException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/InvalidOutSleepingPeriodException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.outsleeping.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/NotOutSleepingApplicantException.java b/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/NotOutSleepingApplicantException.java index 0f306320..4b3866de 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/NotOutSleepingApplicantException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/NotOutSleepingApplicantException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.outsleeping.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/OutSleepingNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/OutSleepingNotFoundException.java index 02b22fa4..fff2304b 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/OutSleepingNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/outsleeping/domain/exception/OutSleepingNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.outsleeping.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointNotFoundException.java index 64939ec0..de7430e5 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.point.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointReasonDuplicateException.java b/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointReasonDuplicateException.java index 7b42701a..6451b53d 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointReasonDuplicateException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointReasonDuplicateException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.point.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointReasonNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointReasonNotFoundException.java index acc9fefb..37f01b59 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointReasonNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointReasonNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.point.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointScoreNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointScoreNotFoundException.java index 16aa8708..54540369 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointScoreNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/point/domain/exception/PointScoreNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.point.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/recruit/domain/exception/RecruitNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/recruit/domain/exception/RecruitNotFoundException.java index 3ea7f160..07bcbd3f 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/recruit/domain/exception/RecruitNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/recruit/domain/exception/RecruitNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.recruit.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/schedule/domain/exception/ScheduleNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/schedule/domain/exception/ScheduleNotFoundException.java index ad845b37..978e1865 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/schedule/domain/exception/ScheduleNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/schedule/domain/exception/ScheduleNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.schedule.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/NotWakeupSongApplicantException.java b/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/NotWakeupSongApplicantException.java index deb1db41..c7c798ef 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/NotWakeupSongApplicantException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/NotWakeupSongApplicantException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.wakeupsong.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongAlreadyCreatedException.java b/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongAlreadyCreatedException.java index 117d91bc..920b6f65 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongAlreadyCreatedException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongAlreadyCreatedException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.wakeupsong.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongNotFoundException.java b/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongNotFoundException.java index 20ba847e..33952394 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongNotFoundException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongNotFoundException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.wakeupsong.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongUrlMalformedException.java b/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongUrlMalformedException.java index e94e44ad..d8e77a56 100644 --- a/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongUrlMalformedException.java +++ b/dodam-core/src/main/java/b1nd/dodamcore/wakeupsong/domain/exception/WakeupSongUrlMalformedException.java @@ -1,6 +1,6 @@ package b1nd.dodamcore.wakeupsong.domain.exception; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryClient.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryClient.java index dea3fa9f..eca2a6c5 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryClient.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryClient.java @@ -29,4 +29,4 @@ public CompletableFuture> getByMonth() { .toFuture(); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryItemParser.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryItemParser.java index 7a0b16da..525aded7 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryItemParser.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryItemParser.java @@ -39,4 +39,4 @@ private static LocalDate parseDate(String date) { return LocalDate.parse(date.split("T")[0]); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryProperties.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryProperties.java index 8fc6980f..248586e0 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryProperties.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/codenary/CodenaryProperties.java @@ -13,4 +13,4 @@ class CodenaryProperties { private String url; -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/api/discord/DiscordClient.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/discord/DiscordClient.java new file mode 100644 index 00000000..3239003a --- /dev/null +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/discord/DiscordClient.java @@ -0,0 +1,27 @@ +package b1nd.dodaminfra.api.discord; + +import b1nd.dodamcore.notice.NoticeClient; +import b1nd.dodaminfra.webclient.WebClientSupport; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +@Slf4j +@RequiredArgsConstructor +final class DiscordClient implements NoticeClient { + + private final WebClientSupport webClient; + private final DiscordProperties properties; + + @Override + public void notice(String content, String title, String description) { + webClient.post( + properties.getUrl(), + new DiscordMessage(content, List.of(new Embed(title, description))) + ); + } + +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/api/discord/DiscordMessage.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/discord/DiscordMessage.java new file mode 100644 index 00000000..de43ffb8 --- /dev/null +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/discord/DiscordMessage.java @@ -0,0 +1,7 @@ +package b1nd.dodaminfra.api.discord; + +import java.util.List; + +record DiscordMessage(String content, List embeds) {} + +record Embed(String title, String description) {} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/api/discord/DiscordProperties.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/discord/DiscordProperties.java new file mode 100644 index 00000000..63175abd --- /dev/null +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/discord/DiscordProperties.java @@ -0,0 +1,16 @@ +package b1nd.dodaminfra.api.discord; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Getter +@Setter +@Configuration +@ConfigurationProperties(prefix = "app.discord") +class DiscordProperties { + + private String url; + +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/token/DodamTokenClient.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/dodamtoken/DodamTokenClient.java similarity index 96% rename from dodam-infra/src/main/java/b1nd/dodaminfra/token/DodamTokenClient.java rename to dodam-infra/src/main/java/b1nd/dodaminfra/api/dodamtoken/DodamTokenClient.java index 1b4b4b39..586b4d74 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/token/DodamTokenClient.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/dodamtoken/DodamTokenClient.java @@ -1,4 +1,4 @@ -package b1nd.dodaminfra.token; +package b1nd.dodaminfra.api.dodamtoken; import b1nd.dodamcore.auth.application.dto.req.ReissueTokenReq; import b1nd.dodamcore.auth.application.dto.res.LoginRes; @@ -23,7 +23,7 @@ final class DodamTokenClient implements TokenClient { private final WebClientSupport webClient; private final JwtProperties jwtProperties; - private final TokenProperties tokenProperties; + private final DodamTokenProperties tokenProperties; @Override public CompletableFuture issueTokens(Member member) { diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/token/TokenProperties.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/dodamtoken/DodamTokenProperties.java similarity index 82% rename from dodam-infra/src/main/java/b1nd/dodaminfra/token/TokenProperties.java rename to dodam-infra/src/main/java/b1nd/dodaminfra/api/dodamtoken/DodamTokenProperties.java index 3f672319..48ee2918 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/token/TokenProperties.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/dodamtoken/DodamTokenProperties.java @@ -1,4 +1,4 @@ -package b1nd.dodaminfra.token; +package b1nd.dodaminfra.api.dodamtoken; import lombok.Getter; import lombok.Setter; @@ -9,10 +9,10 @@ @Setter @Configuration @ConfigurationProperties("app.token") -class TokenProperties { +class DodamTokenProperties { private String generate; private String verify; private String refresh; -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/token/JwtProperties.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/dodamtoken/JwtProperties.java similarity index 88% rename from dodam-infra/src/main/java/b1nd/dodaminfra/token/JwtProperties.java rename to dodam-infra/src/main/java/b1nd/dodaminfra/api/dodamtoken/JwtProperties.java index f3723e27..0d2befaf 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/token/JwtProperties.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/dodamtoken/JwtProperties.java @@ -1,4 +1,4 @@ -package b1nd.dodaminfra.token; +package b1nd.dodaminfra.api.dodamtoken; import lombok.Getter; import lombok.Setter; @@ -14,4 +14,4 @@ class JwtProperties { private String issuer; private String tokenServer; -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/sms/GabiaOAuthClient.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/gabia/GabiaOAuthClient.java similarity index 97% rename from dodam-infra/src/main/java/b1nd/dodaminfra/sms/GabiaOAuthClient.java rename to dodam-infra/src/main/java/b1nd/dodaminfra/api/gabia/GabiaOAuthClient.java index e5cbc904..62c230c6 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/sms/GabiaOAuthClient.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/gabia/GabiaOAuthClient.java @@ -1,4 +1,4 @@ -package b1nd.dodaminfra.sms; +package b1nd.dodaminfra.api.gabia; import b1nd.dodaminfra.webclient.WebClientSupport; import com.fasterxml.jackson.annotation.JsonProperty; @@ -60,4 +60,4 @@ record GabiaOAuthRes( @JsonProperty("token_type") String tokenType, String code -) {} \ No newline at end of file +) {} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/sms/GabiaProperties.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/gabia/GabiaProperties.java similarity index 93% rename from dodam-infra/src/main/java/b1nd/dodaminfra/sms/GabiaProperties.java rename to dodam-infra/src/main/java/b1nd/dodaminfra/api/gabia/GabiaProperties.java index abe3a735..da3ae96a 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/sms/GabiaProperties.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/gabia/GabiaProperties.java @@ -1,4 +1,4 @@ -package b1nd.dodaminfra.sms; +package b1nd.dodaminfra.api.gabia; import lombok.Getter; import lombok.Setter; @@ -20,4 +20,4 @@ class GabiaProperties { private String sender; private String subject; -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/sms/GabiaSMSClient.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/gabia/GabiaSMSClient.java similarity index 98% rename from dodam-infra/src/main/java/b1nd/dodaminfra/sms/GabiaSMSClient.java rename to dodam-infra/src/main/java/b1nd/dodaminfra/api/gabia/GabiaSMSClient.java index 27aa6e51..4601e60e 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/sms/GabiaSMSClient.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/gabia/GabiaSMSClient.java @@ -1,4 +1,4 @@ -package b1nd.dodaminfra.sms; +package b1nd.dodaminfra.api.gabia; import b1nd.dodamcore.sms.application.SMSClient; import b1nd.dodamcore.sms.application.dto.req.SendSmsReq; @@ -76,4 +76,4 @@ private String getAuthValue() { ); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/api/melon/MelonProperties.java b/dodam-infra/src/main/java/b1nd/dodaminfra/api/melon/MelonProperties.java index f0def3f4..0819ec08 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/api/melon/MelonProperties.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/api/melon/MelonProperties.java @@ -13,4 +13,4 @@ public class MelonProperties { private String url; -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/StorageConfig.java b/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/StorageConfig.java index cb083b87..041952d3 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/StorageConfig.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/StorageConfig.java @@ -25,4 +25,4 @@ public AmazonS3Client amazonS3Client() { cloudProperties.storage().getEndPoint(), cloudProperties.region().getRegion())) .build(); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/StorageUploadExecutor.java b/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/StorageUploadExecutor.java index b88ba536..9dce5117 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/StorageUploadExecutor.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/StorageUploadExecutor.java @@ -47,4 +47,4 @@ public void delete(String path) { String bucket = cloudProperties.storage().getBucket(); amazonS3Client.deleteObject(bucket, path); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/exception/CloudException.java b/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/exception/CloudException.java index b034b084..17d5c704 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/exception/CloudException.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/cloud/exception/CloudException.java @@ -1,6 +1,6 @@ package b1nd.dodaminfra.cloud.exception; -import b1nd.dodamcore.common.exception.custom.InternalServerException; +import b1nd.dodamcore.common.exception.InternalServerException; public final class CloudException extends InternalServerException { -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/MemberAuthenticationHolder.java b/dodam-infra/src/main/java/b1nd/dodaminfra/security/MemberAuthenticationHolder.java similarity index 84% rename from dodam-infra/src/main/java/b1nd/dodaminfra/security/common/MemberAuthenticationHolder.java rename to dodam-infra/src/main/java/b1nd/dodaminfra/security/MemberAuthenticationHolder.java index 83c8f80b..435fd4c5 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/MemberAuthenticationHolder.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/security/MemberAuthenticationHolder.java @@ -1,7 +1,8 @@ -package b1nd.dodaminfra.security.common; +package b1nd.dodaminfra.security; import b1nd.dodamcore.member.application.MemberSessionHolder; import b1nd.dodamcore.member.domain.entity.Member; +import b1nd.dodaminfra.security.common.MemberDetails; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Component; @@ -13,4 +14,4 @@ public Member current() { return ((MemberDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).member(); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/SecurityConfig.java b/dodam-infra/src/main/java/b1nd/dodaminfra/security/SecurityConfig.java similarity index 98% rename from dodam-infra/src/main/java/b1nd/dodaminfra/security/common/SecurityConfig.java rename to dodam-infra/src/main/java/b1nd/dodaminfra/security/SecurityConfig.java index 64c31291..6251b6d5 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/SecurityConfig.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/security/SecurityConfig.java @@ -1,6 +1,7 @@ -package b1nd.dodaminfra.security.common; +package b1nd.dodaminfra.security; import b1nd.dodamcore.common.exception.GlobalExceptionCode; +import b1nd.dodaminfra.security.common.ErrorResponseSender; import b1nd.dodaminfra.token.TokenExceptionFilter; import b1nd.dodaminfra.wakeupsong.WakeupSongFilter; import b1nd.dodaminfra.token.TokenFilter; @@ -128,4 +129,4 @@ public CorsConfigurationSource corsConfigurationSource() { return source; } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/security/encrypt/Sha512PasswordEncoder.java b/dodam-infra/src/main/java/b1nd/dodaminfra/security/Sha512PasswordEncoder.java similarity index 90% rename from dodam-infra/src/main/java/b1nd/dodaminfra/security/encrypt/Sha512PasswordEncoder.java rename to dodam-infra/src/main/java/b1nd/dodaminfra/security/Sha512PasswordEncoder.java index dc869e20..6916fbf8 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/security/encrypt/Sha512PasswordEncoder.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/security/Sha512PasswordEncoder.java @@ -1,7 +1,7 @@ -package b1nd.dodaminfra.security.encrypt; +package b1nd.dodaminfra.security; import b1nd.dodamcore.auth.application.PasswordEncoder; -import b1nd.dodamcore.common.exception.custom.InternalServerException; +import b1nd.dodamcore.common.exception.InternalServerException; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -36,4 +36,4 @@ public boolean matches(String rawPassword, String encryptedPassword) { return encryptedPassword.equals(encode(rawPassword)); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/ErrorResponseSender.java b/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/ErrorResponseSender.java index c9e6b826..8afa6f6b 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/ErrorResponseSender.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/ErrorResponseSender.java @@ -36,4 +36,4 @@ private ErrorResponseEntity getErrorResponseEntity(ExceptionCode code) { .build(); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/MemberDetails.java b/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/MemberDetails.java index 02d6feac..4976e7e8 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/MemberDetails.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/security/common/MemberDetails.java @@ -44,4 +44,4 @@ public boolean isEnabled() { return false; } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/token/TokenExtractor.java b/dodam-infra/src/main/java/b1nd/dodaminfra/token/TokenExtractor.java index 88e96d89..d2d49b5c 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/token/TokenExtractor.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/token/TokenExtractor.java @@ -24,4 +24,4 @@ static String extract(HttpServletRequest request, String type) { return Strings.EMPTY; } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/wakeupsong/WakeupSongFilter.java b/dodam-infra/src/main/java/b1nd/dodaminfra/wakeupsong/WakeupSongFilter.java index 63e8dfe2..66a2b126 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/wakeupsong/WakeupSongFilter.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/wakeupsong/WakeupSongFilter.java @@ -86,4 +86,4 @@ private boolean isNotBroadcastClubMemberAndAdmin(Member member) { return !MemberRole.ADMIN.equals(member.getRole()) && !memberService.checkBroadcastClubMember(member); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/WebClientConfig.java b/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/WebClientConfig.java index 9d09010b..e32c3531 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/WebClientConfig.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/WebClientConfig.java @@ -39,4 +39,4 @@ public ConnectionProvider connectionProvider() { .build(); } -} \ No newline at end of file +} diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/WebClientSupport.java b/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/WebClientSupport.java index 29793430..c2db04df 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/WebClientSupport.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/WebClientSupport.java @@ -1,7 +1,7 @@ package b1nd.dodaminfra.webclient; import b1nd.dodamcore.common.exception.GlobalExceptionCode; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; import b1nd.dodaminfra.webclient.exception.WebClientException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -34,6 +34,17 @@ public Mono get(String url, Class responseDtoClass, String... headers) .bodyToMono(responseDtoClass); } + public void post(String url, V body, String... headers) { + webClient.post() + .uri(url) + .headers(convertStringToHttpHeaders(headers)) + .bodyValue(body) + .retrieve() + .onStatus(HttpStatusCode::isError, onError()) + .toBodilessEntity() + .subscribe(); + } + public Mono post(String url, V body, Class responseClass, String... headers) { return webClient.post() .uri(url) diff --git a/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/exception/WebClientException.java b/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/exception/WebClientException.java index 436a6553..9bad3791 100644 --- a/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/exception/WebClientException.java +++ b/dodam-infra/src/main/java/b1nd/dodaminfra/webclient/exception/WebClientException.java @@ -1,7 +1,7 @@ package b1nd.dodaminfra.webclient.exception; import b1nd.dodamcore.common.exception.GlobalExceptionCode; -import b1nd.dodamcore.common.exception.custom.CustomException; +import b1nd.dodamcore.common.exception.CustomException; public final class WebClientException extends CustomException {