-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
단일 ToDo 수정 API 구현 #59
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
51 changes: 51 additions & 0 deletions
51
src/main/java/com/official/memento/todo/controller/dto/ToDoUpdateRequest.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,51 @@ | ||
package com.official.memento.todo.controller.dto; | ||
|
||
import com.official.memento.global.entity.enums.RepeatOption; | ||
import com.official.memento.global.exception.NullPointException; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
import java.time.LocalDate; | ||
|
||
import static com.official.memento.global.exception.ErrorCode.NULL_DATA_ERROR; | ||
|
||
@Schema(name = " ToDo 수정 요청") | ||
public record ToDoUpdateRequest( | ||
@Schema(description = "수정 ToDo 날짜 (Today or 사용자 지정)", example = "2025-01-20") | ||
LocalDate date, | ||
@Schema(description = "수정 ToDo 내용", maxLength = 30, example = "팀 프로젝트 준비") | ||
String description, | ||
@Schema(description = "수정 마감 기한", example = "2025-01-25") | ||
LocalDate deadline, | ||
@Schema(description = "수정 태그 ID", example = "12345") | ||
Long tagId, | ||
@Schema(description = "수정 긴급도 우선순위 (0~1)", example = "0.5") | ||
Double priorityUrgency, | ||
@Schema(description = "수정 중요도 우선순위 (0~1)", example = "0.5") | ||
Double priorityImportance | ||
) { | ||
public ToDoUpdateRequest of( | ||
final LocalDate date, | ||
final String description, | ||
final LocalDate deadline, | ||
final Long tagId, | ||
final Double priorityUrgency, | ||
final Double priorityImportance | ||
) { | ||
checkNullData(date, description); | ||
|
||
if (description.length() > 30) { | ||
throw new IllegalArgumentException("30자 이하로만 작성이 가능합니다."); | ||
} | ||
|
||
return new ToDoUpdateRequest(date, description, deadline, tagId, priorityUrgency, priorityImportance); | ||
} | ||
|
||
private static void checkNullData( | ||
final LocalDate date, | ||
final String description | ||
) { | ||
if (date == null || description == null) { | ||
throw new NullPointException(NULL_DATA_ERROR); | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
서비스에서 업데이트 되어 어댑터로 전달되었으니 추가적인 업데이트는 없어도 될 듯 합니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
최종적으로 엔티티도 업데이트 된 값들이 저장 되어야 된다고 생각해서 엔티티 수정하는 로직을 추가했습니다!