Skip to content
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 @@ -76,6 +76,8 @@ class SessionController(
): SessionResponse {
val session = sessionService.updateSession(
sessionId = ObjectId(sessionId),
generation = request.generation,
week = request.week,
title = request.title,
description = request.description,
place = request.place,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ data class SessionRequest(
val place: SessionPlace?,
val startTime: LocalDateTime,
val endTime: LocalDateTime,
)
) {
init {
require(generation > 0) { "generation must be greater than 0" }
require(week > 0) { "week must be greater than 0" }
}
}

data class SessionGenerationRequest(
val generation: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class SessionService(

fun updateSession(
sessionId: ObjectId,
generation: Int,
week: Int,
title: String,
description: String,
place: SessionPlace?,
Expand All @@ -59,6 +61,8 @@ class SessionService(
): Session {
val session = sessionRepository.findByIdOrNull(sessionId) ?: throw DomainException(ErrorCode.NOT_FOUND)
session.update(
generation = generation,
week = week,
title = title,
description = description,
place = place,
Expand Down