Fix not ignoring deleted teams

Closes: #226
This commit is contained in:
2025-11-24 20:55:58 +01:00
parent e343d044ff
commit c9bfcc5c0c
2 changed files with 96 additions and 5 deletions
+3 -5
View File
@@ -20,11 +20,9 @@
package de.steamwar.sql
import de.steamwar.sql.internal.useDb
import org.jetbrains.exposed.v1.core.*
import org.jetbrains.exposed.v1.core.dao.id.EntityID
import org.jetbrains.exposed.v1.core.dao.id.IntIdTable
import org.jetbrains.exposed.v1.core.eq
import org.jetbrains.exposed.v1.core.lowerCase
import org.jetbrains.exposed.v1.core.or
import org.jetbrains.exposed.v1.dao.IntEntity
import org.jetbrains.exposed.v1.dao.IntEntityClass
import org.jetbrains.exposed.v1.jdbc.select
@@ -49,10 +47,10 @@ class Team(id: EntityID<Int>) : IntEntity(id) {
fun byId(id: Int) = teamCache.computeIfAbsent(id) { useDb { Team[id] } }
@JvmStatic
fun get(name: String) = useDb { find { TeamTable.name.lowerCase() eq name.lowercase() or (TeamTable.kuerzel.lowerCase() eq name.lowercase()) }.firstOrNull() }
fun get(name: String) = useDb { find { (TeamTable.name.lowerCase() eq name.lowercase() or (TeamTable.kuerzel.lowerCase() eq name.lowercase())) and not(TeamTable.deleted) }.firstOrNull() }
@JvmStatic
fun getAll() = useDb { all().toList() }
fun getAll() = useDb { find { not(TeamTable.deleted) }.toList() }
@JvmStatic
fun create(kuerzel: String, name: String) = useDb {