This repository has been archived by the owner on Oct 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd0e543
commit bd6868e
Showing
10 changed files
with
111 additions
and
46 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
34 changes: 34 additions & 0 deletions
34
...main/java/com/woowacourse/tecobrary/admin/web/wishbook/WishBookAdminControllerAdvice.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,34 @@ | ||
package com.woowacourse.tecobrary.admin.web.wishbook; | ||
|
||
import com.woowacourse.tecobrary.admin.web.wishbook.exception.WishBookAlreadyHandledException; | ||
import com.woowacourse.tecobrary.admin.web.wishbook.exception.WishBookNotFoundException; | ||
import com.woowacourse.tecobrary.admin.web.wishbook.exception.WishBookStatusChangeFailedException; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
@RestControllerAdvice | ||
@Slf4j | ||
public class WishBookAdminControllerAdvice { | ||
|
||
@ExceptionHandler(WishBookNotFoundException.class) | ||
public ResponseEntity handleError(HttpServletRequest request, WishBookNotFoundException e) { | ||
log.info("[WishBookAdminControllerAdvice] exception request={}, occurred={}", request.toString(), e.getMessage()); | ||
return ResponseEntity.badRequest().body(e.getMessage()); | ||
} | ||
|
||
@ExceptionHandler(WishBookAlreadyHandledException.class) | ||
public ResponseEntity handleError(HttpServletRequest request, WishBookAlreadyHandledException e) { | ||
log.info("[WishBookAdminControllerAdvice] exception request={}, occurred={}", request.toString(), e.getMessage()); | ||
return ResponseEntity.badRequest().body(e.getMessage()); | ||
} | ||
|
||
@ExceptionHandler(WishBookStatusChangeFailedException.class) | ||
public ResponseEntity handleError(HttpServletRequest request, WishBookStatusChangeFailedException e) { | ||
log.info("[WishBookAdminControllerAdvice] exception request={}, occurred={}", request.toString(), e.getMessage()); | ||
return ResponseEntity.badRequest().body(e.getMessage()); | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
...src/main/java/com/woowacourse/tecobrary/admin/web/wishbook/dto/WishBookEnrollRequest.java
This file was deleted.
Oops, something went wrong.
7 changes: 5 additions & 2 deletions
7
...b/wishbook/dto/WishBookCancelRequest.java → ...b/wishbook/dto/WishBookHandleRequest.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 |
---|---|---|
@@ -1,18 +1,21 @@ | ||
package com.woowacourse.tecobrary.admin.web.wishbook.dto; | ||
|
||
import com.woowacourse.tecobrary.domain.wishbook.entity.WishBookStatus; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
public class WishBookCancelRequest { | ||
public class WishBookHandleRequest { | ||
|
||
private Long id; | ||
private WishBookStatus wishBookStatus; | ||
private String reason; | ||
|
||
public WishBookCancelRequest(Long id, String reason) { | ||
public WishBookHandleRequest(Long id, WishBookStatus wishBookStatus, String reason) { | ||
this.id = id; | ||
this.wishBookStatus = wishBookStatus; | ||
this.reason = reason; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...m/woowacourse/tecobrary/admin/web/wishbook/exception/WishBookAlreadyHandledException.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,14 @@ | ||
package com.woowacourse.tecobrary.admin.web.wishbook.exception; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class WishBookAlreadyHandledException extends RuntimeException { | ||
|
||
private final String title; | ||
|
||
public WishBookAlreadyHandledException(String title) { | ||
super("이미 처리된 희망도서 입니다."); | ||
this.title = title; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ava/com/woowacourse/tecobrary/admin/web/wishbook/exception/WishBookNotFoundException.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,14 @@ | ||
package com.woowacourse.tecobrary.admin.web.wishbook.exception; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class WishBookNotFoundException extends RuntimeException { | ||
|
||
private final Long id; | ||
|
||
public WishBookNotFoundException(Long id) { | ||
super("희망도서를 찾을 수 없습니다."); | ||
this.id = id; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...owacourse/tecobrary/admin/web/wishbook/exception/WishBookStatusChangeFailedException.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,14 @@ | ||
package com.woowacourse.tecobrary.admin.web.wishbook.exception; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class WishBookStatusChangeFailedException extends RuntimeException { | ||
|
||
private final Long id; | ||
|
||
public WishBookStatusChangeFailedException(Long id) { | ||
super("지원하지 않는 상태입니다."); | ||
this.id = id; | ||
} | ||
} |
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