Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ” 제좜된 인증제 λͺ©λ‘μ„ 각 λ‹΄μž„ μ„ μƒλ‹˜ 반의 인증제만 λ°˜ν™˜ν•˜λ„λ‘ 함 #419

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@ import team.msg.sms.domain.authentication.model.MarkingBoardType
import team.msg.sms.domain.authentication.service.AuthenticationFormService
import team.msg.sms.domain.authentication.service.MarkingBoardService
import team.msg.sms.domain.student.service.StudentService
import team.msg.sms.domain.teacher.service.HomeroomTeacherService
import team.msg.sms.domain.teacher.service.TeacherService
import team.msg.sms.domain.user.service.UserService

@ReadOnlyUseCase
class QueryStudentFormListUseCase(
private val studentService: StudentService,
private val userService: UserService,
private val markingBoardService: MarkingBoardService,
private val authenticationFormService: AuthenticationFormService
private val authenticationFormService: AuthenticationFormService,
private val homeroomTeacherService: HomeroomTeacherService
) {
fun execute(page: Int, size: Int, type: List<MarkingBoardType>?): UserBoardPageResponseData {
val studentIds = studentService.getStudentIds()
val currentUser = userService.getCurrentUser()
val currentHomeroomTeacher = homeroomTeacherService.getHomeroomTeacherByUserId(currentUser.id)

val grade = currentHomeroomTeacher.grade
val classNum = currentHomeroomTeacher.classNum
val studentIds = studentService.getStudentIdsByGradeAndClassNum(grade, classNum)

val authenticationFormId = authenticationFormService.getActiveAuthenticationFormId()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ interface GetStudentService {
fun currentStudent(): Student.StudentWithUserInfo

fun getStudentIds(): List<UUID>

fun getStudentIdsByGradeAndClassNum(grade: Int, classNum: Int): List<UUID>
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@ class GetStudentServiceImpl(

override fun getStudentIds(): List<UUID> =
studentPort.queryStudentIds()

override fun getStudentIdsByGradeAndClassNum(grade: Int, classNum: Int): List<UUID> =
studentPort.queryStudentIdsByGradeAndClassNum(grade, classNum)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface QueryStudentPort {
fun queryStudentById(uuid: UUID): Student?
fun queryStudentsWithPage(page: Int, size: Int): Student.StudentWithPageInfo
fun queryStudentIds(): List<UUID>
fun queryStudentIdsByGradeAndClassNum(grade: Int, classNum: Int): List<UUID>
fun queryStudentByUserId(userId: UUID): Student
fun queryStudentUserInfoByUserId(userId: UUID): Student.StudentWithUserInfo?
fun queryStudentByUser(user: User): Student
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ class StudentPersistenceAdapter(
.fetch()
}

override fun queryStudentIdsByGradeAndClassNum(grade: Int, classNum: Int): List<UUID> {
val qStudent = QStudentJpaEntity.studentJpaEntity

return queryFactory
.select(qStudent.id)
.from(qStudent)
.where(qStudent.user.stuNum.startsWith("${grade}${classNum}"))
.fetch()
}

override fun queryStudentByUserId(userId: UUID): Student =
studentJpaRepository.findByUserId(userId)!!.toDomain()

Expand Down
Loading