Skip to content

Commit 28b9082

Browse files
committed
feat :: finder 삭제
1 parent a96c1fb commit 28b9082

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/main/kotlin/dsm/pick2024/domain/attendance/service/QueryClassAttendanceService.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import dsm.pick2024.domain.attendance.port.`in`.QueryClassAttendanceUseCase
77
import dsm.pick2024.domain.attendance.port.out.QueryAttendancePort
88
import dsm.pick2024.domain.attendance.presentation.dto.response.QueryAttendanceResponse
99
import dsm.pick2024.domain.classroom.port.`in`.ClassroomFinderUseCase
10+
import dsm.pick2024.domain.classroom.port.out.QueryClassroomPort
1011
import org.springframework.dao.EmptyResultDataAccessException
1112
import org.springframework.stereotype.Service
1213
import org.springframework.transaction.annotation.Transactional
1314

1415
@Service
1516
class QueryClassAttendanceService(
1617
private val queryAttendancePort: QueryAttendancePort,
17-
private val classroomFinderUseCase: ClassroomFinderUseCase
18+
private val queryClassroomPort: QueryClassroomPort,
1819
) : QueryClassAttendanceUseCase {
1920

2021
@Transactional(readOnly = true)
@@ -24,14 +25,10 @@ class QueryClassAttendanceService(
2425
classNum: Int
2526
) =
2627
queryAttendancePort.findByGradeAndClassNum(grade, classNum)
27-
.map { it ->
28+
.map {
2829
val userId = it.userId
29-
val classroomName = try {
30-
val classroom = classroomFinderUseCase.findOKClassroomOrThrow(userId)
31-
classroom.classroomName
32-
} catch (e: EmptyResultDataAccessException) {
33-
""
34-
}
30+
val classroomName = queryClassroomPort.findOKClassroom(userId)?.classroomName ?: ""
31+
3532
val returnStatus = returnStatus(period, it)
3633

3734
with(it) {

0 commit comments

Comments
 (0)