diff --git a/src/main/kotlin/com/depromeet/makers/domain/usecase/CheckInSession.kt b/src/main/kotlin/com/depromeet/makers/domain/usecase/CheckInSession.kt index ba3a5d7..88b8043 100644 --- a/src/main/kotlin/com/depromeet/makers/domain/usecase/CheckInSession.kt +++ b/src/main/kotlin/com/depromeet/makers/domain/usecase/CheckInSession.kt @@ -15,7 +15,7 @@ class CheckInSession( private val attendanceGateway: AttendanceGateway, private val sessionGateway: SessionGateway, private val memberGateway: MemberGateway, -) : UseCase { +) : UseCase { data class CheckInSessionInput( val now: LocalDateTime, val memberId: String, @@ -23,7 +23,7 @@ class CheckInSession( val latitude: Double?, ) - override fun execute(input: CheckInSessionInput) { + override fun execute(input: CheckInSessionInput): Attendance { val member = memberGateway.getById(input.memberId) val monday = input.now.getMonday() @@ -64,7 +64,7 @@ class CheckInSession( } } - attendanceGateway.save(attendance.checkIn(input.now, thisWeekSession.startTime)) + return attendanceGateway.save(attendance.checkIn(input.now, thisWeekSession.startTime)) } private fun LocalDateTime.getMonday() = this.toLocalDate().with(DayOfWeek.MONDAY).atStartOfDay() diff --git a/src/main/kotlin/com/depromeet/makers/presentation/restapi/controller/CheckInController.kt b/src/main/kotlin/com/depromeet/makers/presentation/restapi/controller/CheckInController.kt index f463b1a..faf0fd3 100644 --- a/src/main/kotlin/com/depromeet/makers/presentation/restapi/controller/CheckInController.kt +++ b/src/main/kotlin/com/depromeet/makers/presentation/restapi/controller/CheckInController.kt @@ -2,10 +2,9 @@ package com.depromeet.makers.presentation.restapi.controller import com.depromeet.makers.domain.usecase.CheckInSession import com.depromeet.makers.domain.usecase.GetCheckInStatus +import com.depromeet.makers.presentation.restapi.dto.response.AttendanceResponse import com.depromeet.makers.presentation.restapi.dto.response.CheckInStatusResponse import io.swagger.v3.oas.annotations.Operation -import io.swagger.v3.oas.annotations.responses.ApiResponse -import io.swagger.v3.oas.annotations.responses.ApiResponses import io.swagger.v3.oas.annotations.tags.Tag import org.springframework.security.core.Authentication import org.springframework.web.bind.annotation.GetMapping @@ -25,26 +24,19 @@ class CheckInController( @Operation(summary = "세션 출석", description = "세션에 출석합니다. (서버에서 현재 시간을 기준으로 출석 처리)") @PostMapping - @ApiResponses( - ApiResponse(responseCode = "200", description = "출석 성공"), - ApiResponse(responseCode = "AT0001", description = "출석 시간 이전입니다"), - ApiResponse(responseCode = "AT0002", description = "출석 시간이 지났습니다"), - ApiResponse(responseCode = "AT0003", description = "이미 출석했습니다"), - ApiResponse(responseCode = "AT0004", description = "현재 주차에 해당하는 세션을 찾을 수 없습니다."), - ApiResponse(responseCode = "AT0005", description = "현재 위치 파라미터가 누락되었습니다."), - ApiResponse(responseCode = "AT0006", description = "현재 위치와 세션 장소의 거리가 너무 멉니다."), - ) fun checkInSession( authentication: Authentication, @RequestParam("latitude", required = false) latitude: Double?, @RequestParam("longitude", required = false) longitude: Double?, - ) { - checkInSession.execute( - CheckInSession.CheckInSessionInput( - now = LocalDateTime.now(), - memberId = authentication.name, - latitude = latitude, - longitude = longitude, + ): AttendanceResponse { + return AttendanceResponse.fromDomain( + checkInSession.execute( + CheckInSession.CheckInSessionInput( + now = LocalDateTime.now(), + memberId = authentication.name, + latitude = latitude, + longitude = longitude, + ) ) ) }