-
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
Feature 11/240408회의 api 개발 및 엔티티 수정 #13
Merged
The head ref may contain hidden characters: "feature_11/240408\uD68C\uC758-api-\uAC1C\uBC1C-\uBC0F-\uC5D4\uD2F0\uD2F0-\uC218\uC815"
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9717560
[fix] 1. 내 채소 엔티티 수정(반정규화)
Ryeolee 23ca61f
[feat] 내 채소 삭제
Ryeolee 6317f6e
[feat] 메인페이지 팜클럽 프로필 조회 api 완료
Ryeolee 406b1fb
[feat] 내 채소 정보 리스트 조회 완료
Ryeolee 6774b5e
[fix] 응답 dto에 따른 함수 분리
Ryeolee b780d97
[feat] 메인 페이지 내 채소 루틴 조회 api
Ryeolee bce30c6
[feat] 내 채소 정보 수정 api
Ryeolee 85391d3
[feat] 내 채소별 루틴 조회 api
Ryeolee 8325e90
[feat] 내 채소 일기 개수 조회 api
Ryeolee c0c37ac
[feat] 내 채소의 모든 일기 api
Ryeolee 1624d57
[fix] response dto 메소드 static 적용
Ryeolee 7d50f41
[docs] pr 템플릿 추가
Ryeolee b7b1291
[fix] @Component 제거
Ryeolee 9192bea
[fix] dateform 함수 -> util패키지 이동
Ryeolee 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## #️⃣연관된 이슈 | ||
|
||
> ex) #이슈번호, #이슈번호 | ||
|
||
## 📝작업 내용 | ||
|
||
> 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능) | ||
|
||
### 스크린샷 (선택) | ||
|
||
## 💬리뷰 요구사항(선택) | ||
|
||
> 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요 | ||
> | ||
> ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요? |
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
4 changes: 0 additions & 4 deletions
4
src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/TestDto.java
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...om/modernfarmer/farmusspring/domain/myveggiegarden/dto/request/DeleteMyVeggieRequest.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,16 @@ | ||
package com.modernfarmer.farmusspring.domain.myveggiegarden.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class DeleteMyVeggieRequest { | ||
|
||
@NotNull(message = "null 값을 가지면 안됩니다.") | ||
private Long myVeggieId; | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
.../java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/request/MyVeggieUpdate.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,28 @@ | ||
package com.modernfarmer.farmusspring.domain.myveggiegarden.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.format.annotation.DateTimeFormat; | ||
|
||
import java.time.LocalDate; | ||
import java.util.Date; | ||
|
||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class MyVeggieUpdate { | ||
|
||
@NotNull(message = "null 값을 가지면 안됩니다.") | ||
private Long myVeggieId; | ||
|
||
|
||
@NotNull(message = "null 값을 가지면 안됩니다.") | ||
private String nickname; | ||
|
||
@NotNull(message = "null 값을 가지면 안됩니다.") | ||
private Date birth; | ||
|
||
} |
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
44 changes: 44 additions & 0 deletions
44
src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/AllDairy.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,44 @@ | ||
package com.modernfarmer.farmusspring.domain.myveggiegarden.dto.response; | ||
|
||
import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.Diary; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.List; | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
public class AllDairy { | ||
|
||
private String date; | ||
private String image; | ||
private String content; | ||
private Boolean isOpen; | ||
|
||
public static AllDairy of(Diary diary, String date){ | ||
return new AllDairy( | ||
date, | ||
diary.getImage(), | ||
diary.getContent(), | ||
diary.getIsOpen() | ||
); | ||
} | ||
|
||
public static List<AllDairy> processData(List<Diary> diaryList){ | ||
return diaryList.stream() | ||
.map(diary -> AllDairy.of(diary, formatDate(diary.getCreatedDate()))) | ||
.toList(); | ||
} | ||
public static String formatDate(LocalDateTime date) { | ||
|
||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy년 MM월 dd일"); | ||
String formattedDate = date.format(formatter); | ||
return formattedDate; | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
...va/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/MyDetailMyVeggie.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 com.modernfarmer.farmusspring.domain.myveggiegarden.dto.response; | ||
|
||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor(staticName = "of") | ||
@Getter | ||
public class MyDetailMyVeggie { | ||
|
||
String nickname; | ||
String image; | ||
String veggieName; | ||
String birthDay; | ||
int period; | ||
Long myVeggieId; | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
...com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/MyDetailMyVeggieDto.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,37 @@ | ||
package com.modernfarmer.farmusspring.domain.myveggiegarden.dto.response; | ||
|
||
import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.MyVeggie; | ||
import com.modernfarmer.farmusspring.domain.myveggiegarden.util.DateManager; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
|
||
@AllArgsConstructor | ||
@Getter | ||
@Component | ||
public class MyDetailMyVeggieDto { | ||
|
||
|
||
private final DateManager dateManager; | ||
|
||
public List<MyDetailMyVeggie> processData(List<MyVeggie> myVeggieList){ | ||
|
||
return myVeggieList.stream() | ||
.map(myVeggie -> MyDetailMyVeggie.of( | ||
myVeggie.getNickname(), | ||
myVeggie.getVeggieImage(), | ||
myVeggie.getVeggieName(), | ||
dateManager.dateParsing(myVeggie.getBirth()), | ||
dateManager.dayBetween(myVeggie.getBirth(), new Date()), | ||
myVeggie.getId() | ||
|
||
)).toList(); | ||
} | ||
|
||
} |
Oops, something went wrong.
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.
이 메서드는 AllDairy 클래스가 온전히 책임을 질 기능으로 보이지 않아요. 다른 도메인, 파일에서 쓰일 여지가 충분한 것 같으니 Common과 같은 곳에 Util(예시) 클래스를 만들어서 관리하면 좋을 듯 합니다 :)
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.
해당 도메인 util 패키지로 함수를 옮겼습닌다.