Remove warnings

This commit is contained in:
Lars Westermann 2019-06-11 10:55:44 +02:00
parent 7b7a9b0fc2
commit 7ac2e1c208
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D
6 changed files with 26 additions and 27 deletions

View file

@ -15,7 +15,6 @@ import io.ktor.jackson.jackson
import io.ktor.response.respond import io.ktor.response.respond
import io.ktor.routing.route import io.ktor.routing.route
import io.ktor.routing.routing import io.ktor.routing.routing
import io.ktor.websocket.WebSockets
import org.slf4j.event.Level import org.slf4j.event.Level
import java.nio.file.Paths import java.nio.file.Paths
@ -31,7 +30,7 @@ fun Application.main() {
install(ConditionalHeaders) install(ConditionalHeaders)
install(Compression) install(Compression)
install(DataConversion) install(DataConversion)
install(WebSockets) install(AutoHeadResponse)
install(StatusPages) { install(StatusPages) {
exception<Throwable> { exception<Throwable> {

View file

@ -133,7 +133,7 @@ fun Route.overview() {
} }
get("/post/{id}") { get("/post/{id}") {
authenticateOrRedirect(Permission.POST) { user -> authenticateOrRedirect(Permission.POST) {
val postId = call.parameters["id"]?.toLongOrNull() ?: return@get val postId = call.parameters["id"]?.toLongOrNull() ?: return@get
val editPost = PostRepository.get(postId) ?: return@get val editPost = PostRepository.get(postId) ?: return@get
respondMain { respondMain {
@ -291,7 +291,7 @@ fun Route.overview() {
} }
post("/post/{id}") { post("/post/{id}") {
authenticateOrRedirect(Permission.POST) { user -> authenticateOrRedirect(Permission.POST) {
val postId = call.parameters["id"]?.toLongOrNull() ?: return@post val postId = call.parameters["id"]?.toLongOrNull() ?: return@post
var imageUploadName: String? = null var imageUploadName: String? = null
@ -361,7 +361,7 @@ fun Route.overview() {
} }
get("/post/new") { get("/post/new") {
authenticateOrRedirect(Permission.POST) { user -> authenticateOrRedirect(Permission.POST) {
respondMain { respondMain {
content { content {
h1 { +"Beitrag erstellen" } h1 { +"Beitrag erstellen" }
@ -491,7 +491,7 @@ fun Route.overview() {
} }
post("/post/new") { post("/post/new") {
authenticateOrRedirect(Permission.POST) { user -> authenticateOrRedirect(Permission.POST) {
var imageUploadName: String? = null var imageUploadName: String? = null
val params = mutableMapOf<String, String>() val params = mutableMapOf<String, String>()
@ -537,7 +537,7 @@ fun Route.overview() {
} }
get("/post/{id}/delete") { get("/post/{id}/delete") {
authenticateOrRedirect(Permission.POST) { user -> authenticateOrRedirect(Permission.POST) {
val postId = call.parameters["id"]?.toLongOrNull() ?: return@get val postId = call.parameters["id"]?.toLongOrNull() ?: return@get
PostRepository.delete(postId) PostRepository.delete(postId)

View file

@ -29,7 +29,7 @@ import de.kif.backend.prefix
fun Route.room() { fun Route.room() {
get("/rooms") { get("/rooms") {
authenticateOrRedirect(Permission.ROOM) { user -> authenticateOrRedirect(Permission.ROOM) {
val search = call.parameters["search"] ?: "" val search = call.parameters["search"] ?: ""
val list = RoomRepository.all() val list = RoomRepository.all()
@ -106,7 +106,7 @@ fun Route.room() {
} }
get("/room/{id}") { get("/room/{id}") {
authenticateOrRedirect(Permission.ROOM) { user -> authenticateOrRedirect(Permission.ROOM) {
val roomId = call.parameters["id"]?.toLongOrNull() ?: return@get val roomId = call.parameters["id"]?.toLongOrNull() ?: return@get
val editRoom = RoomRepository.get(roomId) ?: return@get val editRoom = RoomRepository.get(roomId) ?: return@get
respondMain { respondMain {
@ -260,7 +260,7 @@ fun Route.room() {
} }
post("/room/{id}") { post("/room/{id}") {
authenticateOrRedirect(Permission.ROOM) { user -> authenticateOrRedirect(Permission.ROOM) {
val roomId = call.parameters["id"]?.toLongOrNull() ?: return@post val roomId = call.parameters["id"]?.toLongOrNull() ?: return@post
val params = call.receiveParameters().toMap().mapValues { (_, list) -> val params = call.receiveParameters().toMap().mapValues { (_, list) ->
list.firstOrNull() list.firstOrNull()
@ -283,7 +283,7 @@ fun Route.room() {
} }
get("/room/new") { get("/room/new") {
authenticateOrRedirect(Permission.ROOM) { user -> authenticateOrRedirect(Permission.ROOM) {
respondMain { respondMain {
content { content {
h1 { +"Raum erstellen" } h1 { +"Raum erstellen" }
@ -430,7 +430,7 @@ fun Route.room() {
} }
post("/room/new") { post("/room/new") {
authenticateOrRedirect(Permission.ROOM) { user -> authenticateOrRedirect(Permission.ROOM) {
val params = call.receiveParameters().toMap().mapValues { (_, list) -> val params = call.receiveParameters().toMap().mapValues { (_, list) ->
list.firstOrNull() list.firstOrNull()
} }
@ -453,7 +453,7 @@ fun Route.room() {
} }
get("/room/{id}/delete") { get("/room/{id}/delete") {
authenticateOrRedirect(Permission.ROOM) { user -> authenticateOrRedirect(Permission.ROOM) {
val roomId = call.parameters["id"]?.toLongOrNull() ?: return@get val roomId = call.parameters["id"]?.toLongOrNull() ?: return@get
RoomRepository.delete(roomId) RoomRepository.delete(roomId)

View file

@ -83,7 +83,7 @@ fun DIV.colorPicker(color: Color?) {
fun Route.track() { fun Route.track() {
get("/tracks") { get("/tracks") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val search = call.parameters["search"] ?: "" val search = call.parameters["search"] ?: ""
val list = TrackRepository.all() val list = TrackRepository.all()
respondMain { respondMain {
@ -145,7 +145,7 @@ fun Route.track() {
} }
get("/track/{id}") { get("/track/{id}") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val trackId = call.parameters["id"]?.toLongOrNull() ?: return@get val trackId = call.parameters["id"]?.toLongOrNull() ?: return@get
val editTrack = TrackRepository.get(trackId) ?: return@get val editTrack = TrackRepository.get(trackId) ?: return@get
respondMain { respondMain {
@ -192,7 +192,7 @@ fun Route.track() {
} }
post("/track/{id}") { post("/track/{id}") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val trackId = call.parameters["id"]?.toLongOrNull() ?: return@post val trackId = call.parameters["id"]?.toLongOrNull() ?: return@post
val params = call.receiveParameters().toMap().mapValues { (_, list) -> val params = call.receiveParameters().toMap().mapValues { (_, list) ->
list.firstOrNull() list.firstOrNull()
@ -212,7 +212,7 @@ fun Route.track() {
} }
get("/track/new") { get("/track/new") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
respondMain { respondMain {
content { content {
h1 { +"Track erstellen" } h1 { +"Track erstellen" }
@ -251,7 +251,7 @@ fun Route.track() {
} }
post("/track/new") { post("/track/new") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val params = call.receiveParameters().toMap().mapValues { (_, list) -> val params = call.receiveParameters().toMap().mapValues { (_, list) ->
list.firstOrNull() list.firstOrNull()
} }
@ -270,7 +270,7 @@ fun Route.track() {
} }
get("track/{id}/delete") { get("track/{id}/delete") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val trackId = call.parameters["id"]?.toLongOrNull() ?: return@get val trackId = call.parameters["id"]?.toLongOrNull() ?: return@get
TrackRepository.delete(trackId) TrackRepository.delete(trackId)

View file

@ -26,8 +26,8 @@ import kotlin.collections.component2
import kotlin.collections.set import kotlin.collections.set
fun Route.user() { fun Route.user() {
get("/users") { param -> get("/users") {
authenticateOrRedirect(Permission.USER) { user -> authenticateOrRedirect(Permission.USER) {
val search = call.parameters["search"] ?: "" val search = call.parameters["search"] ?: ""
val list = UserRepository.all() val list = UserRepository.all()
respondMain { respondMain {

View file

@ -25,7 +25,7 @@ private const val separator = "###"
fun Route.workGroup() { fun Route.workGroup() {
get("workgroups") { get("workgroups") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val search = call.parameters["search"] ?: "" val search = call.parameters["search"] ?: ""
val list = WorkGroupRepository.all() val list = WorkGroupRepository.all()
respondMain { respondMain {
@ -146,7 +146,7 @@ fun Route.workGroup() {
} }
get("/workgroup/{id}") { get("/workgroup/{id}") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val workGroupId = call.parameters["id"]?.toLongOrNull() ?: return@get val workGroupId = call.parameters["id"]?.toLongOrNull() ?: return@get
val editWorkGroup = WorkGroupRepository.get(workGroupId) ?: return@get val editWorkGroup = WorkGroupRepository.get(workGroupId) ?: return@get
val tracks = TrackRepository.all() val tracks = TrackRepository.all()
@ -532,7 +532,7 @@ fun Route.workGroup() {
} }
post("/workgroup/{id}") { post("/workgroup/{id}") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val workGroupId = call.parameters["id"]?.toLongOrNull() ?: return@post val workGroupId = call.parameters["id"]?.toLongOrNull() ?: return@post
val params = call.receiveParameters().toMap().mapValues { (_, list) -> val params = call.receiveParameters().toMap().mapValues { (_, list) ->
list.firstOrNull() list.firstOrNull()
@ -574,7 +574,7 @@ fun Route.workGroup() {
} }
get("/workgroup/new") { get("/workgroup/new") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val tracks = TrackRepository.all() val tracks = TrackRepository.all()
respondMain { respondMain {
content { content {
@ -823,7 +823,7 @@ fun Route.workGroup() {
} }
post("/workgroup/new") { post("/workgroup/new") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val params = call.receiveParameters().toMap().mapValues { (_, list) -> val params = call.receiveParameters().toMap().mapValues { (_, list) ->
list.firstOrNull() list.firstOrNull()
} }
@ -872,7 +872,7 @@ fun Route.workGroup() {
} }
get("/workgroup/{id}/delete") { get("/workgroup/{id}/delete") {
authenticateOrRedirect(Permission.WORK_GROUP) { user -> authenticateOrRedirect(Permission.WORK_GROUP) {
val workGroupId = call.parameters["id"]?.toLongOrNull() ?: return@get val workGroupId = call.parameters["id"]?.toLongOrNull() ?: return@get
WorkGroupRepository.delete(workGroupId) WorkGroupRepository.delete(workGroupId)