-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathEventController.kt
More file actions
19 lines (17 loc) · 870 Bytes
/
EventController.kt
File metadata and controls
19 lines (17 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.example.attendanceapimono.adapter.present
import com.example.attendanceapimono.adapter.present.api.EventAPI
import com.example.attendanceapimono.application.EventService
import com.example.attendanceapimono.application.dto.event.CreateEventRequest
import com.example.attendanceapimono.application.dto.event.CreateEventResponse
import com.example.attendanceapimono.application.exception.handleValidationCatch
import kotlinx.coroutines.reactor.awaitSingle
import org.springframework.web.bind.annotation.RestController
import reactor.core.publisher.Mono
@RestController
class EventController (private val eventService: EventService): EventAPI {
override suspend fun createEvent(body: Mono<CreateEventRequest>): CreateEventResponse {
return body.handleValidationCatch()
.map(eventService::createEvent)
.awaitSingle()
}
}