-
Notifications
You must be signed in to change notification settings - Fork 6
Week 3/seokyeong237 #12
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
Open
Seokyeong237
wants to merge
9
commits into
YAPP-Github:week-3/Seokyeong237
Choose a base branch
from
Seokyeong237:week-3/Seokyeong237
base: week-3/Seokyeong237
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
59c6f07
[Feat] apply JPA
Seokyeong237 2bd8d85
[Feat] create bulk Todo-list
Seokyeong237 1754721
[Test] bulk create Todo-list
Seokyeong237 df6c5b8
[Del] Unnecessary code
Seokyeong237 0418651
[Feat] cors config
Seokyeong237 a45f6ad
[Add] error handling if creating bulk todo fails
Seokyeong237 be0b45e
[Config] jacoco
Seokyeong237 fa03908
[Feat] connecting swagger
Seokyeong237 0330c37
[Feat] viewCount api
Seokyeong237 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 hidden or 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 hidden or 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 hidden or 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
44 changes: 28 additions & 16 deletions
44
src/main/java/site/yapp/study/todolist/api/todo/domain/Todo.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,48 +1,60 @@ | ||
| package site.yapp.study.todolist.api.todo.domain; | ||
|
|
||
| import jakarta.persistence.*; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import org.hibernate.annotations.ColumnDefault; | ||
| import org.springframework.data.jpa.repository.Lock; | ||
| import site.yapp.study.todolist.common.domain.BaseEntity; | ||
| import org.springframework.data.jpa.repository.Query; | ||
|
|
||
| import java.util.Date; | ||
| import java.time.LocalDateTime; | ||
|
|
||
| import static jakarta.persistence.GenerationType.IDENTITY; | ||
| import static lombok.AccessLevel.PROTECTED; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @NoArgsConstructor(access = PROTECTED) | ||
| public class Todo { | ||
| public class Todo extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = IDENTITY) | ||
| private Long id; | ||
|
|
||
| private String category; | ||
|
|
||
| private String content; | ||
|
|
||
| private Date created_at; | ||
| @Column(name = "is_deleted") | ||
| private LocalDateTime deletedAt; | ||
|
|
||
| private Date updated_at; | ||
| private boolean isCompleted; | ||
|
|
||
| private Date deleted_at; | ||
|
|
||
| private boolean is_completed; | ||
| @ColumnDefault("0") | ||
| private Integer viewCount = 0; | ||
|
|
||
| @Builder | ||
| public Todo(Long id, String category, String content, Date created_at, Date updated_at) { | ||
| this.id = id; | ||
| public Todo(String category, String content) { | ||
| this.category = category; | ||
| this.content = content; | ||
| this.created_at = created_at; | ||
| this.updated_at = updated_at; | ||
| this.deleted_at = null; | ||
| this.is_completed = false; | ||
| this.deletedAt = null; | ||
| this.isCompleted = false; | ||
| } | ||
|
|
||
| public void updateTodo(String category, String content) { | ||
| this.category= category; | ||
| this.category = category; | ||
| this.content = content; | ||
| } | ||
|
|
||
| public void toggleTodo(Boolean is_completed) { | ||
| this.is_completed = is_completed; | ||
| public void toggleTodo(Boolean isCompleted) { | ||
| this.isCompleted = isCompleted; | ||
| } | ||
|
|
||
| @Lock(LockModeType.PESSIMISTIC_WRITE) | ||
| @Query("UPDATE Todo t SET t.viewCount = t.viewCount + 1 WHERE t.id = :todoId") | ||
| public void updateViewCount() { | ||
| viewCount++; | ||
| } | ||
|
Comment on lines
+55
to
59
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Db์ ๋ฝ์ ๊ฑธ๋ช
๋ฐ์ํ๋ ๋ฌธ์ ๋? |
||
| } | ||
13 changes: 13 additions & 0 deletions
13
src/main/java/site/yapp/study/todolist/api/todo/dto/request/TodoBulkCreateRequestDto.java
This file contains hidden or 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,13 @@ | ||
| package site.yapp.study.todolist.api.todo.dto.request; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @NoArgsConstructor | ||
| @Getter | ||
| public class TodoBulkCreateRequestDto { | ||
|
|
||
| private List<TodoCreateRequestDto> todoList; | ||
| } |
13 changes: 11 additions & 2 deletions
13
src/main/java/site/yapp/study/todolist/api/todo/dto/request/TodoCreateRequestDto.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,13 +1,22 @@ | ||
| package site.yapp.study.todolist.api.todo.dto.request; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @AllArgsConstructor(staticName = "of") | ||
| import static lombok.AccessLevel.PROTECTED; | ||
|
|
||
| @NoArgsConstructor(access = PROTECTED) | ||
| @Getter | ||
| public class TodoCreateRequestDto { | ||
|
|
||
| private String category; | ||
|
|
||
| private String content; | ||
|
|
||
| @Builder | ||
| public TodoCreateRequestDto(String category, String content) { | ||
| this.category = category; | ||
| this.content = content; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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.
๋ฒ์ ์ ์์๋ก ๊ด๋ฆฌํ๋ฉด, ๋์ค์ ํธํด์,