Skip to content

Commit

Permalink
v1.2.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyoil2 committed Apr 25, 2024
2 parents 4611865 + c1a2ef8 commit c1d6e01
Show file tree
Hide file tree
Showing 89 changed files with 1,266 additions and 305 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- develop
pull_request:
branches:
- main
- develop

jobs:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- develop
pull_request:
branches:
- main
- develop

jobs:
Expand Down
7 changes: 5 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ subprojects {
implementation(Dependencies.JAVA_SERVLET)

// test
implementation(Dependencies.SPRING_TEST)
implementation(Dependencies.MOCKK)
testImplementation(Dependencies.SPRING_TEST)
testImplementation(Dependencies.MOCKK)
testImplementation(Dependencies.SPRING_KOTEST)
testImplementation(Dependencies.KOTEST)
testImplementation(Dependencies.KOTEST_ASSERTIONS)

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 @@ -51,6 +51,9 @@ object Dependencies {
// test
const val SPRING_TEST = "org.springframework.boot:spring-boot-starter-test:${PluginVersions.SPRING_BOOT_VERSION}"
const val MOCKK = "io.mockk:mockk:${DependencyVersions.MOCKK_VERSION}"
const val SPRING_KOTEST = "io.kotest.extensions:kotest-extensions-spring:${DependencyVersions.SPRING_KOTEST_VERSION}"
const val KOTEST = "io.kotest:kotest-runner-junit5:${DependencyVersions.KOTEST_VERSION}"
const val KOTEST_ASSERTIONS = "io.kotest:kotest-assertions-core:${DependencyVersions.KOTEST_VERSION}"

// time based uuid
const val UUID_TIME = "com.fasterxml.uuid:java-uuid-generator:${DependencyVersions.UUID_TIME_VERSION}"
Expand Down
4 changes: 3 additions & 1 deletion buildSrc/src/main/kotlin/DependencyVersions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ object DependencyVersions {
const val JAKARTA_PERSISTENCE_VERSION = "3.1.0"
const val MYSQL = "8.0.28"
const val APACHE_POI_VERSION = "3.7"
const val MOCKK_VERSION = "1.13.2"
const val MOCKK_VERSION = "1.13.10"
const val SPRING_KOTEST_VERSION = "1.1.3"
const val KOTEST_VERSION = "5.7.2"
const val OPEN_FEIGN_VERSION = "4.1.0"
const val SENTRY_VERSION = "6.2.1"
const val ASPECTJ_VERSION = "1.9.7"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package team.aliens.dms.domain.file.service

import org.springframework.stereotype.Service
import team.aliens.dms.common.annotation.Service
import team.aliens.dms.domain.file.spi.WriteFilePort
import team.aliens.dms.domain.manager.spi.vo.StudentWithTag
import team.aliens.dms.domain.outing.spi.vo.OutingApplicationVO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ data class StudentWithTag(
val roomNumber: String,
val profileImageUrl: String,
val sex: Sex,
val bonusPoint: Int,
val minusPoint: Int,
val tags: List<Tag>
) {
val gcn: String = Student.processGcn(this.grade, this.classRoom, this.number)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package team.aliens.dms.domain.outing.dto

import java.time.LocalDate
import java.time.LocalTime
import java.util.UUID

data class ApplyOutingRequest(
val outAt: LocalDate,
val outingTime: LocalTime,
val arrivalTime: LocalTime,
val outingTypeTitle: String,
val reason: String?,
val companionIds: List<UUID>?
)
package team.aliens.dms.domain.outing.dto

import java.time.LocalDate
import java.time.LocalTime
import java.util.UUID

data class ApplyOutingRequest(
val outingDate: LocalDate,
val outingTime: LocalTime,
val arrivalTime: LocalTime,
val outingTypeTitle: String,
val reason: String?,
val companionIds: List<UUID>?
)
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package team.aliens.dms.domain.outing.dto

import com.fasterxml.jackson.annotation.JsonInclude
import team.aliens.dms.domain.outing.model.OutingApplication
import team.aliens.dms.domain.outing.model.OutingStatus
import team.aliens.dms.domain.outing.spi.vo.CurrentOutingApplicationVO
import team.aliens.dms.domain.outing.spi.vo.OutingAvailableTimeVO
import team.aliens.dms.domain.outing.spi.vo.OutingCompanionDetailsVO
import team.aliens.dms.domain.outing.spi.vo.OutingHistoryVO
import team.aliens.dms.domain.student.model.Student
import java.time.LocalDate
import java.time.LocalTime
import java.util.UUID

data class GetAllOutingTypeTitlesResponse(
val titles: List<String>
Expand All @@ -18,7 +22,8 @@ data class ExportAllOutingApplicationsResponse(
)

data class GetCurrentOutingApplicationResponse(
val outAt: LocalDate,
val id: UUID,
val outingDate: LocalDate,
val outingTypeTitle: String,
val status: OutingStatus,
val outingTime: LocalTime,
Expand All @@ -31,7 +36,8 @@ data class GetCurrentOutingApplicationResponse(
fun of(currentOutingApplicationVO: CurrentOutingApplicationVO) =
currentOutingApplicationVO.run {
GetCurrentOutingApplicationResponse(
outAt = outAt,
id = id,
outingDate = outingDate,
outingTypeTitle = outingTypeTitle,
status = status,
outingTime = outingTime,
Expand All @@ -50,3 +56,56 @@ data class OutingApplicationHistoriesResponse(
data class OutingAvailableTimesResponse(
val outingAvailableTimes: List<OutingAvailableTimeVO>
)

data class OutingHistoryDetailsResponse(
val studentName: String,
val studentGcn: String,
val studentRoomNumber: String,
val outingTime: LocalTime,
val arrivalTime: LocalTime,
val outingStatus: OutingStatus,
@field:JsonInclude(JsonInclude.Include.ALWAYS)
val reason: String?,
val outingType: String,
val students: List<OutingCompanionsResponse>
) {
companion object {
fun of(
outingHistory: OutingApplication,
outingCompanions: List<OutingCompanionDetailsVO>,
student: Student
): OutingHistoryDetailsResponse {
return OutingHistoryDetailsResponse(
studentName = student.name,
studentGcn = student.gcn,
studentRoomNumber = student.roomNumber,
outingTime = outingHistory.outingTime,
arrivalTime = outingHistory.arrivalTime,
outingStatus = outingHistory.status,
reason = outingHistory.reason,
outingType = outingHistory.outingTypeTitle,
students = outingCompanions.map {
OutingCompanionsResponse.of(it)
}
)
}
}
}

data class OutingCompanionsResponse(
val id: UUID,
val studentName: String,
val roomNumber: String,
val studentGcn: String
) {
companion object {
fun of(outingCompanions: OutingCompanionDetailsVO): OutingCompanionsResponse {
return OutingCompanionsResponse(
id = outingCompanions.id,
studentName = outingCompanions.studentName,
roomNumber = outingCompanions.roomNumber,
studentGcn = outingCompanions.studentGcn
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ data class OutingApplication(

val createdAt: LocalDateTime,

val outAt: LocalDate,
val outingDate: LocalDate,

val outingTime: LocalTime,

Expand All @@ -35,10 +35,8 @@ data class OutingApplication(

) : SchoolIdDomain {

fun checkCancelable(
status: OutingStatus
) {
if (status != OutingStatus.REQUESTED) {
fun checkCancelable(status: OutingStatus) {
if (status != OutingStatus.APPROVED) {
throw OutingTypeMismatchException
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package team.aliens.dms.domain.outing.model
enum class OutingStatus {
REQUESTED,
OUTING,
DONE
DONE,
APPROVED
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface CheckOutingService {

fun checkOutingApplicationAvailable(
studentId: UUID,
outAt: LocalDate,
outingDate: LocalDate,
outingTime: LocalTime,
arrivalTime: LocalTime
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ class CheckOutingServiceImpl(

override fun checkOutingApplicationAvailable(
studentId: UUID,
outAt: LocalDate,
outingDate: LocalDate,
outingTime: LocalTime,
arrivalTime: LocalTime
) {
checkOutingAvailableTime(outAt, outingTime, arrivalTime)
checkOutingApplicationExistsByOutAtAndStudentId(outAt, studentId)
checkOutingAvailableTime(outingDate, outingTime, arrivalTime)
checkOutingApplicationExistsByOutingDateAndStudentId(outingDate, studentId)
}

private fun checkOutingAvailableTime(
outAt: LocalDate,
outingDate: LocalDate,
outingTime: LocalTime,
arrivalTime: LocalTime
) {
queryOutingAvailableTimePort.queryOutingAvailableTimeByDayOfWeek(outAt.dayOfWeek)
?.checkAvailable(outAt.dayOfWeek, outingTime, arrivalTime)
queryOutingAvailableTimePort.queryOutingAvailableTimeByDayOfWeek(outingDate.dayOfWeek)
?.checkAvailable(outingDate.dayOfWeek, outingTime, arrivalTime)
?: throw OutingAvailableTimeMismatchException
}

private fun checkOutingApplicationExistsByOutAtAndStudentId(outAt: LocalDate, studentId: UUID) {
if (queryOutingApplicationPort.existOutingApplicationByOutAtAndStudentId(outAt, studentId)) {
private fun checkOutingApplicationExistsByOutingDateAndStudentId(outingDate: LocalDate, studentId: UUID) {
if (queryOutingApplicationPort.existOutingApplicationByOutingDateAndStudentId(outingDate, studentId)) {
throw OutingApplicationAlreadyExistsException
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import team.aliens.dms.domain.outing.model.OutingType
import team.aliens.dms.domain.outing.spi.vo.CurrentOutingApplicationVO
import team.aliens.dms.domain.outing.spi.vo.OutingApplicationVO
import team.aliens.dms.domain.outing.spi.vo.OutingAvailableTimeVO
import team.aliens.dms.domain.outing.spi.vo.OutingCompanionDetailsVO
import team.aliens.dms.domain.outing.spi.vo.OutingHistoryVO
import java.time.DayOfWeek
import java.time.LocalDate
Expand All @@ -25,4 +26,6 @@ interface GetOutingService {
fun getOutingHistoriesByStudentNameAndDate(studentName: String?, date: LocalDate): List<OutingHistoryVO>

fun getOutingAvailableTimesByDayOfWeek(dayOfWeek: DayOfWeek): List<OutingAvailableTimeVO>

fun getOutingCompanionsByApplicationId(outingApplicationId: UUID): List<OutingCompanionDetailsVO>
}
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
package team.aliens.dms.domain.outing.service

import org.springframework.stereotype.Service
import team.aliens.dms.domain.outing.exception.OutingApplicationNotFoundException
import team.aliens.dms.domain.outing.exception.OutingTypeNotFoundException
import team.aliens.dms.domain.outing.model.OutingApplication
import team.aliens.dms.domain.outing.model.OutingType
import team.aliens.dms.domain.outing.spi.QueryOutingApplicationPort
import team.aliens.dms.domain.outing.spi.QueryOutingAvailableTimePort
import team.aliens.dms.domain.outing.spi.QueryOutingTypePort
import team.aliens.dms.domain.outing.spi.vo.CurrentOutingApplicationVO
import team.aliens.dms.domain.outing.spi.vo.OutingHistoryVO
import java.time.DayOfWeek
import java.time.LocalDate
import java.util.UUID

@Service
class GetOutingServiceImpl(
private val queryOutingTypePort: QueryOutingTypePort,
private val queryOutingApplicationPort: QueryOutingApplicationPort,
private val queryOutingAvailableTimePort: QueryOutingAvailableTimePort
) : GetOutingService {

override fun getOutingType(outingType: OutingType) =
queryOutingTypePort.queryOutingType(outingType) ?: throw OutingTypeNotFoundException

override fun getAllOutingTypeTitlesBySchoolIdAndKeyword(schoolId: UUID, keyword: String?) =
queryOutingTypePort.queryAllOutingTypeTitlesBySchoolIdAndKeyword(schoolId, keyword)

override fun getOutingApplicationById(outingApplicationId: UUID): OutingApplication =
queryOutingApplicationPort.queryOutingApplicationById(outingApplicationId)
?: throw OutingApplicationNotFoundException

override fun getAllOutingApplicationVOsBetweenStartAndEnd(start: LocalDate, end: LocalDate) =
queryOutingApplicationPort.queryAllOutingApplicationVOsBetweenStartAndEnd(start, end)

override fun getCurrentOutingApplication(studentId: UUID): CurrentOutingApplicationVO =
queryOutingApplicationPort.queryCurrentOutingApplicationVO(studentId)
?: throw OutingApplicationNotFoundException

override fun getOutingHistoriesByStudentNameAndDate(
studentName: String?,
date: LocalDate
): List<OutingHistoryVO> = queryOutingApplicationPort.queryOutingHistoriesByStudentNameAndDate(studentName, date)

override fun getOutingAvailableTimesByDayOfWeek(
dayOfWeek: DayOfWeek
) = queryOutingAvailableTimePort.queryOutingAvailableTimesByDayOfWeek(
dayOfWeek = dayOfWeek
)
}
package team.aliens.dms.domain.outing.service

import team.aliens.dms.common.annotation.Service
import team.aliens.dms.domain.outing.exception.OutingApplicationNotFoundException
import team.aliens.dms.domain.outing.exception.OutingTypeNotFoundException
import team.aliens.dms.domain.outing.model.OutingApplication
import team.aliens.dms.domain.outing.model.OutingType
import team.aliens.dms.domain.outing.spi.QueryOutingApplicationPort
import team.aliens.dms.domain.outing.spi.QueryOutingAvailableTimePort
import team.aliens.dms.domain.outing.spi.QueryOutingCompanionPort
import team.aliens.dms.domain.outing.spi.QueryOutingTypePort
import team.aliens.dms.domain.outing.spi.vo.CurrentOutingApplicationVO
import team.aliens.dms.domain.outing.spi.vo.OutingCompanionDetailsVO
import team.aliens.dms.domain.outing.spi.vo.OutingHistoryVO
import java.time.DayOfWeek
import java.time.LocalDate
import java.util.UUID

@Service
class GetOutingServiceImpl(
private val queryOutingTypePort: QueryOutingTypePort,
private val queryOutingApplicationPort: QueryOutingApplicationPort,
private val queryOutingAvailableTimePort: QueryOutingAvailableTimePort,
private val queryOutingCompanionPort: QueryOutingCompanionPort
) : GetOutingService {

override fun getOutingType(outingType: OutingType) =
queryOutingTypePort.queryOutingType(outingType) ?: throw OutingTypeNotFoundException

override fun getAllOutingTypeTitlesBySchoolIdAndKeyword(schoolId: UUID, keyword: String?) =
queryOutingTypePort.queryAllOutingTypeTitlesBySchoolIdAndKeyword(schoolId, keyword)

override fun getOutingApplicationById(outingApplicationId: UUID): OutingApplication =
queryOutingApplicationPort.queryOutingApplicationById(outingApplicationId)
?: throw OutingApplicationNotFoundException

override fun getAllOutingApplicationVOsBetweenStartAndEnd(start: LocalDate, end: LocalDate) =
queryOutingApplicationPort.queryAllOutingApplicationVOsBetweenStartAndEnd(start, end)

override fun getCurrentOutingApplication(studentId: UUID): CurrentOutingApplicationVO =
queryOutingApplicationPort.queryCurrentOutingApplicationVO(studentId)
?: throw OutingApplicationNotFoundException

override fun getOutingHistoriesByStudentNameAndDate(
studentName: String?,
date: LocalDate
): List<OutingHistoryVO> = queryOutingApplicationPort.queryOutingHistoriesByStudentNameAndDate(studentName, date)

override fun getOutingAvailableTimesByDayOfWeek(
dayOfWeek: DayOfWeek
) = queryOutingAvailableTimePort.queryOutingAvailableTimesByDayOfWeek(
dayOfWeek = dayOfWeek
)

override fun getOutingCompanionsByApplicationId(outingApplicationId: UUID): List<OutingCompanionDetailsVO> =
queryOutingCompanionPort.queryOutingCompanionsById(outingApplicationId)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package team.aliens.dms.domain.outing.spi

interface OutingCompanionPort :
QueryOutingCompanionPort,
CommandOutingCompanionPort
Loading

0 comments on commit c1d6e01

Please sign in to comment.