From 87e36cc3ad32af8ea69c9d6e6b06ce92223fabfd Mon Sep 17 00:00:00 2001 From: ddingmin Date: Sat, 25 May 2024 14:11:43 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B6=9C=EC=84=9D=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20save=20=EB=A1=9C=EC=A7=81=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../makers/domain/exception/AttendanceException.kt | 1 + .../depromeet/makers/domain/exception/ErrorCode.kt | 1 + .../makers/domain/usecase/GetMemberAttendances.kt | 12 ++---------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/com/depromeet/makers/domain/exception/AttendanceException.kt b/src/main/kotlin/com/depromeet/makers/domain/exception/AttendanceException.kt index 9b3e542..eb48d50 100644 --- a/src/main/kotlin/com/depromeet/makers/domain/exception/AttendanceException.kt +++ b/src/main/kotlin/com/depromeet/makers/domain/exception/AttendanceException.kt @@ -10,3 +10,4 @@ class AttendanceAlreadyExistsException : AttendanceException(ErrorCode.ALREADY_A class InvalidCheckInTimeException : AttendanceException(ErrorCode.INVALID_CHECKIN_TIME) class MissingPlaceParamException : AttendanceException(ErrorCode.MISSING_PLACE_PARAM) class InvalidCheckInDistanceException : AttendanceException(ErrorCode.INVALID_CHECKIN_DISTANCE) +class NotFoundAttendanceException : AttendanceException(ErrorCode.NOT_EXIST_ATTENDANCE) diff --git a/src/main/kotlin/com/depromeet/makers/domain/exception/ErrorCode.kt b/src/main/kotlin/com/depromeet/makers/domain/exception/ErrorCode.kt index ff1decc..cef33b8 100644 --- a/src/main/kotlin/com/depromeet/makers/domain/exception/ErrorCode.kt +++ b/src/main/kotlin/com/depromeet/makers/domain/exception/ErrorCode.kt @@ -55,4 +55,5 @@ enum class ErrorCode( INVALID_CHECKIN_TIME("AT0004", "현재 주차에 해당하는 세션을 찾을 수 없습니다."), MISSING_PLACE_PARAM("AT0005", "오프라인 세션 출석체크의 현재 위치 정보가 누락되었습니다."), INVALID_CHECKIN_DISTANCE("AT0006", "현재 위치와 세션 장소의 거리가 너무 멉니다."), + NOT_EXIST_ATTENDANCE("AT0007", "해당하는 출석 정보가 없습니다.") } diff --git a/src/main/kotlin/com/depromeet/makers/domain/usecase/GetMemberAttendances.kt b/src/main/kotlin/com/depromeet/makers/domain/usecase/GetMemberAttendances.kt index 2978f7b..3bcc3cc 100644 --- a/src/main/kotlin/com/depromeet/makers/domain/usecase/GetMemberAttendances.kt +++ b/src/main/kotlin/com/depromeet/makers/domain/usecase/GetMemberAttendances.kt @@ -1,5 +1,6 @@ package com.depromeet.makers.domain.usecase +import com.depromeet.makers.domain.exception.NotFoundAttendanceException import com.depromeet.makers.domain.gateway.AttendanceGateway import com.depromeet.makers.domain.gateway.MemberGateway import com.depromeet.makers.domain.gateway.SessionGateway @@ -43,16 +44,7 @@ class GetMemberAttendances( generation = input.generation, week = week ) - }.getOrDefault( - attendanceGateway.save( - Attendance.newAttendance( - member = member, - generation = input.generation, - week = week, - sessionType = sessions[week - 1].sessionType, - ) - ) - ) + }.getOrElse { throw NotFoundAttendanceException() } } var offlineAbsenceScore = 0.0