diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4fa43170..7214fd800 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,4 +30,4 @@ jobs: --no-daemon - name: Run Detekt - run: ./gradlew detekt \ No newline at end of file + run: ./gradlew :dms-application:detekt \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index f5f5f0a5e..3a96529c1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,6 +39,8 @@ subprojects { // test implementation(Dependencies.SPRING_TEST) implementation(Dependencies.MOCKK) + + detektPlugins(Dependencies.DETEKT) } } diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index f7b33c808..cfefdeccb 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -52,4 +52,7 @@ object Dependencies { // excel const val APACHE_POI = "org.apache.poi:poi:${DependencyVersions.APACHE_POI_VERSION}" const val APACHE_POI_OOXML = "org.apache.poi:poi-ooxml:${DependencyVersions.APACHE_POI_VERSION}" + + // detekt + const val DETEKT = "io.gitlab.arturbosch.detekt:detekt-formatting:${PluginVersions.DETEKT_VERSION}" } \ No newline at end of file diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/auth/spi/AuthQueryUserPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/auth/spi/AuthQueryUserPort.kt index 4f9e60e0f..63f6b94a8 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/auth/spi/AuthQueryUserPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/auth/spi/AuthQueryUserPort.kt @@ -9,5 +9,5 @@ interface AuthQueryUserPort { fun queryUserByAccountId(accountId: String): User? - fun queryUserById(id: UUID): User? + fun queryUserById(userId: UUID): User? } diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerCommandRemainStatusPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerCommandRemainStatusPort.kt index 2e2b8ceec..62ffffa8b 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerCommandRemainStatusPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerCommandRemainStatusPort.kt @@ -4,4 +4,4 @@ import java.util.UUID interface ManagerCommandRemainStatusPort { fun deleteByStudentId(studentId: UUID) -} \ No newline at end of file +} diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerCommandStudyRoomPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerCommandStudyRoomPort.kt index eae8185c5..c4d104636 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerCommandStudyRoomPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerCommandStudyRoomPort.kt @@ -8,4 +8,4 @@ interface ManagerCommandStudyRoomPort { fun saveSeat(seat: Seat): Seat fun saveStudyRoom(studyRoom: StudyRoom): StudyRoom -} \ No newline at end of file +} diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerQueryStudyRoomPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerQueryStudyRoomPort.kt index 6e80a9911..27adb38fe 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerQueryStudyRoomPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/spi/ManagerQueryStudyRoomPort.kt @@ -9,4 +9,4 @@ interface ManagerQueryStudyRoomPort { fun querySeatByStudentId(studentId: UUID): Seat? fun queryStudyRoomById(studyRoomId: UUID): StudyRoom? -} \ No newline at end of file +} diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/usecase/RemoveStudentUseCase.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/usecase/RemoveStudentUseCase.kt index f9a5b24e0..af8e3e422 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/usecase/RemoveStudentUseCase.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/manager/usecase/RemoveStudentUseCase.kt @@ -53,17 +53,6 @@ class RemoveStudentUseCase( // 잔류 내역 삭제 commandRemainStatusPort.deleteByStudentId(studentId) - // 자습실 신청 상태 제거 - queryStudyRoomPort.querySeatByStudentId(studentId)?.let { seat -> - val studyRoom = queryStudyRoomPort.queryStudyRoomById(seat.studyRoomId) ?: throw StudyRoomNotFoundException - commandStudyRoomPort.saveSeat( - seat.unUse() - ) - commandStudyRoomPort.saveStudyRoom( - studyRoom.unApply() - ) - } - commandUserPort.saveUser( studentUser.copy(deletedAt = LocalDateTime.now()) ) diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/meal/usecase/QueryMealsUseCase.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/meal/usecase/QueryMealsUseCase.kt index 938d2137a..7d260e368 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/meal/usecase/QueryMealsUseCase.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/meal/usecase/QueryMealsUseCase.kt @@ -37,9 +37,7 @@ class QueryMealsUseCase( if (meals == null) { mealDetails.add(MealDetails.emptyOf(date)) } else { - meals[0].apply { - mealDetails.add(MealDetails.of(this)) - } + mealDetails.add(MealDetails.of(meals[0])) } } diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/remain/spi/RemainStatusPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/remain/spi/RemainStatusPort.kt index d395ea98d..d1ba98072 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/remain/spi/RemainStatusPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/remain/spi/RemainStatusPort.kt @@ -7,5 +7,4 @@ interface RemainStatusPort : CommandRemainStatusPort, QueryRemainStatusPort, StudentCommandRemainStatusPort, - ManagerCommandRemainStatusPort { -} \ No newline at end of file + ManagerCommandRemainStatusPort diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/CommandStudentPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/CommandStudentPort.kt index def55cb4f..bf1076aa5 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/CommandStudentPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/CommandStudentPort.kt @@ -10,5 +10,4 @@ interface CommandStudentPort { fun saveAllVerifiedStudent(verifiedStudents: List) fun deleteVerifiedStudent(verifiedStudent: VerifiedStudent) - } diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentCommandRemainStatusPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentCommandRemainStatusPort.kt index 8c9cbb0e9..979b68a33 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentCommandRemainStatusPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentCommandRemainStatusPort.kt @@ -4,4 +4,4 @@ import java.util.UUID interface StudentCommandRemainStatusPort { fun deleteByStudentId(studentId: UUID) -} \ No newline at end of file +} diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentCommandStudyRoomPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentCommandStudyRoomPort.kt index 58c591db2..b9ac5f549 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentCommandStudyRoomPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentCommandStudyRoomPort.kt @@ -8,4 +8,4 @@ interface StudentCommandStudyRoomPort { fun saveSeat(seat: Seat): Seat fun saveStudyRoom(studyRoom: StudyRoom): StudyRoom -} \ No newline at end of file +} diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentQueryStudyRoomPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentQueryStudyRoomPort.kt index 3f9a97ae7..fc15d82c6 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentQueryStudyRoomPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/spi/StudentQueryStudyRoomPort.kt @@ -9,4 +9,4 @@ interface StudentQueryStudyRoomPort { fun querySeatByStudentId(studentId: UUID): Seat? fun queryStudyRoomById(studyRoomId: UUID): StudyRoom? -} \ No newline at end of file +} diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/usecase/SignUpUseCase.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/usecase/SignUpUseCase.kt index 6fc793900..fe5e62161 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/usecase/SignUpUseCase.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/usecase/SignUpUseCase.kt @@ -61,13 +61,11 @@ class SignUpUseCase( validateAuthCode(authCode, email) validateUserDuplicated(accountId, email) - val gcn = "${grade}${classRoom}${Student.processNumber(number)}" - /** * 검증된 학생 조회 **/ val verifiedStudent = queryVerifiedStudentPort.queryVerifiedStudentByGcnAndSchoolName( - gcn = gcn, + gcn = "${grade}${classRoom}${Student.processNumber(number)}", schoolName = school.name ) ?: throw VerifiedStudentNotFoundException diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/usecase/StudentWithdrawalUseCase.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/usecase/StudentWithdrawalUseCase.kt index 0c35abde8..748d87e11 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/student/usecase/StudentWithdrawalUseCase.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/student/usecase/StudentWithdrawalUseCase.kt @@ -43,4 +43,4 @@ class StudentWithdrawalUseCase( studentUser.copy(deletedAt = LocalDateTime.now()) ) } -} \ No newline at end of file +} diff --git a/dms-application/src/main/kotlin/team/aliens/dms/domain/studyroom/spi/StudyRoomPort.kt b/dms-application/src/main/kotlin/team/aliens/dms/domain/studyroom/spi/StudyRoomPort.kt index 7eb418478..51b0db239 100644 --- a/dms-application/src/main/kotlin/team/aliens/dms/domain/studyroom/spi/StudyRoomPort.kt +++ b/dms-application/src/main/kotlin/team/aliens/dms/domain/studyroom/spi/StudyRoomPort.kt @@ -5,12 +5,11 @@ import team.aliens.dms.domain.manager.spi.ManagerQueryStudyRoomPort import team.aliens.dms.domain.student.spi.StudentCommandStudyRoomPort import team.aliens.dms.domain.student.spi.StudentQueryStudyRoomPort -interface StudyRoomPort: +interface StudyRoomPort : QueryStudyRoomPort, CommandStudyRoomPort, SeatTypeQueryStudyRoomPort, StudentQueryStudyRoomPort, StudentCommandStudyRoomPort, ManagerQueryStudyRoomPort, - ManagerCommandStudyRoomPort { -} \ No newline at end of file + ManagerCommandStudyRoomPort diff --git a/dms-application/src/test/kotlin/team/aliens/dms/domain/manager/usecase/RemoveStudentUseCaseTests.kt b/dms-application/src/test/kotlin/team/aliens/dms/domain/manager/usecase/RemoveStudentUseCaseTests.kt index 5ecbf0b5e..95a879f63 100644 --- a/dms-application/src/test/kotlin/team/aliens/dms/domain/manager/usecase/RemoveStudentUseCaseTests.kt +++ b/dms-application/src/test/kotlin/team/aliens/dms/domain/manager/usecase/RemoveStudentUseCaseTests.kt @@ -58,7 +58,8 @@ class RemoveStudentUseCaseTests { @BeforeEach fun setUp() { removeStudentUseCase = RemoveStudentUseCase( - securityPort, queryUserPort, queryStudentPort, commandRemainStatusPort, queryStudyRoomPort, commandStudyRoomPort, commandUserPort + securityPort, queryUserPort, queryStudentPort, commandRemainStatusPort, + queryStudyRoomPort, commandStudyRoomPort, commandUserPort ) } diff --git a/dms-application/src/test/kotlin/team/aliens/dms/domain/student/usecase/SignUpUseCaseTests.kt b/dms-application/src/test/kotlin/team/aliens/dms/domain/student/usecase/SignUpUseCaseTests.kt index 0f289294b..9250e5289 100644 --- a/dms-application/src/test/kotlin/team/aliens/dms/domain/student/usecase/SignUpUseCaseTests.kt +++ b/dms-application/src/test/kotlin/team/aliens/dms/domain/student/usecase/SignUpUseCaseTests.kt @@ -147,26 +147,6 @@ class SignUpUseCaseTests { ) } - private val tokenResponseStub by lazy { - TokenResponse( - accessToken = "test access token", - accessTokenExpiredAt = LocalDateTime.now(), - refreshToken = "test refresh token", - refreshTokenExpiredAt = LocalDateTime.now() - ) - } - - private val featureStub by lazy { - AvailableFeature( - schoolId = userStub.schoolId, - mealService = true, - noticeService = true, - pointService = true, - studyRoomService = false, - remainService = true - ) - } - private val gcnStub = "${requestStub.grade}${requestStub.classRoom}${Student.processNumber(requestStub.number)}" // @Test diff --git a/dms-application/src/test/kotlin/team/aliens/dms/domain/student/usecase/StudentWithdrawalUseCaseTests.kt b/dms-application/src/test/kotlin/team/aliens/dms/domain/student/usecase/StudentWithdrawalUseCaseTests.kt index 94a4a65cd..b9305bfba 100644 --- a/dms-application/src/test/kotlin/team/aliens/dms/domain/student/usecase/StudentWithdrawalUseCaseTests.kt +++ b/dms-application/src/test/kotlin/team/aliens/dms/domain/student/usecase/StudentWithdrawalUseCaseTests.kt @@ -109,4 +109,4 @@ class StudentWithdrawalUseCaseTests { studentWithdrawalUseCase.execute() } } -} \ No newline at end of file +}