Skip to content

Commit

Permalink
Refactor :: 캐시 매니저 제거 및 grade 타입 변경
Browse files Browse the repository at this point in the history
캐시 매니저 설정을 제거하고 Schedule의 grade 타입을 Set에서 List로 변경했습니다. 이를 통해 코드의 일관성을 유지하고 오버헤드를 줄이려는 목적이 있습니다. Mapper에서도 대응하는 변환 로직을 수정했습니다.
  • Loading branch information
yeseong0412 committed Nov 26, 2024
1 parent 8f2c492 commit 980f9e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ScheduleMapper : Mapper<Schedule, ScheduleEntity> {
date = entity.date,
eventName = entity.eventName,
eventContent = entity.eventContent,
grade = entity.grade
grade = entity.grade.toList()
)
}

Expand All @@ -27,7 +27,7 @@ class ScheduleMapper : Mapper<Schedule, ScheduleEntity> {
date = domain.date!!,
eventName = domain.eventName ?: "",
eventContent = domain.eventContent ?: "",
grade = domain.grade ?: emptySet()
grade = domain.grade?.toSet() ?: emptySet()
)
}

Expand All @@ -47,7 +47,7 @@ class ScheduleMapper : Mapper<Schedule, ScheduleEntity> {
date = SchoolDateConvertor.dateFormat(scheduleRow.aaYmd),
eventName = scheduleRow.eventNm,
eventContent = scheduleRow.eventCntnt,
grade = grade
grade = grade.toList()
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ data class Schedule(
val date: String? = null,
val eventName: String? = null,
val eventContent: String? = null,
val grade: Set<Int>? = null,
val grade: List<Int>? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ 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<Schedule> {
return if (!scheduleRepository.existsByWorkspaceId(workspaceId)) resetSchedule(workspaceId, userId)
else scheduleRepository.findByWorkspaceId(workspaceId).map { scheduleMapper.toDomain(it) }

}

@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<Schedule> {
return if (!scheduleRepository.existsByWorkspaceId(workspaceId)) {
resetSchedule(workspaceId, userId).filter { sc ->
Expand Down

0 comments on commit 980f9e3

Please sign in to comment.