-
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.
Merge pull request #38 from Domitory-CheckMate/feature/37-post
[feat] 게시글 수정 및 상태 변경
- Loading branch information
Showing
9 changed files
with
160 additions
and
4 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
9 changes: 9 additions & 0 deletions
9
src/main/java/org/gachon/checkmate/domain/post/dto/request/PostStateUpdateRequestDto.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,9 @@ | ||
package org.gachon.checkmate.domain.post.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import org.gachon.checkmate.domain.post.entity.PostState; | ||
|
||
public record PostStateUpdateRequestDto( | ||
@NotNull(message = "게시글 상태를 입력해주세요") PostState postState | ||
) { | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/org/gachon/checkmate/domain/post/dto/request/PostUpdateRequestDto.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,21 @@ | ||
package org.gachon.checkmate.domain.post.dto.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import org.gachon.checkmate.domain.checkList.dto.request.CheckListRequestDto; | ||
import org.gachon.checkmate.domain.post.entity.ImportantKeyType; | ||
import org.gachon.checkmate.domain.post.entity.RoomType; | ||
import org.gachon.checkmate.domain.post.entity.SimilarityKeyType; | ||
|
||
import java.time.LocalDate; | ||
|
||
public record PostUpdateRequestDto( | ||
@NotBlank(message = "제목을 입력해주세요") String title, | ||
@NotBlank(message = "내용을 입력해주세요") String content, | ||
@NotNull(message = "중요 키워드를 입력해주세요") ImportantKeyType importantKey, | ||
@NotNull(message = "유사도를 입력해주세요") SimilarityKeyType similarityKey, | ||
@NotNull(message = "기숙사 유형을 입력해주세요") RoomType roomType, | ||
@NotNull(message = "모집 마감기간을 입력해주세요") LocalDate endDate, | ||
@NotNull(message = "체크리스트를 입력해주세요") CheckListRequestDto checkList | ||
) { | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/gachon/checkmate/domain/post/dto/response/PostStateUpdateResponseDto.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,17 @@ | ||
package org.gachon.checkmate.domain.post.dto.response; | ||
|
||
import lombok.Builder; | ||
import org.gachon.checkmate.domain.post.entity.Post; | ||
|
||
@Builder | ||
public record PostStateUpdateResponseDto ( | ||
Long postId, | ||
String postState | ||
) { | ||
public static PostStateUpdateResponseDto of(Post post) { | ||
return PostStateUpdateResponseDto.builder() | ||
.postId(post.getId()) | ||
.postState(post.getPostState().getDesc()) | ||
.build(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/org/gachon/checkmate/domain/post/dto/response/PostUpdateResponseDto.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,32 @@ | ||
package org.gachon.checkmate.domain.post.dto.response; | ||
|
||
import lombok.Builder; | ||
import org.gachon.checkmate.domain.checkList.dto.response.CheckListResponseDto; | ||
import org.gachon.checkmate.domain.post.entity.Post; | ||
|
||
import java.time.LocalDate; | ||
|
||
@Builder | ||
public record PostUpdateResponseDto( | ||
Long postId, | ||
String title, | ||
String content, | ||
String importantKey, | ||
String similarityKey, | ||
String roomType, | ||
LocalDate endDate, | ||
CheckListResponseDto checkList | ||
) { | ||
public static PostUpdateResponseDto of(Post post, CheckListResponseDto checkListResponseDto) { | ||
return PostUpdateResponseDto.builder() | ||
.postId(post.getId()) | ||
.title(post.getTitle()) | ||
.content(post.getContent()) | ||
.importantKey(post.getImportantKeyType().getDesc()) | ||
.similarityKey(post.getSimilarityKeyType().getDesc()) | ||
.roomType(post.getRoomType().getDesc()) | ||
.checkList(checkListResponseDto) | ||
.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
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