Skip to content

Commit

Permalink
Merge pull request #125 from Mojacknong/fix_124/채소-리스트
Browse files Browse the repository at this point in the history
Fix 124/채소 리스트
  • Loading branch information
Ryeolee authored Sep 14, 2024
2 parents f376ec6 + 1c64182 commit d4f8a38
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ dependencies {
// 유효성 검사
implementation 'org.springframework.boot:spring-boot-starter-validation'

implementation 'net.bytebuddy:byte-buddy:1.14.4'

}

tasks.named('bootBuildImage') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import java.util.List;


@AllArgsConstructor
@Getter
public class SelectMyVeggieListDto {

public static List<SelectMyVeggieListResponse> processData(List<MyVeggie> myVeggieList){
return myVeggieList.stream()
.map(myVeggie -> SelectMyVeggieListResponse.of(myVeggie.getId(),myVeggie.getNickname()))
.toList();
}
}
//@AllArgsConstructor
//@Getter
//public class SelectMyVeggieListDto {
//
// public static List<SelectMyVeggieListResponse> processData(List<MyVeggie> myVeggieList){
// return myVeggieList.stream()
// .map(myVeggie -> SelectMyVeggieListResponse.of(myVeggie.getId(),myVeggie.getNickname()))
// .toList();
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class SelectMyVeggieListResponse {
// List<SelectMyVeggieListDto> simpleMyVeggieList;
public Long myVeggieId;
public String nickname;
public int userFarmClubId;


}
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,18 @@ public BaseResponseDto<?> settingMyVeggie(Long userId, SettingMyVeggieRequest se
@Transactional
public BaseResponseDto<List<SelectMyVeggieListResponse>> selectMyVeggieList(Long userId) {
List<MyVeggie> myVeggieList = bringMyVeggieData(userId);
List<SelectMyVeggieListResponse> selectMyVeggieLists = SelectMyVeggieListDto.processData(myVeggieList);
List<SelectMyVeggieListResponse> selectMyVeggieLists = processSimpleVeggieData(myVeggieList);
return BaseResponseDto.of(SuccessCode.SUCCESS,selectMyVeggieLists);
}

public List<SelectMyVeggieListResponse> processSimpleVeggieData(List<MyVeggie> myVeggieList){
return myVeggieList.stream()
.map(myVeggie -> SelectMyVeggieListResponse.of(myVeggie.getId(),myVeggie.getNickname(), checkFarmClubAffiliation(myVeggie)))
.toList();
}



@Transactional
public BaseResponseDto<Void> deleteMyVeggie(DeleteMyVeggieRequest deleteMyVeggieRequest) {
deleteMyVeggieById((deleteMyVeggieRequest.getMyVeggieId()));
Expand All @@ -83,7 +91,6 @@ public BaseResponseDto<SelectMyVeggieProfileResponse> selectMyVeggieProfile(Long

@Transactional
public BaseResponseDto<List<MyDetailMyVeggie>> selectDetailMyVeggieList(Long userId) {

List<MyVeggie> myVeggieList = bringMyVeggieData(userId);
List<MyDetailMyVeggie> selectMyVeggieList = myDetailMyVeggieDto.processData(myVeggieList);
return BaseResponseDto.of(SuccessCode.SUCCESS,selectMyVeggieList);
Expand Down

0 comments on commit d4f8a38

Please sign in to comment.