Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaisqls committed Mar 31, 2023
2 parents e6db71a + a0fbb69 commit a8830b0
Show file tree
Hide file tree
Showing 251 changed files with 5,500 additions and 2,650 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
build:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: CD for Dev
on:
push:
branches:
- main
- develop

jobs:
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ object Dependencies {
const val KOTLIN_REFLECT = "org.jetbrains.kotlin:kotlin-reflect"
const val KOTLIN_JDK = "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
const val JACKSON = "com.fasterxml.jackson.module:jackson-module-kotlin:${DependencyVersions.JACKSON_VERSION}"
const val JACKSON_TYPE = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${DependencyVersions.JACKSON_VERSION}"

// java servlet
const val JAVA_SERVLET = "javax.servlet:javax.servlet-api:${DependencyVersions.SERVLET_VERSION}"
Expand Down
1 change: 1 addition & 0 deletions dms-application/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ dependencies {
allOpen {
annotation("team.aliens.dms.common.annotation.UseCase")
annotation("team.aliens.dms.common.annotation.ReadOnlyUseCase")
annotation("team.aliens.dms.common.annotation.SchedulerUseCase")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package team.aliens.dms.common.annotation

import org.springframework.transaction.annotation.Transactional

@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
@Transactional
annotation class SchedulerUseCase
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import team.aliens.dms.domain.remain.spi.RemainSecurityPort
import team.aliens.dms.domain.school.spi.SchoolSecurityPort
import team.aliens.dms.domain.student.spi.StudentSecurityPort
import team.aliens.dms.domain.studyroom.spi.StudyRoomSecurityPort
import team.aliens.dms.domain.tag.spi.TagSecurityPort
import team.aliens.dms.domain.user.spi.UserSecurityPort

interface SecurityPort :
Expand All @@ -21,6 +22,7 @@ interface SecurityPort :
NoticeSecurityPort,
SchoolSecurityPort,
PointSecurityPort,
TagSecurityPort,
StudyRoomSecurityPort,
RemainSecurityPort,
FileSecurityPort
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package team.aliens.dms.common.util

object FileUtil {

fun isCorrectExtension(extension: String) =
when (extension.lowercase()) {
"jpg", "jpeg", "png", "heic" -> true
else -> false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package team.aliens.dms.domain.auth.exception
import team.aliens.dms.common.error.DmsException
import team.aliens.dms.domain.auth.error.AuthErrorCode

object UnverifiedAuthCodeException: DmsException(
object UnverifiedAuthCodeException : DmsException(
AuthErrorCode.UNVERIFIED_AUTH_CODE
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package team.aliens.dms.domain.file.dto

data class GetFileUploadUrlResponse(
val fileUploadUrl: String,
val fileUrl: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ import java.io.File
interface UploadFilePort {

fun upload(file: File): String
fun getResourceUrl(fileName: String): String
fun getUploadUrl(fileName: String): String
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@ package team.aliens.dms.domain.file.spi

import team.aliens.dms.domain.point.model.PointHistory
import team.aliens.dms.domain.remain.dto.StudentRemainInfo
import team.aliens.dms.domain.studyroom.model.TimeSlot
import team.aliens.dms.domain.studyroom.spi.vo.StudentSeatInfo
import java.io.File

interface WriteFilePort {

fun writePointHistoryExcelFile(pointHistories: List<PointHistory>): ByteArray

fun writeRemainStatusExcelFile(studentRemainInfos: List<StudentRemainInfo>): ByteArray

fun addStudyRoomApplicationStatusExcelFile(
baseFile: File,
timeSlots: List<TimeSlot>,
studentSeatsMap: Map<Pair<String, String>, StudentSeatInfo>
): ByteArray

fun writeStudyRoomApplicationStatusExcelFile(
timeSlots: List<TimeSlot>,
studentSeats: List<StudentSeatInfo>
): ByteArray
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package team.aliens.dms.domain.file.usecase

import team.aliens.dms.common.annotation.ReadOnlyUseCase
import team.aliens.dms.common.util.FileUtil
import team.aliens.dms.domain.file.dto.GetFileUploadUrlResponse
import team.aliens.dms.domain.file.exception.FileInvalidExtensionException
import team.aliens.dms.domain.file.spi.UploadFilePort
import java.util.UUID

@ReadOnlyUseCase
class GetFileUploadUrlUseCase(
val filePort: UploadFilePort
) {
fun execute(fileName: String): GetFileUploadUrlResponse {

val extension = fileName.substring(fileName.lastIndexOf(".").inc())
if (!FileUtil.isCorrectExtension(extension)) {
throw FileInvalidExtensionException
}

val fileNameToSave = "${UUID.randomUUID()}||$fileName"

return GetFileUploadUrlResponse(
fileUploadUrl = filePort.getUploadUrl(fileNameToSave),
fileUrl = filePort.getResourceUrl(fileNameToSave)
)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package team.aliens.dms.domain.file.usecase

import team.aliens.dms.common.annotation.ReadOnlyUseCase
import team.aliens.dms.common.util.FileUtil
import team.aliens.dms.domain.file.exception.FileInvalidExtensionException
import team.aliens.dms.domain.file.spi.UploadFilePort
import java.io.File
Expand All @@ -11,16 +12,10 @@ class UploadFileUseCase(
) {

fun execute(file: File): String {
if (!file.isCorrectExtension(file)) {
if (!FileUtil.isCorrectExtension(file.extension)) {
file.delete()
throw FileInvalidExtensionException
}

return uploadFilePort.upload(file)
}

internal fun File.isCorrectExtension(file: File) = when (file.extension.lowercase()) {
"jpg", "jpeg", "png", "heic" -> true
else -> false
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
package team.aliens.dms.domain.manager.dto

import team.aliens.dms.domain.student.model.Sex
import team.aliens.dms.domain.tag.dto.TagResponse
import java.util.UUID

data class GetStudentDetailsResponse(
val id: UUID,
val name: String,
val gcn: String,
val profileImageUrl: String,
val sex: Sex,
val bonusPoint: Int,
val minusPoint: Int,
val roomNumber: String,
val roomMates: List<RoomMate>

val roomMates: List<RoomMate>,
val tags: List<TagResponse>
) {
data class RoomMate(
val id: UUID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ data class QueryStudentsResponse(
val gcn: String,
val sex: Sex,
val roomNumber: String,
val profileImageUrl: String
val profileImageUrl: String,
val tags: List<StudentTagElement>
)

data class StudentTagElement(
val id: UUID,
val name: String,
val color: String
)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package team.aliens.dms.domain.manager.spi

import team.aliens.dms.domain.manager.dto.PointFilter
import team.aliens.dms.domain.manager.dto.Sort
import team.aliens.dms.domain.manager.spi.vo.StudentWithTag
import team.aliens.dms.domain.student.model.Student
import java.util.UUID

Expand All @@ -13,8 +14,9 @@ interface ManagerQueryStudentPort {
name: String?,
sort: Sort,
schoolId: UUID,
pointFilter: PointFilter
): List<Student>
pointFilter: PointFilter,
tagIds: List<UUID>?
): List<StudentWithTag>

fun queryUserByRoomNumberAndSchoolId(roomNumber: String, schoolId: UUID): List<Student>
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
package team.aliens.dms.domain.manager.spi

import team.aliens.dms.domain.studyroom.model.Seat
import team.aliens.dms.domain.studyroom.model.StudyRoom
import java.util.UUID

interface ManagerQueryStudyRoomPort {

fun querySeatByStudentId(studentId: UUID): Seat?

fun queryStudyRoomById(studyRoomId: UUID): StudyRoom?
}
interface ManagerQueryStudyRoomPort
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package team.aliens.dms.domain.manager.spi

import team.aliens.dms.domain.tag.model.Tag
import java.util.UUID

interface ManagerQueryTagPort {

fun queryTagsByStudentId(studentId: UUID): List<Tag>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package team.aliens.dms.domain.manager.spi.vo

import team.aliens.dms.domain.student.model.Sex
import team.aliens.dms.domain.student.model.Student
import team.aliens.dms.domain.tag.model.Tag
import java.util.UUID

data class StudentWithTag(
val id: UUID,
val name: String,
val grade: Int,
val classRoom: Int,
val number: Int,
val roomNumber: String,
val profileImageUrl: String,
val sex: Sex,
val tags: List<Tag>
) {
val gcn: String = Student.processGcn(this.grade, this.classRoom, this.number)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ import team.aliens.dms.domain.manager.dto.GetStudentDetailsResponse
import team.aliens.dms.domain.manager.exception.ManagerNotFoundException
import team.aliens.dms.domain.manager.spi.ManagerQueryPointHistoryPort
import team.aliens.dms.domain.manager.spi.ManagerQueryStudentPort
import team.aliens.dms.domain.manager.spi.ManagerQueryTagPort
import team.aliens.dms.domain.manager.spi.ManagerSecurityPort
import team.aliens.dms.domain.manager.spi.QueryManagerPort
import team.aliens.dms.domain.school.validateSameSchool
import team.aliens.dms.domain.student.exception.StudentNotFoundException
import team.aliens.dms.domain.tag.dto.TagResponse
import java.util.UUID

@ReadOnlyUseCase
class QueryStudentDetailsUseCase(
private val securityPort: ManagerSecurityPort,
private val queryManagerPort: QueryManagerPort,
private val queryStudentPort: ManagerQueryStudentPort,
private val queryPointHistoryPort: ManagerQueryPointHistoryPort
private val queryPointHistoryPort: ManagerQueryPointHistoryPort,
private val queryTagPort: ManagerQueryTagPort
) {

fun execute(studentId: UUID): GetStudentDetailsResponse {
Expand All @@ -43,15 +46,26 @@ class QueryStudentDetailsUseCase(
)
}

val tags = queryTagPort.queryTagsByStudentId(studentId)
.map {
TagResponse(
id = it.id,
name = it.name,
color = it.color
)
}

return GetStudentDetailsResponse(
id = student.id,
name = student.name,
gcn = student.gcn,
profileImageUrl = student.profileImageUrl!!,
sex = student.sex,
bonusPoint = bonusPoint,
minusPoint = minusPoint,
roomNumber = student.roomNumber,
roomMates = roomMates
roomMates = roomMates,
tags = tags
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import team.aliens.dms.domain.manager.exception.ManagerNotFoundException
import team.aliens.dms.domain.manager.spi.ManagerQueryStudentPort
import team.aliens.dms.domain.manager.spi.ManagerSecurityPort
import team.aliens.dms.domain.manager.spi.QueryManagerPort
import java.util.UUID

@ReadOnlyUseCase
class QueryStudentsUseCase(
Expand All @@ -22,7 +23,8 @@ class QueryStudentsUseCase(
sort: Sort,
filterType: PointFilterType?,
minPoint: Int?,
maxPoint: Int?
maxPoint: Int?,
tagIds: List<UUID>?
): QueryStudentsResponse {
val currentUserId = securityPort.getCurrentUserId()
val manager = queryManagerPort.queryManagerById(currentUserId) ?: throw ManagerNotFoundException
Expand All @@ -37,15 +39,25 @@ class QueryStudentsUseCase(
name = name,
sort = sort,
schoolId = manager.schoolId,
pointFilter = pointFilter
pointFilter = pointFilter,
tagIds = tagIds
).map {
QueryStudentsResponse.StudentElement(
id = it.id,
name = it.name,
gcn = it.gcn,
roomNumber = it.roomNumber,
profileImageUrl = it.profileImageUrl!!,
sex = it.sex
profileImageUrl = it.profileImageUrl,
sex = it.sex,
tags = it.tags
.map {
tag ->
QueryStudentsResponse.StudentTagElement(
id = tag.id,
name = tag.name,
color = tag.color
)
}
)
}

Expand Down
Loading

0 comments on commit a8830b0

Please sign in to comment.