Skip to content

Commit

Permalink
Merge pull request #77 from Modagbul/feat/mission-closing
Browse files Browse the repository at this point in the history
Feat/mission closing
  • Loading branch information
seungueonn authored Nov 17, 2023
2 parents 88e3a4a + 89040f3 commit 2c2d0e5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ public static MissionArchiveRes mapToMissionArchiveRes(MissionArchive missionArc
missionHeart -> missionHeart.getPushMemberId().equals(memberId) &&
missionHeart.getHeartStatus().equals(MissionHeartStatus.True)
)))
.hearts(missionArchive.getHeartList().stream().filter(
missionHeart -> missionHeart.getHeartStatus().equals(MissionHeartStatus.True)
).count())
.hearts(missionArchive.getHeartList().stream()
.filter(heart -> heart.getHeartStatus().equals( MissionHeartStatus.True))
.filter(heart -> heart.getMissionArchive().equals( missionArchive))// heartStatus가 true인 요소만 필터링
.count())
.build();
}

Expand All @@ -72,7 +73,10 @@ public static PersonalArchiveRes mapToPersonalArchive(MissionArchive missionArch
.heartStatus(
String.valueOf(missionArchive.getHeartList().stream().anyMatch(
missionHeart -> missionHeart.getPushMemberId().equals(memberId))))
.hearts(missionArchive.getHeartList().size())
.hearts((int) missionArchive.getHeartList().stream()
.filter(heart -> heart.getHeartStatus().equals( MissionHeartStatus.True))
.filter(heart -> heart.getMissionArchive().equals( missionArchive))// heartStatus가 true인 요소만 필터링
.count())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ public static MissionHeartRes mapToMissionHeartRes(MissionHeart missionHeart) {
return MissionHeartRes.builder()
.missionArchiveId(missionHeart.getMissionArchive().getId())
.missionHeartStatus(missionHeart.getHeartStatus().name())
.hearts(missionHeart.getMissionArchive().getHeartList().size())
.hearts((int) missionHeart.getMissionArchive().getHeartList().stream()
.filter(heart -> heart.getHeartStatus().equals( MissionHeartStatus.True))
.filter(heart -> heart.getId().equals( missionHeart.getId()))// heartStatus가 true인 요소만 필터링
.count())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.moing.backend.domain.missionHeart.domain.repository;

import com.moing.backend.domain.missionHeart.application.dto.MissionHeartRes;
import com.moing.backend.domain.missionHeart.domain.entity.MissionHeart;
import com.moing.backend.domain.missionHeart.domain.entity.QMissionHeart;
import com.querydsl.core.types.Projections;
import com.querydsl.jpa.impl.JPAQueryFactory;

import javax.persistence.EntityManager;
Expand Down Expand Up @@ -38,5 +40,4 @@ public MissionHeart findByMemberIdAndArchiveId(Long memberId, Long archiveId) {

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public MissionHeart update(MissionHeart missionHeart) {

MissionHeart updateHeart = missionHeartRepository.findByMemberIdAndArchiveId(missionHeart.getPushMemberId(), missionHeart.getMissionArchive().getId());
updateHeart.updateHeartStatus(missionHeart.getHeartStatus());
updateHeart.changeByHeart(missionHeart.getMissionArchive());
return updateHeart;
// updateHeart.changeByHeart(missionHeart.getMissionArchive());

return missionHeartRepository.save(updateHeart);

}

Expand Down

0 comments on commit 2c2d0e5

Please sign in to comment.