Skip to content

Commit

Permalink
Merge pull request #81 from DEPthes/develop
Browse files Browse the repository at this point in the history
[DEPLOY]
  • Loading branch information
jisujeong0 authored Aug 21, 2024
2 parents 0d57ae4 + 6d92c31 commit fd5f5eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
public class PublishBoardRes {

private String message; // 성공 메세지
private boolean firstPost;
private boolean firstPost; // 첫번째 게시글 여부
private boolean todayTheme; // 현재 주제 여부


@Builder
public PublishBoardRes(String message, boolean firstPost){
public PublishBoardRes(String message, boolean firstPost, boolean todayTheme){
this.message = message;
this.firstPost = firstPost;
this.todayTheme = todayTheme;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public ResponseEntity<?> publishBoard(CustomUserDetails userDetails, PublishReq
User user = validateUser(userDetails);
Theme theme = validateTheme(request.getThemeId());

boolean isFirstPost = false;
boolean isTodayTheme = false;

Board board;
if (request.getBoardId() != null) {
// 임시저장된 게시물을 게시할 경우 특정 게시물을 찾고 업데이트
Expand All @@ -96,7 +99,6 @@ public ResponseEntity<?> publishBoard(CustomUserDetails userDetails, PublishReq

boardRepository.save(board);

boolean isFirstPost = false;
// 게시 시 첫 게시글 작성 보너스를 부여
if (!user.isCompleteFirstPost()) {
isFirstPost = true;
Expand All @@ -111,6 +113,7 @@ public ResponseEntity<?> publishBoard(CustomUserDetails userDetails, PublishReq
LocalDate themeDate = theme.getDate();

if(themeDate.isEqual(today)){
isTodayTheme = true;
user.addPoint(3);
// 포인트 내역 저장
savePointHistory(user, 3);
Expand All @@ -124,6 +127,7 @@ public ResponseEntity<?> publishBoard(CustomUserDetails userDetails, PublishReq
PublishBoardRes publishBoardRes = PublishBoardRes.builder()
.message("게시글이 작성되었습니다.")
.firstPost(isFirstPost)
.todayTheme(isTodayTheme)
.build();

ApiResponse apiResponse = ApiResponse.builder()
Expand Down

0 comments on commit fd5f5eb

Please sign in to comment.