diff --git a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/api/ApplicationApi.kt b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/api/ApplicationApi.kt index 4516371b..c6a630fc 100644 --- a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/api/ApplicationApi.kt +++ b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/api/ApplicationApi.kt @@ -19,13 +19,13 @@ interface ApplicationApi { fun queryPicnicStudentListByToday(): QueryPicnicStudentList - fun getAllStudentStatusByClassroomId(classroomId: UUID): QueryStudentStatusList + fun queryAllStudentStatusByClassroomId(classroomId: UUID): QueryStudentStatusList fun savePicnicPass(request: DomainPicnicPassRequest) fun savePicnicAcceptOrRefuse(request: DomainPicnicAcceptOrRefuseRequest) - fun getMyPicnicEndTime(): QueryMyPicnicEndTimeResponse + fun queryMyPicnicEndTime(): QueryMyPicnicEndTimeResponse - fun getMyPicnicInfo(): QueryMyPicnicInfoResponse + fun queryMyPicnicInfo(): QueryMyPicnicInfoResponse } diff --git a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/usecase/ApplicationUseCase.kt b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/usecase/ApplicationUseCase.kt index d2d555ba..21b14104 100644 --- a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/usecase/ApplicationUseCase.kt +++ b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/usecase/ApplicationUseCase.kt @@ -345,7 +345,7 @@ class ApplicationUseCase( return QueryPicnicStudentList(outing) } - override fun getAllStudentStatusByClassroomId(classroomId: UUID): QueryStudentStatusList { + override fun queryAllStudentStatusByClassroomId(classroomId: UUID): QueryStudentStatusList { val dateType = queryTypeSpi.queryDirectorTypeByDate(LocalDate.now()) ?: DirectorType.SELF_STUDY val todayStudentStatusList = queryStatusSpi.queryStatusListByToday() val classroom = queryClassroomSpi.queryClassroomById(classroomId) ?: throw ClassroomNotFoundException @@ -505,7 +505,7 @@ class ApplicationUseCase( } } - override fun getMyPicnicEndTime(): QueryMyPicnicEndTimeResponse { + override fun queryMyPicnicEndTime(): QueryMyPicnicEndTimeResponse { val userInfo = userSpi.queryUserInfoByUserId(userSpi.getCurrentUserId()) val picnicUserStatus = queryStatusSpi.queryPicnicStudentByStudentIdAndToday(userInfo.id) ?: throw StatusNotFoundException @@ -521,7 +521,7 @@ class ApplicationUseCase( ) } - override fun getMyPicnicInfo(): QueryMyPicnicInfoResponse { + override fun queryMyPicnicInfo(): QueryMyPicnicInfoResponse { val userInfo = userSpi.queryUserInfoByUserId(userSpi.getCurrentUserId()) val picnicUserStatus = queryStatusSpi.queryPicnicStudentByStudentIdAndToday(userInfo.id) ?: throw StatusNotFoundException diff --git a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/api/TeacherApi.kt b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/api/TeacherApi.kt index e2f3c2fa..346a4852 100644 --- a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/api/TeacherApi.kt +++ b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/api/TeacherApi.kt @@ -3,6 +3,7 @@ package com.pickdsm.pickserverspring.domain.teacher.api import com.pickdsm.pickserverspring.domain.teacher.api.dto.request.DomainComebackStudentRequest import com.pickdsm.pickserverspring.domain.teacher.api.dto.request.DomainUpdateStudentStatusRequest import com.pickdsm.pickserverspring.domain.teacher.api.dto.response.QueryMovementStudentList +import com.pickdsm.pickserverspring.domain.teacher.api.dto.response.QueryMyBuckGradeAndClassNumResponse import com.pickdsm.pickserverspring.domain.teacher.api.dto.response.QueryStudentStatusCountResponse import java.util.UUID @@ -10,9 +11,11 @@ interface TeacherApi { fun updateStudentStatus(request: DomainUpdateStudentStatusRequest) - fun getStudentStatusCount(): QueryStudentStatusCountResponse + fun queryStudentStatusCount(): QueryStudentStatusCountResponse fun comebackStudent(request: DomainComebackStudentRequest) - fun getMovementStudents(classroomId: UUID): QueryMovementStudentList + fun queryMovementStudents(classroomId: UUID): QueryMovementStudentList + + fun queryMyBuckGradeAndClassNum(): QueryMyBuckGradeAndClassNumResponse } diff --git a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/api/dto/response/QueryMyBuckGradeAndClassNumResponse.kt b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/api/dto/response/QueryMyBuckGradeAndClassNumResponse.kt new file mode 100644 index 00000000..c6243f86 --- /dev/null +++ b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/api/dto/response/QueryMyBuckGradeAndClassNumResponse.kt @@ -0,0 +1,6 @@ +package com.pickdsm.pickserverspring.domain.teacher.api.dto.response + +data class QueryMyBuckGradeAndClassNumResponse( + val grade: Int, + val classNum: Int, +) diff --git a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/usecase/TeacherUseCase.kt b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/usecase/TeacherUseCase.kt index 29887a5c..d2e43a1f 100644 --- a/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/usecase/TeacherUseCase.kt +++ b/pick-application/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/usecase/TeacherUseCase.kt @@ -8,15 +8,14 @@ import com.pickdsm.pickserverspring.domain.application.spi.CommandApplicationSpi import com.pickdsm.pickserverspring.domain.application.spi.QueryApplicationSpi import com.pickdsm.pickserverspring.domain.application.spi.QueryStatusSpi import com.pickdsm.pickserverspring.domain.classroom.exception.ClassroomNotFoundException -import com.pickdsm.pickserverspring.domain.classroom.exception.FloorNotFoundException import com.pickdsm.pickserverspring.domain.classroom.spi.QueryClassroomSpi import com.pickdsm.pickserverspring.domain.selfstudydirector.spi.QuerySelfStudyDirectorSpi -import com.pickdsm.pickserverspring.domain.selfstudydirector.spi.QueryTypeSpi import com.pickdsm.pickserverspring.domain.teacher.api.TeacherApi import com.pickdsm.pickserverspring.domain.teacher.api.dto.request.DomainComebackStudentRequest import com.pickdsm.pickserverspring.domain.teacher.api.dto.request.DomainUpdateStudentStatusRequest import com.pickdsm.pickserverspring.domain.teacher.api.dto.response.QueryMovementStudentList import com.pickdsm.pickserverspring.domain.teacher.api.dto.response.QueryMovementStudentList.MovementStudent +import com.pickdsm.pickserverspring.domain.teacher.api.dto.response.QueryMyBuckGradeAndClassNumResponse import com.pickdsm.pickserverspring.domain.teacher.api.dto.response.QueryStudentStatusCountResponse import com.pickdsm.pickserverspring.domain.teacher.spi.StatusCommandTeacherSpi import com.pickdsm.pickserverspring.domain.teacher.spi.TimeQueryTeacherSpi @@ -64,7 +63,7 @@ class TeacherUseCase( statusCommandTeacherSpi.saveStatus(saveOrUpdateStatus) } - override fun getStudentStatusCount(): QueryStudentStatusCountResponse { + override fun queryStudentStatusCount(): QueryStudentStatusCountResponse { val teacherResponsibleFloor = querySelfStudyDirectorSpi.queryResponsibleFloorByTeacherIdAndToday(userSpi.getCurrentUserId()) return QueryStudentStatusCountResponse( picnic = queryStatusSpi.queryPicnicStatusSizeByToday(), @@ -93,7 +92,7 @@ class TeacherUseCase( ) } - override fun getMovementStudents(classroomId: UUID): QueryMovementStudentList { + override fun queryMovementStudents(classroomId: UUID): QueryMovementStudentList { val classroom = queryClassroomSpi.queryClassroomById(classroomId) ?: throw ClassroomNotFoundException val movementStatusList = queryStatusSpi.queryMovementStatusListByTodayAndClassroomId(classroomId) @@ -117,6 +116,13 @@ class TeacherUseCase( return QueryMovementStudentList(movementList.sortedBy { it.studentNumber }) } + override fun queryMyBuckGradeAndClassNum(): QueryMyBuckGradeAndClassNumResponse { + val userId = userSpi.getCurrentUserId() + val userInfo = userSpi.queryUserInfoByUserId(userId) + + return QueryMyBuckGradeAndClassNumResponse(userInfo.grade, userInfo.classNum) + } + private fun User.paddedUserNum(): String = this.num.toString().padStart(2, '0') } diff --git a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/presentation/AdminWebAdapter.kt b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/presentation/AdminWebAdapter.kt index 1b43be4c..f7f58456 100644 --- a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/presentation/AdminWebAdapter.kt +++ b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/admin/presentation/AdminWebAdapter.kt @@ -209,7 +209,7 @@ class AdminWebAdapter( @GetMapping("/students/count") fun getStudentStatusCount(): QueryStudentStatusCountResponse { - return teacherApi.getStudentStatusCount() + return teacherApi.queryStudentStatusCount() } @GetMapping("/afterSchool/{after-school-id}") diff --git a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/presentation/ApplicationWebAdapter.kt b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/presentation/ApplicationWebAdapter.kt index 5c649b14..51b13691 100644 --- a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/presentation/ApplicationWebAdapter.kt +++ b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/application/presentation/ApplicationWebAdapter.kt @@ -66,15 +66,17 @@ class ApplicationWebAdapter( @GetMapping("/return") fun getMyPicnicEndTime(): QueryMyPicnicEndTimeResponse { - return applicationApi.getMyPicnicEndTime() + return applicationApi.queryMyPicnicEndTime() } @GetMapping("/picnic") fun getMyPicnicInfo(): QueryMyPicnicInfoResponse { - return applicationApi.getMyPicnicInfo() + return applicationApi.queryMyPicnicInfo() } @ResponseStatus(HttpStatus.NO_CONTENT) @DeleteMapping - fun returnClassroom() = classroomMovementApi.returnClassroomMovement() + fun returnClassroom() { + classroomMovementApi.returnClassroomMovement() + } } diff --git a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/presentation/TeacherWebAdapter.kt b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/presentation/TeacherWebAdapter.kt index 702e1c16..a1e9578f 100644 --- a/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/presentation/TeacherWebAdapter.kt +++ b/pick-infrastructure/src/main/kotlin/com/pickdsm/pickserverspring/domain/teacher/presentation/TeacherWebAdapter.kt @@ -11,6 +11,7 @@ import com.pickdsm.pickserverspring.domain.teacher.api.TeacherApi import com.pickdsm.pickserverspring.domain.teacher.api.dto.request.DomainComebackStudentRequest import com.pickdsm.pickserverspring.domain.teacher.api.dto.request.DomainUpdateStudentStatusRequest import com.pickdsm.pickserverspring.domain.teacher.api.dto.response.QueryMovementStudentList +import com.pickdsm.pickserverspring.domain.teacher.api.dto.response.QueryMyBuckGradeAndClassNumResponse import com.pickdsm.pickserverspring.domain.teacher.presentation.dto.request.ComebackStudentRequest import com.pickdsm.pickserverspring.domain.teacher.presentation.dto.request.PicnicAcceptOrRefuseRequest import com.pickdsm.pickserverspring.domain.teacher.presentation.dto.request.UpdateStudentStatusRequest @@ -97,13 +98,18 @@ class TeacherWebAdapter( fun queryStudentStatusByToday( @PathVariable("classroom-id") classroomId: UUID, ): QueryStudentStatusList { - return applicationApi.getAllStudentStatusByClassroomId(classroomId) + return applicationApi.queryAllStudentStatusByClassroomId(classroomId) } @GetMapping("/{classroom-id}") - fun getMovementStatus( + fun queryMovementStatus( @PathVariable("classroom-id") classroomId: UUID, ): QueryMovementStudentList { - return teacherApi.getMovementStudents(classroomId) + return teacherApi.queryMovementStudents(classroomId) + } + + @GetMapping("/buck") + fun queryMyBuckGradeAndClassNum(): QueryMyBuckGradeAndClassNumResponse { + return teacherApi.queryMyBuckGradeAndClassNum() } }