Skip to content

Commit 4912934

Browse files
authored
Merge pull request #376 from GSM-MSG/feature/375-markingboard
MarkingBoard, MakringValue 모델 추가 및 학생 폼 리스트 조회
2 parents 807f9bb + c6991f3 commit 4912934

File tree

51 files changed

+686
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+686
-21
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package team.msg.sms.domain.authentication.dto.res
2+
3+
data class UserBoardPageResponseData(
4+
val content: List<UserBoardWithStudentInfoResponseData>,
5+
val page: Int,
6+
val contentSize: Int,
7+
val last: Boolean,
8+
val totalSize: Long
9+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package team.msg.sms.domain.authentication.dto.res
2+
3+
import team.msg.sms.domain.authentication.model.MarkingBoardType
4+
import java.util.*
5+
6+
data class UserBoardWithStudentInfoResponseData(
7+
val id: UUID?,
8+
val title: String,
9+
val studentId: UUID,
10+
val type: MarkingBoardType,
11+
val profileImgUrl: String,
12+
val totalScore: Double
13+
)

sms-core/src/main/kotlin/team/msg/sms/domain/authentication/model/AuthenticationForm.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ class AuthenticationForm(
1010
val title: String,
1111
val version: String,
1212
val createdBy: UUID,
13-
val createdAt: LocalDateTime
13+
val createdAt: LocalDateTime,
14+
val active: Boolean
1415
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package team.msg.sms.domain.authentication.model
2+
3+
import java.util.*
4+
5+
data class MarkingBoard(
6+
val id: UUID,
7+
val title: String,
8+
val authenticationId: UUID,
9+
val studentId: UUID,
10+
val totalScore: Double = 0.0,
11+
val markingBoardType: MarkingBoardType
12+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package team.msg.sms.domain.authentication.model
2+
3+
enum class MarkingBoardType {
4+
NOT_SUBMITTED,
5+
PENDING_REVIEW,
6+
UNDER_REVIEW,
7+
COMPLETED
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package team.msg.sms.domain.authentication.model
2+
3+
enum class MarkingType{
4+
RESOLVE,
5+
REJECT
6+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package team.msg.sms.domain.authentication.model
2+
3+
import java.time.LocalDateTime
4+
import java.util.UUID
5+
6+
data class MarkingValue(
7+
val id: UUID,
8+
val score: Double,
9+
val type: MarkingType,
10+
val fieldId: UUID,
11+
val groupId: UUID,
12+
val createdAt: LocalDateTime,
13+
val createdBy: UUID
14+
)

sms-core/src/main/kotlin/team/msg/sms/domain/authentication/model/UserFormValue.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class UserFormValue(
1212
val authenticationSectionId: UUID,
1313
val authenticationFieldId: UUID,
1414
val value: String?,
15-
val score: Int,
1615
val fieldType: FieldType,
1716
val targetId: UUID?,
1817
val createdBy: UUID,

sms-core/src/main/kotlin/team/msg/sms/domain/authentication/service/AuthenticationFormService.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ import team.msg.sms.common.annotation.Service
55
@Service
66
class AuthenticationFormService(
77
commandAuthenticationFormService: CommandAuthenticationFormService,
8-
) : CommandAuthenticationFormService by commandAuthenticationFormService
8+
getAuthenticationFormService: GetAuthenticationFormService
9+
) : CommandAuthenticationFormService by commandAuthenticationFormService,
10+
GetAuthenticationFormService by getAuthenticationFormService
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package team.msg.sms.domain.authentication.service
2+
3+
import team.msg.sms.domain.authentication.model.MarkingBoard
4+
5+
interface CommandMarkingBoardService {
6+
fun save(markingBoard: MarkingBoard)
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package team.msg.sms.domain.authentication.service
2+
3+
import java.util.UUID
4+
5+
interface GetAuthenticationFormService {
6+
fun getActiveAuthenticationFormId(): UUID
7+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package team.msg.sms.domain.authentication.service
2+
3+
import team.msg.sms.domain.authentication.dto.res.UserBoardPageResponseData
4+
import team.msg.sms.domain.authentication.model.MarkingBoardType
5+
import java.util.*
6+
7+
interface GetMarkingBoardService {
8+
fun getMarkingBoardByStudentIds(
9+
studentIds: List<UUID>,
10+
authenticationId: UUID,
11+
page: Int,
12+
size: Int
13+
): UserBoardPageResponseData
14+
15+
fun getMarkingBoardByStudentIdsWithType(
16+
studentIds: List<UUID>,
17+
authenticationId: UUID,
18+
page: Int,
19+
size: Int, type: List<MarkingBoardType>
20+
): UserBoardPageResponseData
21+
22+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package team.msg.sms.domain.authentication.service
2+
3+
import team.msg.sms.common.annotation.Service
4+
5+
@Service
6+
class MarkingBoardService(
7+
getMarkingBoardService: GetMarkingBoardService,
8+
commandMarkingBoardService: CommandMarkingBoardService
9+
) : GetMarkingBoardService by getMarkingBoardService,
10+
CommandMarkingBoardService by commandMarkingBoardService
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package team.msg.sms.domain.authentication.service.impl
2+
3+
import team.msg.sms.common.annotation.Service
4+
import team.msg.sms.domain.authentication.model.MarkingBoard
5+
import team.msg.sms.domain.authentication.service.CommandMarkingBoardService
6+
import team.msg.sms.domain.authentication.spi.MarkingBoardPort
7+
8+
@Service
9+
class CommandMarkingBoardServiceImpl(
10+
private val markingBoardPort: MarkingBoardPort
11+
): CommandMarkingBoardService {
12+
override fun save(markingBoard: MarkingBoard) {
13+
markingBoardPort.save(markingBoard)
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package team.msg.sms.domain.authentication.service.impl
2+
3+
import team.msg.sms.common.annotation.Service
4+
import team.msg.sms.domain.authentication.service.GetAuthenticationFormService
5+
import team.msg.sms.domain.authentication.spi.AuthenticationFormPort
6+
import java.util.*
7+
8+
@Service
9+
class GetAuthenticationFormServiceImpl(
10+
private val authenticationFormPort: AuthenticationFormPort
11+
) : GetAuthenticationFormService {
12+
override fun getActiveAuthenticationFormId(): UUID =
13+
authenticationFormPort.queryActiveAuthenticationFormId()
14+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package team.msg.sms.domain.authentication.service.impl
2+
3+
import team.msg.sms.common.annotation.Service
4+
import team.msg.sms.domain.authentication.dto.res.UserBoardPageResponseData
5+
import team.msg.sms.domain.authentication.dto.res.UserBoardWithStudentInfoResponseData
6+
import team.msg.sms.domain.authentication.model.MarkingBoardType
7+
import team.msg.sms.domain.authentication.service.GetMarkingBoardService
8+
import team.msg.sms.domain.authentication.spi.MarkingBoardPort
9+
import java.util.UUID
10+
11+
@Service
12+
class GetMarkingBoardServiceImpl(
13+
private val markingBoardPort: MarkingBoardPort
14+
) : GetMarkingBoardService {
15+
override fun getMarkingBoardByStudentIds(
16+
studentIds: List<UUID>,
17+
authenticationId: UUID,
18+
page: Int,
19+
size: Int
20+
): UserBoardPageResponseData {
21+
return markingBoardPort.queryMarkingBoardByStudentIds(studentIds, authenticationId, page, size)
22+
}
23+
24+
override fun getMarkingBoardByStudentIdsWithType(
25+
studentIds: List<UUID>,
26+
authenticationId: UUID,
27+
page: Int,
28+
size: Int,
29+
type: List<MarkingBoardType>
30+
): UserBoardPageResponseData {
31+
return markingBoardPort.queryMarkingBoardByStudentIdsWithType(
32+
studentIds = studentIds,
33+
authenticationId = authenticationId,
34+
page = page,
35+
size = size,
36+
type = type
37+
)
38+
}
39+
40+
}

sms-core/src/main/kotlin/team/msg/sms/domain/authentication/spi/AuthenticationFormPort.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package team.msg.sms.domain.authentication.spi
22

33
import team.msg.sms.domain.authentication.model.AuthenticationForm
44

5-
interface AuthenticationFormPort : CommandAuthenticationFormPort
5+
interface AuthenticationFormPort : CommandAuthenticationFormPort, QueryAuthenticationFormPort
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package team.msg.sms.domain.authentication.spi
2+
3+
import team.msg.sms.domain.authentication.model.MarkingBoard
4+
5+
interface CommandMarkingBoardPort {
6+
fun save(markingBoard: MarkingBoard)
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package team.msg.sms.domain.authentication.spi
2+
3+
interface MarkingBoardPort: CommandMarkingBoardPort, QueryMarkingBoardPort
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package team.msg.sms.domain.authentication.spi
2+
3+
import java.util.UUID
4+
5+
interface QueryAuthenticationFormPort {
6+
fun queryActiveAuthenticationFormId(): UUID
7+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package team.msg.sms.domain.authentication.spi
2+
3+
import team.msg.sms.domain.authentication.dto.res.UserBoardPageResponseData
4+
import team.msg.sms.domain.authentication.model.MarkingBoardType
5+
import java.util.UUID
6+
7+
interface QueryMarkingBoardPort {
8+
fun queryMarkingBoardByStudentIds(
9+
studentIds: List<UUID>,
10+
authenticationId: UUID,
11+
page: Int,
12+
size: Int
13+
): UserBoardPageResponseData
14+
15+
fun queryMarkingBoardByStudentIdsWithType(
16+
studentIds: List<UUID>,
17+
authenticationId: UUID,
18+
page: Int,
19+
size: Int,
20+
type: List<MarkingBoardType>
21+
): UserBoardPageResponseData
22+
}

sms-core/src/main/kotlin/team/msg/sms/domain/authentication/usecase/CreateAuthenticationFormUseCase.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class CreateAuthenticationFormUseCase(
4141
title = requestData.title,
4242
version = requestData.version,
4343
createdBy = teacher.id,
44-
createdAt = LocalDateTime.now()
44+
createdAt = LocalDateTime.now(),
45+
active = false
4546
)
4647
)
4748

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package team.msg.sms.domain.authentication.usecase
2+
3+
import team.msg.sms.common.annotation.ReadOnlyUseCase
4+
import team.msg.sms.domain.authentication.dto.res.UserBoardPageResponseData
5+
import team.msg.sms.domain.authentication.model.MarkingBoardType
6+
import team.msg.sms.domain.authentication.service.AuthenticationFormService
7+
import team.msg.sms.domain.authentication.service.MarkingBoardService
8+
import team.msg.sms.domain.student.service.StudentService
9+
10+
@ReadOnlyUseCase
11+
class QueryStudentFormListUseCase(
12+
private val studentService: StudentService,
13+
private val markingBoardService: MarkingBoardService,
14+
private val authenticationFormService: AuthenticationFormService
15+
) {
16+
fun execute(page: Int, size: Int, type: List<MarkingBoardType>?): UserBoardPageResponseData {
17+
val studentIds = studentService.getStudentIds()
18+
19+
val authenticationFormId = authenticationFormService.getActiveAuthenticationFormId()
20+
21+
return if (type.isNullOrEmpty()) {
22+
markingBoardService.getMarkingBoardByStudentIds(
23+
studentIds = studentIds,
24+
authenticationId = authenticationFormId,
25+
page = page,
26+
size = size
27+
)
28+
} else {
29+
markingBoardService.getMarkingBoardByStudentIdsWithType(
30+
studentIds = studentIds,
31+
authenticationId = authenticationFormId,
32+
page = page,
33+
size = size,
34+
type = type
35+
)
36+
}
37+
}
38+
}

sms-core/src/main/kotlin/team/msg/sms/domain/authentication/usecase/SubmitUserFormDataUseCase.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ package team.msg.sms.domain.authentication.usecase
33
import team.msg.sms.common.annotation.UseCase
44
import team.msg.sms.domain.authentication.dto.req.SubmitUserFormRequestData
55
import team.msg.sms.domain.authentication.model.FieldType
6+
import team.msg.sms.domain.authentication.model.MarkingBoard
7+
import team.msg.sms.domain.authentication.model.MarkingBoardType
68
import team.msg.sms.domain.authentication.model.UserFormValue
79
import team.msg.sms.domain.authentication.service.AuthenticationSectionService
10+
import team.msg.sms.domain.authentication.service.MarkingBoardService
811
import team.msg.sms.domain.authentication.service.UserFormValueService
912
import team.msg.sms.domain.student.service.StudentService
1013
import java.time.LocalDateTime
@@ -14,6 +17,7 @@ import java.util.*
1417
class SubmitUserFormDataUseCase(
1518
private val userFormValueService: UserFormValueService,
1619
private val authenticationSectionService: AuthenticationSectionService,
20+
private val markingBoardService: MarkingBoardService,
1721
private val studentService: StudentService
1822
) {
1923
fun execute(submitDataList: List<SubmitUserFormRequestData>, authenticationFormId: UUID) {
@@ -36,6 +40,15 @@ class SubmitUserFormDataUseCase(
3640
}
3741
}
3842
userFormValueService.saveAll(userFormValues)
43+
44+
val markingBoard = MarkingBoard(
45+
id = UUID.randomUUID(),
46+
title = "${student.name} ${student.stuNum}",
47+
markingBoardType = MarkingBoardType.PENDING_REVIEW,
48+
authenticationId = authenticationFormId,
49+
studentId = student.id,
50+
)
51+
markingBoardService.save(markingBoard)
3952
}
4053

4154
private fun createUserFormValue(
@@ -63,7 +76,6 @@ class SubmitUserFormDataUseCase(
6376
authenticationSectionId = sectionId,
6477
authenticationFieldGroupId = authenticationFieldGroupId,
6578
value = value,
66-
score = 0,
6779
fieldType = submitData.fieldType,
6880
targetId = selectId,
6981
createdAt = LocalDateTime.now(),

sms-core/src/main/kotlin/team/msg/sms/domain/student/service/GetStudentService.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ interface GetStudentService {
2525
fun getStudentByUser(user: User): Student
2626

2727
fun currentStudent(): Student.StudentWithUserInfo
28+
29+
fun getStudentIds(): List<UUID>
2830
}

sms-core/src/main/kotlin/team/msg/sms/domain/student/service/impl/GetStudentServiceImpl.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,7 @@ class GetStudentServiceImpl(
6060
override fun currentStudent(): Student.StudentWithUserInfo =
6161
studentPort.queryStudentUserInfoByUserId(userId = securityPort.getCurrentUserId())
6262
?: throw StudentNotFoundException
63+
64+
override fun getStudentIds(): List<UUID> =
65+
studentPort.queryStudentIds()
6366
}

0 commit comments

Comments
 (0)