-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
5 changed files
with
95 additions
and
49 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/main/java/aromanticcat/umcproject/controller/NangmanLetterController.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,36 @@ | ||
package aromanticcat.umcproject.controller; | ||
|
||
import aromanticcat.umcproject.apiPayload.ApiResponse; | ||
import aromanticcat.umcproject.dto.NangmanLetterDTO; | ||
import aromanticcat.umcproject.service.NangmanLetterService; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/nangman-post") | ||
@RequiredArgsConstructor | ||
public class NangmanLetterController { | ||
|
||
private final NangmanLetterService nangmanLetterService; | ||
|
||
@PostMapping("/send") | ||
@ApiOperation(value = "낭만 우편함 편지 등록") | ||
public ApiResponse<NangmanLetterDTO> send(@RequestBody NangmanLetterDTO nangmanLetterDTO){ | ||
try{ | ||
//낭만 우편함 편지 작성 및 응답 DTO 변환 | ||
NangmanLetterDTO responseDTO = nangmanLetterService.register(nangmanLetterDTO); | ||
|
||
//전송 성공 응답 반환 | ||
return ApiResponse.onSuccess(responseDTO); | ||
|
||
}catch (Exception e){ | ||
//에러 발생 시 실패 응답 반환 | ||
return ApiResponse.onFailure(HttpStatus.INTERNAL_SERVER_ERROR.toString(), e.getMessage(), null); | ||
} | ||
} | ||
} |
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
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