Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 워크스페이스 이벤트 조회 #115

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data class EventWithUserAndChatRoomDto(
val users: List<UserDto>,
val finishedCount: Int,
val totalAssignedCount: Int,
val eventType: String,
) {
companion object {
fun of(
Expand All @@ -34,6 +35,7 @@ data class EventWithUserAndChatRoomDto(
users = users.map { UserDto.of(it) },
finishedCount = finishedCount,
totalAssignedCount = users.size,
eventType = event.getEventType(),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import io.swagger.v3.oas.annotations.media.Schema
import java.time.LocalDateTime

data class EventBriefResponse(
@Schema(
description = "이벤트 타입",
example = "TASK",
)
val eventType: String,
@Schema(
description = "이벤트 아이디",
example = "2",
Expand Down Expand Up @@ -71,6 +76,7 @@ data class EventBriefResponse(
finishedCount = event.finishedCount,
totalAssignedCount = event.totalAssignedCount,
isMine = event.users.any { it.id == userId },
eventType = event.eventType,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ abstract class Event(
fun isAchieved(user: List<EventAssignedUser>): Boolean = user.size == user.count { it.isFinished }

fun isClosed(): Boolean = LocalDateTime.now().isAfter(deadLine)

abstract fun getEventType(): String
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class ReactionEvent(
createdAt: LocalDateTime = LocalDateTime.now(),
updatedAt: LocalDateTime = LocalDateTime.now(),
) : Event(id, eventTitle, deadLine, notificationStartTime, notificationInterval, createdAt, updatedAt) {
companion object {
const val EVENT_TYPE = "REPLY"
}

fun createReactionOption(contents: List<String>) =
contents.map {
ReactionOption(
Expand All @@ -27,4 +31,6 @@ class ReactionEvent(
userId = userId,
optionId = optionId,
)

override fun getEventType(): String = EVENT_TYPE
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class ReplyEvent(
createdAt: LocalDateTime = LocalDateTime.now(),
updatedAt: LocalDateTime = LocalDateTime.now(),
) : Event(id, eventTitle, deadLine, notificationStartTime, notificationInterval, createdAt, updatedAt) {
companion object {
const val EVENT_TYPE = "REPLY"
}

fun addReplyComment(
user: User,
content: String,
Expand All @@ -21,4 +25,6 @@ class ReplyEvent(
eventId = id,
content = content,
)

override fun getEventType(): String = EVENT_TYPE
}
Loading