Initial MatrixService and added kotlin-logging

This commit is contained in:
eneko committed 2021-03-26 01:05:47 +01:00
1 parent a03da9dc74
commit 65d27b0461
4 files changed
+28

No files matched your search

@@ -0,0 +1,17 @@
package eu.fosil.okupamicoche.spring.services
import eu.fosil.okupamicoche.usecases.MatrixApi
import mu.KotlinLogging
import net.folivo.matrix.core.model.MatrixId
import net.folivo.matrix.restclient.MatrixClient
import org.springframework.stereotype.Service
@Service
class MatrixService(val matrixClient: MatrixClient): MatrixApi {
private val logger = KotlinLogging.logger {}
override suspend fun createRoom(name: String) {
logger.debug { "Creating room name" }
matrixClient.roomsApi.createRoom(name = name, roomAliasId = MatrixId.RoomAliasId("#$name:synapse"))
}
}
@@ -0,0 +1,5 @@
package eu.fosil.okupamicoche.usecases
interface MatrixApi {
suspend fun createRoom(name: String)
}
+5
View File
@@ -1,5 +1,6 @@
server:
port: 8081
spring:
datasource:
driver-class-name: org.h2.Driver
@@ -14,6 +15,10 @@ spring:
jwt:
issuer-uri: http://localhost:8080/auth/realms/okupamicoche
logging:
level:
eu.fosil.okupamicoche: DEBUG
matrix:
bot:
# The domain-part of matrix-ids. E. g. example.org when your userIds look like @unicorn:example.org