Skip to content

Commit

Permalink
refactor: (#798) 클래스 명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
pji-min committed Feb 17, 2025
1 parent 03f95b1 commit 15ffd75
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import team.aliens.dms.domain.point.spi.vo.StudentWithPointVO
import team.aliens.dms.domain.room.model.Room
import team.aliens.dms.domain.student.model.Student
import team.aliens.dms.domain.student.spi.vo.AllStudentsVO
import team.aliens.dms.domain.vote.dto.response.ModelStudentListResponse
import team.aliens.dms.domain.vote.dto.response.ModelStudentResponse
import java.time.LocalDate
import java.util.UUID

Expand Down Expand Up @@ -57,6 +57,6 @@ interface GetStudentService {

fun isApplicant(studentId: UUID): Boolean

fun getModelStudentList(date: LocalDate): List<ModelStudentListResponse>
fun getModelStudentList(date: LocalDate): List<ModelStudentResponse>

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import team.aliens.dms.domain.student.exception.StudentNotFoundException
import team.aliens.dms.domain.student.exception.StudentUpdateInfoNotFoundException
import team.aliens.dms.domain.student.model.Student
import team.aliens.dms.domain.student.spi.QueryStudentPort
import team.aliens.dms.domain.vote.dto.response.ModelStudentListResponse
import team.aliens.dms.domain.vote.dto.response.ModelStudentResponse
import team.aliens.dms.domain.vote.exception.validateStudentList
import java.time.LocalDate
import java.util.UUID
Expand Down Expand Up @@ -140,7 +140,7 @@ class GetStudentServiceImpl(
}
}

override fun getModelStudentList(date: LocalDate): List<ModelStudentListResponse> {
override fun getModelStudentList(date: LocalDate): List<ModelStudentResponse> {
val firstDayOfMonth = date.withDayOfMonth(1)
val lastDayOfMonth = date.withDayOfMonth(date.lengthOfMonth())

Expand All @@ -149,10 +149,14 @@ class GetStudentServiceImpl(

val modelStudentList = queryStudentPort.queryModelStudents(startOfDay, endOfDay)

if (modelStudentList.isEmpty()) {
throw StudentNotFoundException
}

validateStudentList(modelStudentList)

return modelStudentList.map { student ->
ModelStudentListResponse(
ModelStudentResponse(
id = student.id,
gcn = student.studentGcn,
name = student.studentName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import team.aliens.dms.domain.manager.spi.vo.StudentWithTag
import team.aliens.dms.domain.point.spi.vo.StudentWithPointVO
import team.aliens.dms.domain.student.model.Student
import team.aliens.dms.domain.student.spi.vo.AllStudentsVO
import team.aliens.dms.domain.vote.model.ModelStudent
import team.aliens.dms.domain.student.spi.vo.ModelStudentVO
import java.time.LocalDateTime
import java.util.UUID

Expand Down Expand Up @@ -44,5 +44,5 @@ interface QueryStudentPort {

fun queryAllStudentsByName(name: String?, schoolId: UUID): List<AllStudentsVO>

fun queryModelStudents(startOfDay: LocalDateTime, endOfDay: LocalDateTime): List<ModelStudent>
fun queryModelStudents(startOfDay: LocalDateTime, endOfDay: LocalDateTime): List<ModelStudentVO>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package team.aliens.dms.domain.student.usecase
import org.springframework.beans.factory.annotation.Qualifier
import team.aliens.dms.common.annotation.ReadOnlyUseCase
import team.aliens.dms.domain.student.service.GetStudentService
import team.aliens.dms.domain.vote.dto.response.ModelStudentListResponse
import team.aliens.dms.domain.vote.dto.response.ModelStudentResponse
import java.time.LocalDate

@ReadOnlyUseCase
class GetModelStudentsUseCase(
@Qualifier("getStudentServiceImpl") private val getStudentService: GetStudentService
) {
fun execute(date: LocalDate): List<ModelStudentListResponse> {
fun execute(date: LocalDate): List<ModelStudentResponse> {
return getStudentService.getModelStudentList(date)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package team.aliens.dms.domain.vote.exception

import team.aliens.dms.common.error.DmsException
import team.aliens.dms.domain.vote.model.ModelStudent
import team.aliens.dms.domain.student.spi.vo.ModelStudentVO

object StudentNotFoundException : DmsException(
VoteErrorCode.STUDENT_NOT_FOUND
Expand All @@ -11,8 +11,8 @@ object StudentIdNotFoundException : DmsException(
VoteErrorCode.STUDENT_ID_NOT_FOUND
)

fun validateStudentList(modelStudentList: List<ModelStudent>) {
fun validateStudentList(modelStudentList: List<ModelStudentVO>) {
if (modelStudentList.isEmpty()) {
throw StudentNotFoundException
}
}
}

0 comments on commit 15ffd75

Please sign in to comment.