Skip to content

Commit

Permalink
refactor: (#271) dms-application detekt 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
softpeanut committed Feb 26, 2023
1 parent 063dfc5 commit 1083c8e
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
--no-daemon
- name: Run Detekt
run: ./gradlew detekt
run: ./gradlew :dms-application:detekt
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ subprojects {
// test
implementation(Dependencies.SPRING_TEST)
implementation(Dependencies.MOCKK)

detektPlugins(Dependencies.DETEKT)
}
}

Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ interface AuthQueryUserPort {

fun queryUserByAccountId(accountId: String): User?

fun queryUserById(id: UUID): User?
fun queryUserById(userId: UUID): User?
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import java.util.UUID

interface ManagerCommandRemainStatusPort {
fun deleteByStudentId(studentId: UUID)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ interface ManagerCommandStudyRoomPort {
fun saveSeat(seat: Seat): Seat

fun saveStudyRoom(studyRoom: StudyRoom): StudyRoom
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ interface ManagerQueryStudyRoomPort {
fun querySeatByStudentId(studentId: UUID): Seat?

fun queryStudyRoomById(studyRoomId: UUID): StudyRoom?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ interface RemainStatusPort :
CommandRemainStatusPort,
QueryRemainStatusPort,
StudentCommandRemainStatusPort,
ManagerCommandRemainStatusPort {
}
ManagerCommandRemainStatusPort
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ interface CommandStudentPort {
fun saveAllVerifiedStudent(verifiedStudents: List<VerifiedStudent>)

fun deleteVerifiedStudent(verifiedStudent: VerifiedStudent)

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import java.util.UUID

interface StudentCommandRemainStatusPort {
fun deleteByStudentId(studentId: UUID)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ interface StudentCommandStudyRoomPort {
fun saveSeat(seat: Seat): Seat

fun saveStudyRoom(studyRoom: StudyRoom): StudyRoom
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ interface StudentQueryStudyRoomPort {
fun querySeatByStudentId(studentId: UUID): Seat?

fun queryStudyRoomById(studyRoomId: UUID): StudyRoom?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ class StudentWithdrawalUseCase(
studentUser.copy(deletedAt = LocalDateTime.now())
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
ManagerCommandStudyRoomPort
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ class StudentWithdrawalUseCaseTests {
studentWithdrawalUseCase.execute()
}
}
}
}

0 comments on commit 1083c8e

Please sign in to comment.