Skip to content

Commit

Permalink
chore: call create room service from api
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGiulianelli committed Feb 23, 2023
1 parent e334afc commit 4703808
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/kotlin/infrastructure/api/APIController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@

package infrastructure.api

import application.controller.RoomController
import application.presenter.api.deserializer.ApiDeserializer.toRoom
import application.presenter.api.model.RoomApiDto
import application.service.Service
import infrastructure.provider.ManagerProvider
import io.ktor.serialization.kotlinx.json.json
import io.ktor.server.application.Application
import io.ktor.server.application.call
Expand All @@ -27,8 +30,9 @@ import io.ktor.server.routing.routing

/**
* It manages the REST-API of the microservice.
* @param[provider] the provider of managers.
*/
class APIController {
class APIController(private val provider: ManagerProvider) {
/**
* Starts the http server to serve the client requests.
*/
Expand Down Expand Up @@ -69,6 +73,7 @@ class APIController {
2. creo il digital twin su Azure Digital Twins
*/
val room = call.receive<RoomApiDto>().toRoom()
Service.CreateRoom(room, RoomController(provider.roomDigitalTwinManager))
call.respondText("[${Thread.currentThread().name}] Room POST! \n$room")
}
get("$apiPath/rooms/{roomId}") {
Expand Down

0 comments on commit 4703808

Please sign in to comment.