From b29805f5966e5a480c56735c8a4875e979f8437f Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Tue, 4 Jun 2024 18:29:25 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[Fix]=20#286=20-=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84=20=EC=A0=95=EA=B7=9C=ED=91=9C=ED=98=84=EC=8B=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/moonshot/constants/RegexConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moonshot-common/src/main/java/org/moonshot/constants/RegexConstants.java b/moonshot-common/src/main/java/org/moonshot/constants/RegexConstants.java index b1c5056a..fad49d34 100644 --- a/moonshot-common/src/main/java/org/moonshot/constants/RegexConstants.java +++ b/moonshot-common/src/main/java/org/moonshot/constants/RegexConstants.java @@ -1,5 +1,5 @@ package org.moonshot.constants; public class RegexConstants { - public static final String nicknameRegex = "^[a-zA-Z0-9가-힣]{1,7}$"; + public static final String nicknameRegex = "^[a-zA-Z0-9ㄱ-ㅎㅏ-ㅣ가-힣]{1,7}$"; } From c15c585351dea2e33fb5005fb376eaaf7d224837 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Tue, 4 Jun 2024 19:14:28 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[Fix]=20#286=20-=20=EC=86=8C=EC=85=9C=20API?= =?UTF-8?q?=20=EC=BF=BC=EB=A6=AC=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moonshot/objective/service/ObjectiveService.java | 7 ++++--- .../repository/ObjectiveCustomRepositoryImpl.java | 12 +++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/moonshot-api/src/main/java/org/moonshot/objective/service/ObjectiveService.java b/moonshot-api/src/main/java/org/moonshot/objective/service/ObjectiveService.java index 86536eb1..ff9acadf 100644 --- a/moonshot-api/src/main/java/org/moonshot/objective/service/ObjectiveService.java +++ b/moonshot-api/src/main/java/org/moonshot/objective/service/ObjectiveService.java @@ -11,9 +11,7 @@ import static org.moonshot.validator.IndexValidator.isSameIndex; import java.time.LocalDate; -import java.util.Comparator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.moonshot.common.model.Period; @@ -144,7 +142,10 @@ public HistoryResponseDto getObjectiveHistory(final Long userId, final Integer y @Transactional(readOnly = true) public List getObjectiveSocial() { List objectives = objectiveRepository.findSocialObjectives(); + Set objectiveIds = new LinkedHashSet<>(); + return objectives.stream() + .filter(objective -> objectiveIds.add(objective.getId())) .map(SocialOKRResponseDto::of) .toList(); } diff --git a/moonshot-domain/src/main/java/org/moonshot/objective/repository/ObjectiveCustomRepositoryImpl.java b/moonshot-domain/src/main/java/org/moonshot/objective/repository/ObjectiveCustomRepositoryImpl.java index 350884f8..d8a5996b 100644 --- a/moonshot-domain/src/main/java/org/moonshot/objective/repository/ObjectiveCustomRepositoryImpl.java +++ b/moonshot-domain/src/main/java/org/moonshot/objective/repository/ObjectiveCustomRepositoryImpl.java @@ -3,11 +3,17 @@ import static org.moonshot.keyresult.model.QKeyResult.keyResult; import static org.moonshot.objective.model.QObjective.objective; import static org.moonshot.task.model.QTask.task; +import static org.moonshot.user.model.QUser.user; import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.impl.JPAQueryFactory; + +import java.util.LinkedHashSet; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.hibernate.Hibernate; @@ -72,12 +78,12 @@ private OrderSpecifier order(Criteria criteria) { @Override public List findSocialObjectives() { - return queryFactory.selectFrom(objective).distinct() - .join(objective.user).fetchJoin() + return queryFactory.selectFrom(objective) + .join(objective.user, user).fetchJoin() .leftJoin(objective.keyResultList, keyResult).fetchJoin() .leftJoin(keyResult.taskList, task) .where(objective.isPublic.eq(true)) - .orderBy(objective.heartCount.desc(), objective.id.desc(), keyResult.idx.asc(), task.id.asc()) + .orderBy(objective.heartCount.desc(), objective.id.desc(), keyResult.idx.asc(), task.idx.asc()) .limit(10) .fetch(); }