Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Donggrina/Backend into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
hyunzxn committed Jun 21, 2024
2 parents 86c5fac + d2ed4a7 commit 3f89187
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package com.codeit.donggrina.domain.diary.dto.request;

import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.List;

public record DiarySearchRequest(
@NotNull(message = "날짜를 입력해주세요")
LocalDate date,
List<Long> petIds,
List<String> authors,
String keyword
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public List<Diary> searchDiaries(DiarySearchRequest request, Group group) {
.leftJoin(pet.profileImage).fetchJoin()
.where(
eqGroup(group),
eqDate(request.date()),
eqAuthor(request.authors()),
eqPet(request.petIds()),
eqKeyword(request.keyword())
Expand All @@ -58,10 +57,6 @@ private BooleanExpression eqGroup(Group group) {
return diary.group.eq(group);
}

private BooleanExpression eqDate(LocalDate date) {
return diary.date.eq(date);
}

private BooleanBuilder eqAuthor(List<String> authors) {
if (authors == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void updateDiary(Long diaryId, DiaryUpdateRequest diaryUpdateRequest, Lon
)
.toList();

List<DiaryImage> images = new ArrayList<>();
List<DiaryImage> images = targetDiary.getDiaryImages();
if (diaryUpdateRequest.images() != null) {
images = diaryUpdateRequest.images().stream()
.map((imageId) ->
Expand Down Expand Up @@ -195,6 +195,7 @@ public DiaryFindResponse findDiary(Long diaryId, Long memberId) {

List<String> contentImages = foundDiary.getDiaryImages().stream()
.map(DiaryImage::getUrl)
.distinct()
.toList();

Optional<Heart> favoriteOptional = heartRepository.findByMemberIdAndDiary(memberId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public StoryFindResponse findStory(Long diaryId, Long memberId) {

List<String> petImages = foundStory.getDiaryPets().stream()
.map(diaryPet -> diaryPet.getPet().getProfileImage().getUrl())
.sorted()
.toList();

Member author = foundStory.getMember();
Expand Down Expand Up @@ -158,6 +159,7 @@ public StoryFindListPage findStories(Long memberId, Pageable pageable) {

List<String> petImages = diary.getDiaryPets().stream()
.map(diaryPet -> diaryPet.getPet().getProfileImage().getUrl())
.sorted()
.toList();

Member author = diary.getMember();
Expand Down

0 comments on commit 3f89187

Please sign in to comment.