From 980f9e38f9f47ce14bedd27a399730556493af83 Mon Sep 17 00:00:00 2001 From: yeseong0412 Date: Tue, 26 Nov 2024 11:15:49 +0900 Subject: [PATCH] =?UTF-8?q?Refactor=20::=20=EC=BA=90=EC=8B=9C=20=EB=A7=A4?= =?UTF-8?q?=EB=8B=88=EC=A0=80=20=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20grade=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 캐시 매니저 설정을 제거하고 Schedule의 grade 타입을 Set에서 List로 변경했습니다. 이를 통해 코드의 일관성을 유지하고 오버헤드를 줄이려는 목적이 있습니다. Mapper에서도 대응하는 변환 로직을 수정했습니다. --- .../api/domain/schedule/domain/mapper/ScheduleMapper.kt | 6 +++--- .../com/seugi/api/domain/schedule/domain/model/Schedule.kt | 2 +- .../api/domain/schedule/service/ScheduleServiceImpl.kt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/seugi/api/domain/schedule/domain/mapper/ScheduleMapper.kt b/src/main/kotlin/com/seugi/api/domain/schedule/domain/mapper/ScheduleMapper.kt index e004c9148..e76412daa 100644 --- a/src/main/kotlin/com/seugi/api/domain/schedule/domain/mapper/ScheduleMapper.kt +++ b/src/main/kotlin/com/seugi/api/domain/schedule/domain/mapper/ScheduleMapper.kt @@ -17,7 +17,7 @@ class ScheduleMapper : Mapper { date = entity.date, eventName = entity.eventName, eventContent = entity.eventContent, - grade = entity.grade + grade = entity.grade.toList() ) } @@ -27,7 +27,7 @@ class ScheduleMapper : Mapper { date = domain.date!!, eventName = domain.eventName ?: "", eventContent = domain.eventContent ?: "", - grade = domain.grade ?: emptySet() + grade = domain.grade?.toSet() ?: emptySet() ) } @@ -47,7 +47,7 @@ class ScheduleMapper : Mapper { date = SchoolDateConvertor.dateFormat(scheduleRow.aaYmd), eventName = scheduleRow.eventNm, eventContent = scheduleRow.eventCntnt, - grade = grade + grade = grade.toList() ) } } diff --git a/src/main/kotlin/com/seugi/api/domain/schedule/domain/model/Schedule.kt b/src/main/kotlin/com/seugi/api/domain/schedule/domain/model/Schedule.kt index 10eb347ec..a16a2feca 100644 --- a/src/main/kotlin/com/seugi/api/domain/schedule/domain/model/Schedule.kt +++ b/src/main/kotlin/com/seugi/api/domain/schedule/domain/model/Schedule.kt @@ -6,5 +6,5 @@ data class Schedule( val date: String? = null, val eventName: String? = null, val eventContent: String? = null, - val grade: Set? = null, + val grade: List? = null, ) \ No newline at end of file diff --git a/src/main/kotlin/com/seugi/api/domain/schedule/service/ScheduleServiceImpl.kt b/src/main/kotlin/com/seugi/api/domain/schedule/service/ScheduleServiceImpl.kt index 3abb42322..932fd68cf 100644 --- a/src/main/kotlin/com/seugi/api/domain/schedule/service/ScheduleServiceImpl.kt +++ b/src/main/kotlin/com/seugi/api/domain/schedule/service/ScheduleServiceImpl.kt @@ -49,7 +49,7 @@ class ScheduleServiceImpl( } @Transactional(readOnly = true) - @Cacheable(value = ["schedules"] , key = "#workspaceId", cacheManager = "contentCacheManager") + @Cacheable(value = ["schedules"] , key = "#workspaceId") override fun getSchoolSchedules(userId: Long, workspaceId: String): List { return if (!scheduleRepository.existsByWorkspaceId(workspaceId)) resetSchedule(workspaceId, userId) else scheduleRepository.findByWorkspaceId(workspaceId).map { scheduleMapper.toDomain(it) } @@ -57,7 +57,7 @@ class ScheduleServiceImpl( } @Transactional(readOnly = true) - @Cacheable(value = ["schedules"] , key = "#workspaceId", cacheManager = "contentCacheManager") + @Cacheable(value = ["schedules"] , key = "#workspaceId") override fun getMonthSchoolSchedules(userId: Long, workspaceId: String, month: Int): List { return if (!scheduleRepository.existsByWorkspaceId(workspaceId)) { resetSchedule(workspaceId, userId).filter { sc ->