Skip to content

Commit

Permalink
Merge pull request #218 from DSM-PICK/209-add-exception
Browse files Browse the repository at this point in the history
🔀 :: (PICK-209)add exception
  • Loading branch information
meltapplee authored Jul 8, 2024
2 parents edb800f + f91f73a commit c39d22f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package dsm.pick2024.domain.classroom.exception
import dsm.pick2024.global.error.exception.ErrorCode
import dsm.pick2024.global.error.exception.PickException

object ClassroomNorFoundException : PickException(
object ClassroomNotFoundException : PickException(
ErrorCode.CLASSROOM_NOT_FOUND
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import dsm.pick2024.domain.attendance.domain.Attendance
import dsm.pick2024.domain.attendance.port.out.QueryAttendancePort
import dsm.pick2024.domain.attendance.port.out.SaveAllPort
import dsm.pick2024.domain.classroom.domain.Classroom
import dsm.pick2024.domain.classroom.exception.ClassroomNorFoundException
import dsm.pick2024.domain.classroom.exception.ClassroomNotFoundException
import dsm.pick2024.domain.classroom.port.`in`.ChangeClassroomStatusUseCase
import dsm.pick2024.domain.classroom.port.out.DeleteClassRoomPort
import dsm.pick2024.domain.classroom.port.out.QueryClassroomPort
Expand All @@ -29,7 +29,7 @@ class ChangeClassroomStatusService(
override fun changeClassroomStatus(request: ClassroomStatusRequest) {
if (request.status == NO) {
for (id in request.ids) {
val classroom = queryClassroomPort.findByUserId(id) ?: throw ClassroomNorFoundException
val classroom = queryClassroomPort.findByUserId(id) ?: throw ClassroomNotFoundException
deleteClassRoomPort.deleteByUserId(classroom.userId)
}
return
Expand All @@ -39,7 +39,7 @@ class ChangeClassroomStatusService(
val updateAttendanceList = mutableListOf<Attendance>()

request.ids.forEach { id ->
val classroom = queryClassroomPort.findByUserId(id) ?: throw ClassroomNorFoundException
val classroom = queryClassroomPort.findByUserId(id) ?: throw ClassroomNotFoundException

val updatedClassroom = classroom.copy(status = OK)
update.add(updatedClassroom)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dsm.pick2024.domain.classroom.service

import dsm.pick2024.domain.classroom.exception.ClassroomNotFoundException
import dsm.pick2024.domain.classroom.port.`in`.QueryUserMoveClassroomUseCase
import dsm.pick2024.domain.classroom.port.out.QueryClassroomPort
import dsm.pick2024.domain.classroom.presentation.dto.response.UserMoveClassroomResponse
Expand All @@ -16,7 +17,7 @@ class UserMoveClassroomQueryService(
override fun queryUserMoveClassroom(): UserMoveClassroomResponse {
val user = userFacadeUseCase.currentUser()
val move = queryClassroomPort.findOKClassroom(user.id)
?: throw Exception()
?: throw ClassroomNotFoundException

return UserMoveClassroomResponse(move.userName, move.classroomName, move.startPeriod, move.endPeriod)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dsm.pick2024.domain.notice.service

import dsm.pick2024.domain.notice.exception.NoticeNotFoundException
import dsm.pick2024.domain.notice.port.`in`.QueryAllNoticeUseCase
import dsm.pick2024.domain.notice.port.out.QueryNoticePort
import dsm.pick2024.domain.notice.presentation.dto.response.QueryAllNoticeResponse
Expand Down Expand Up @@ -29,7 +30,7 @@ class QueryNoticeService(

override fun queryAllNotice(noticeId: UUID): QueryAllNoticeResponse {
val notice = queryNoticePort.findById(noticeId)
?: throw RuntimeException() //예외만들기
?: throw NoticeNotFoundException

return QueryAllNoticeResponse(
title = notice.title,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dsm.pick2024.domain.schedule.service

import dsm.pick2024.domain.schedule.exception.ScheduleNotFoundException
import dsm.pick2024.domain.schedule.port.`in`.ModifyScheduleUseCase
import dsm.pick2024.domain.schedule.port.out.QuerySchedulePort
import dsm.pick2024.domain.schedule.port.out.SaveSchedulePort
Expand All @@ -16,7 +17,7 @@ class ModifyScheduleService(
@Transactional
override fun modifyModify(request: ModifyScheduleRequest) {
val schedule = querySchedulePort.findById(request.id)
?: throw RuntimeException("")
?: throw ScheduleNotFoundException

saveSchedulePort.save(
schedule.copy(
Expand Down

0 comments on commit c39d22f

Please sign in to comment.