From 7a4803589840d9eb33e98c994b8fca588d060fe4 Mon Sep 17 00:00:00 2001 From: 05AM Date: Thu, 22 Feb 2024 02:23:38 +0900 Subject: [PATCH] =?UTF-8?q?#156=20[REFACTOR]=20=EC=BB=A4=EC=8A=A4=ED=85=80?= =?UTF-8?q?=20=EB=8F=84=EC=95=88,=20=EC=BB=A4=EC=8A=A4=ED=85=80=20?= =?UTF-8?q?=EC=9E=84=EC=8B=9C=20=EB=8F=84=EC=95=88=20=EC=A0=95=EB=A0=AC=20?= =?UTF-8?q?=EC=88=9C=EC=84=9C=20=EB=B3=80=EA=B2=BD:=20=EC=B5=9C=EA=B7=BC?= =?UTF-8?q?=20=EB=93=B1=EB=A1=9D=EC=88=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/custom/provider/impl/CustomProviderImpl.java | 4 ++-- .../custom/repository/custom/CustomRepositoryCustom.java | 4 ++-- .../domain/custom/repository/impl/CustomRepositoryImpl.java | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/org/tattour/server/domain/custom/provider/impl/CustomProviderImpl.java b/server/src/main/java/org/tattour/server/domain/custom/provider/impl/CustomProviderImpl.java index 76009b2..0c2ab81 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/provider/impl/CustomProviderImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/provider/impl/CustomProviderImpl.java @@ -41,11 +41,11 @@ public List getCustomByUserIdAfterDate(int userId, String date) { @Override public List getAllByUserIdAndIsCompleted(Integer userId) { - return customRepository.findAllByUserIdAndIsCompleted(userId); + return customRepository.findAllByUserIdAndIsCompletedOrderByLastUpdatedAt(userId); } @Override public List getAllByUserIdAndIsCompletedFalse(Integer userId) { - return customRepository.findAllByUserIdAndIsCompletedFalse(userId); + return customRepository.findAllByUserIdAndIsCompletedFalseOrderByLastUpdatedAt(userId); } } diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/custom/CustomRepositoryCustom.java b/server/src/main/java/org/tattour/server/domain/custom/repository/custom/CustomRepositoryCustom.java index 94a8f34..e036ba5 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/custom/CustomRepositoryCustom.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/custom/CustomRepositoryCustom.java @@ -5,7 +5,7 @@ public interface CustomRepositoryCustom { - List findAllByUserIdAndIsCompleted(Integer userId); + List findAllByUserIdAndIsCompletedOrderByLastUpdatedAt(Integer userId); - List findAllByUserIdAndIsCompletedFalse(Integer userId); + List findAllByUserIdAndIsCompletedFalseOrderByLastUpdatedAt(Integer userId); } diff --git a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java index 17d6ab8..1460c4c 100644 --- a/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java +++ b/server/src/main/java/org/tattour/server/domain/custom/repository/impl/CustomRepositoryImpl.java @@ -14,20 +14,22 @@ public class CustomRepositoryImpl implements CustomRepositoryCustom { private final JPAQueryFactory queryFactory; @Override - public List findAllByUserIdAndIsCompleted(Integer userId) { + public List findAllByUserIdAndIsCompletedOrderByLastUpdatedAt(Integer userId) { return queryFactory .select(custom) .from(custom) .where(custom.user.id.eq(userId), custom.isCompleted.eq(true)) + .orderBy(custom.lastUpdatedAt.desc()) .fetch(); } @Override - public List findAllByUserIdAndIsCompletedFalse(Integer userId) { + public List findAllByUserIdAndIsCompletedFalseOrderByLastUpdatedAt(Integer userId) { return queryFactory .select(custom) .from(custom) .where(custom.user.id.eq(userId), custom.isCompleted.eq(false)) + .orderBy(custom.lastUpdatedAt.desc()) .fetch(); } }