mirror of https://github.com/aruppi/aruppi-api.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
615 B
Kotlin
19 lines
615 B
Kotlin
package com.jeluchu.features.radiostations.services
|
|
|
|
import com.jeluchu.core.utils.Collections
|
|
import com.jeluchu.features.radiostations.mappers.documentStationsMapper
|
|
import com.mongodb.client.MongoDatabase
|
|
import io.ktor.http.*
|
|
import io.ktor.server.response.*
|
|
import io.ktor.server.routing.*
|
|
|
|
class RadioStationsService(
|
|
database: MongoDatabase
|
|
) {
|
|
private val radioStations = database.getCollection(Collections.RADIO)
|
|
|
|
suspend fun getStations(call: RoutingCall) {
|
|
val elements = radioStations.find().toList()
|
|
call.respond(HttpStatusCode.OK, elements.documentStationsMapper())
|
|
}
|
|
} |