-
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.
#9 feat: BoardImage삭제 API구현, feat: BoadImage Exception구조 구현
- Loading branch information
Showing
10 changed files
with
166 additions
and
0 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
23 changes: 23 additions & 0 deletions
23
server/src/main/java/com/yogit/server/board/dto/request/boardimage/DeleteBoardImageReq.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 com.yogit.server.board.dto.request.boardimage; | ||
|
||
import io.swagger.annotations.ApiModelProperty; | ||
import io.swagger.annotations.ApiParam; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
public class DeleteBoardImageReq { | ||
|
||
@ApiModelProperty(example = "1") | ||
@ApiParam(value = "Board ID", required = true) | ||
private Long boardId; | ||
|
||
@ApiModelProperty(example = "1") | ||
@ApiParam(value = "유저 ID", required = true) | ||
private Long userId; | ||
|
||
@ApiModelProperty(example = "1") | ||
@ApiParam(value = "BoardImage ID", required = true) | ||
private Long boardImageId; | ||
} |
40 changes: 40 additions & 0 deletions
40
server/src/main/java/com/yogit/server/board/dto/request/boardimage/DeleteBoardImageRes.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,40 @@ | ||
package com.yogit.server.board.dto.request.boardimage; | ||
|
||
import com.yogit.server.board.entity.BoardImage; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import io.swagger.annotations.ApiParam; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
public class DeleteBoardImageRes { | ||
|
||
@ApiModelProperty(example = "1") | ||
@ApiParam(value = "게시글 이미지 id") | ||
private Long boardImageId; | ||
|
||
@ApiModelProperty(example = "1") | ||
@ApiParam(value = "게시글 id") | ||
private Long boardId; | ||
|
||
@ApiModelProperty(example = "예제 넣을 예정") | ||
@ApiParam(value = "게시글 이미지 url") | ||
private String imgUrl; | ||
|
||
@Builder | ||
public DeleteBoardImageRes(Long boardImageId, Long boardId, String imgUrl) { | ||
this.boardImageId = boardImageId; | ||
this.boardId = boardId; | ||
this.imgUrl = imgUrl; | ||
} | ||
|
||
public static DeleteBoardImageRes toDto(BoardImage boardImage, String imgUrl) { | ||
return DeleteBoardImageRes.builder() | ||
.boardImageId(boardImage.getId()) | ||
.boardId(boardImage.getBoard().getId()) | ||
.imgUrl(imgUrl) | ||
.build(); | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
server/src/main/java/com/yogit/server/board/exception/boardimage/BoardImageExcepionList.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.yogit.server.board.exception.boardimage; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
|
||
import static org.springframework.http.HttpStatus.NOT_FOUND; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum BoardImageExcepionList { | ||
|
||
NOT_FOUND_BOARDIMAGE("BI0001", NOT_FOUND,"존재하지 않는 BoardImage아이디입니다."); | ||
|
||
private final String CODE; | ||
private final HttpStatus HTTPSTATUS; | ||
private final String MESSAGE; | ||
} |
11 changes: 11 additions & 0 deletions
11
server/src/main/java/com/yogit/server/board/exception/boardimage/BoardImageExeption.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.yogit.server.board.exception.boardimage; | ||
|
||
import com.yogit.server.global.exception.ApplicationException; | ||
import org.springframework.http.HttpStatus; | ||
|
||
public class BoardImageExeption extends ApplicationException { | ||
|
||
protected BoardImageExeption (String errorCode, HttpStatus httpStatus, String message) { | ||
super(errorCode, httpStatus, message); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...rc/main/java/com/yogit/server/board/exception/boardimage/NotFoundBoardImageException.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,8 @@ | ||
package com.yogit.server.board.exception.boardimage; | ||
|
||
public class NotFoundBoardImageException extends BoardImageExeption{ | ||
|
||
public NotFoundBoardImageException(){ | ||
super(BoardImageExcepionList.NOT_FOUND_BOARDIMAGE.getCODE(), BoardImageExcepionList.NOT_FOUND_BOARDIMAGE.getHTTPSTATUS(), BoardImageExcepionList.NOT_FOUND_BOARDIMAGE.getMESSAGE()); | ||
} | ||
} |
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