-
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
[Merge] joonseo - #9 #12
base: main
Are you sure you want to change the base?
Conversation
@Schema(description = "ํฌ๋ ์กฐํ๋ฅผ ์์ฒญํ ์ ์ ์์ด๋", example = "1") | ||
@NotBlank @Email | ||
private Long userId; |
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.
Long ํ์์ด๋ผ @Email์ ์จ๋ ์ ์ฉ์ด ์๋ ๊ฑฐ์ผ.
annotationProcessor 'org.projectlombok:lombok' | ||
developmentOnly 'org.springframework.boot:spring-boot-devtools' |
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.
์ด๊ฒ ๋ญ์ผ?
@NotBlank @Email | ||
private Long userId; | ||
|
||
@DateTimeFormat(pattern = "yyyyMMdd") |
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.
์ ํจ์ฑ ๊ฒ์ฌ ์คํฐ๋๋ฅผ ์งํํ์ง ์์์ง๋ง, ์ฝ๋์์ ๋ค ํด๋จ๋๋ฐ, ์ด๋ถ๋ถ๋ง ๋น ์ ธ์์ด์์!
๋ง์ฝ ์ฌ๊ธฐ์ ์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ ํด์ผ ํ๋ค๋ฉด ์ด๋ค ์ด๋
ธํ
์ด์
์ ๋ฃ๋๊ฒ ์ ์ ํ ์ง ์๊ฐํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์!
private String description; | ||
|
||
@Schema(description = "๋ง๊ฐ์ผ", example = "YYYY-MM-DD") | ||
@NotBlank |
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.
LocalDateTime์ ์ ํจ์ฑ ๊ฒ์ฌํ ๋ @Not Blank๊ฐ ์ ๋๋ก ์ ์ฉ๋๋์ง ํ๋ฒ ๋ ์ฒดํฌํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์!
if(completed) | ||
this.completed = false; | ||
|
||
this.completed = true; |
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.
else ์์ด ์์ฑํ๋ฉด, ๋ชจ๋ ๊ฒ true ๋๋ ๊ฒ ๊ฐ์ต๋๋ค!
๋ํ, boolean ํํ๋ผ๋ฉด,
this.completed = !this.completed
๋ก ๋ํ๋ด๋ ๋ฉ๋๋ค!
contents/joonseo/todo/src/main/java/org/todo/todo/domain/todo/service/TodoService.java
Show resolved
Hide resolved
}) | ||
@DeleteMapping | ||
public ResponseEntity<ResponseDto<Boolean>> deleteTodo(@Valid@RequestBody TodoDeleteRequestDto request){ | ||
Boolean isSucceed = todoService.deleteTodo(request); |
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.
api ๋ช
์ธ์์์๋ ์ญ์ ์คํจ ์ 401๋ก ๋์ด์๋๋ฐ, ์ฌ๊ธฐ์ ๊ฒฐ๊ณผ ๊ฐ์ผ๋ก ๋ฐ์ ์ญ์ ์ฑ๊ณต ์ฌ๋ถ๋ ์ฌ์ฉํ์ง ์๊ณ ๊ทธ๋ฅ 200 ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํ๋ฉด ๊ฒฐ๊ณผ๋ฅผ ๋ฐ์ ํ์๊ฐ ์๋ ๊ฒ ์๋๊ฐ ์ถ๋ค์~
๊ทธ๋ฆฌ๊ณ ์ญ์ ๋ก์ง ์ค ์ค๋ฅ๊ฐ ์๊ธฐ๋ฉด 401์ ๋ฐํํ๋๋ก ํ๋ค๋ฉด, ๊ทธ ์ธ์ ์ด์ ๋ก ์ญ์ ๋ฅผ ์คํจํ ๊ฒฝ์ฐ์์ ์ญ์ ์ฑ๊ณต ์ฌ๋ถ๋ ์ฌ์ฉ์๊ฐ ์ ํ์๊ฐ ์์ง ์๋ ์ถ์ต๋๋ค.
@ApiResponse(responseCode = "401", description = "ํฌ๋ ๊ฐ์ ธ์ค๊ธฐ ์คํจ : ๊ถํ ์์") | ||
}) | ||
@GetMapping("/{userId}") | ||
public ResponseEntity<ResponseDto<List<TodoResponseDto>>> getAllTodo(@PathVariable Long userId){ |
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.
userId๋ Todo์ ๋ํ ์๋ณ์๊ฐ ์๋๊ธฐ ๋๋ฌธ์ PathVariable ์ฌ์ฉํ๋ ๊ฑด ์ ํฉํ์ง ์์ ๋ณด์ฌ์
.priority(todo.getPriority()) | ||
.completed(todo.getCompleted()) | ||
.build(); | ||
} |
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.
์ ์ ํฉํ ๋ฆฌ ๋ฉ์๋(from)์ ์ฌ์ฉ ์ค์ด๋๊น Builder์ ๋ํ ์ ๊ทผ ์ ์ด์๋ฅผ private์ด๋ protected๋ก ์ฌ์ฉํด๋ ๋ ๊ฒ ๊ฐ์์
๐ ์ด์ ๋ฒํธ
close #9
๐ ๊ตฌํ ์ฌํญ
๐ ๋ํผ๋ฐ์ค
https://mangkyu.tistory.com/223
https://mingyum119.tistory.com/308
https://www.youtube.com/watch?v=o5rspNdJ-fE
๋ฆ๊ฒ ์ฌ๋ ค์ ๋ฏธ์ํฉ๋๋ค.. ๐ฅฒ