Skip to content

Commit 264f5a7

Browse files
authored
Merge pull request #115 from soma-baekgu/feature/BG-257-ongoing-event-retrieve
feat: 워크스페이스 이벤트 조회
2 parents d3fcb52 + f96b6f9 commit 264f5a7

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

api/src/main/kotlin/com/backgu/amaker/api/event/dto/EventWithUserAndChatRoomDto.kt

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ data class EventWithUserAndChatRoomDto(
1616
val users: List<UserDto>,
1717
val finishedCount: Int,
1818
val totalAssignedCount: Int,
19+
val eventType: String,
1920
) {
2021
companion object {
2122
fun of(
@@ -34,6 +35,7 @@ data class EventWithUserAndChatRoomDto(
3435
users = users.map { UserDto.of(it) },
3536
finishedCount = finishedCount,
3637
totalAssignedCount = users.size,
38+
eventType = event.getEventType(),
3739
)
3840
}
3941
}

api/src/main/kotlin/com/backgu/amaker/api/event/dto/response/EventBriefResponse.kt

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import io.swagger.v3.oas.annotations.media.Schema
55
import java.time.LocalDateTime
66

77
data class EventBriefResponse(
8+
@Schema(
9+
description = "이벤트 타입",
10+
example = "TASK",
11+
)
12+
val eventType: String,
813
@Schema(
914
description = "이벤트 아이디",
1015
example = "2",
@@ -71,6 +76,7 @@ data class EventBriefResponse(
7176
finishedCount = event.finishedCount,
7277
totalAssignedCount = event.totalAssignedCount,
7378
isMine = event.users.any { it.id == userId },
79+
eventType = event.eventType,
7480
)
7581
}
7682
}

domain/src/main/kotlin/com/backgu/amaker/domain/event/Event.kt

+2
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ abstract class Event(
3333
fun isAchieved(user: List<EventAssignedUser>): Boolean = user.size == user.count { it.isFinished }
3434

3535
fun isClosed(): Boolean = LocalDateTime.now().isAfter(deadLine)
36+
37+
abstract fun getEventType(): String
3638
}

domain/src/main/kotlin/com/backgu/amaker/domain/event/ReactionEvent.kt

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class ReactionEvent(
1111
createdAt: LocalDateTime = LocalDateTime.now(),
1212
updatedAt: LocalDateTime = LocalDateTime.now(),
1313
) : Event(id, eventTitle, deadLine, notificationStartTime, notificationInterval, createdAt, updatedAt) {
14+
companion object {
15+
const val EVENT_TYPE = "REPLY"
16+
}
17+
1418
fun createReactionOption(contents: List<String>) =
1519
contents.map {
1620
ReactionOption(
@@ -27,4 +31,6 @@ class ReactionEvent(
2731
userId = userId,
2832
optionId = optionId,
2933
)
34+
35+
override fun getEventType(): String = EVENT_TYPE
3036
}

domain/src/main/kotlin/com/backgu/amaker/domain/event/ReplyEvent.kt

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ class ReplyEvent(
1313
createdAt: LocalDateTime = LocalDateTime.now(),
1414
updatedAt: LocalDateTime = LocalDateTime.now(),
1515
) : Event(id, eventTitle, deadLine, notificationStartTime, notificationInterval, createdAt, updatedAt) {
16+
companion object {
17+
const val EVENT_TYPE = "REPLY"
18+
}
19+
1620
fun addReplyComment(
1721
user: User,
1822
content: String,
@@ -21,4 +25,6 @@ class ReplyEvent(
2125
eventId = id,
2226
content = content,
2327
)
28+
29+
override fun getEventType(): String = EVENT_TYPE
2430
}

0 commit comments

Comments
 (0)