(fix) cleanup Gradle-Build
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.shared.model.Artikel
|
||||
import com.benasher44.uuid.Uuid
|
||||
|
||||
interface ArtikelRepository {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.shared.stammdaten.Person
|
||||
import at.mocode.stammdaten.Person
|
||||
import com.benasher44.uuid.Uuid
|
||||
|
||||
interface PersonRepository {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.shared.model.Artikel
|
||||
import at.mocode.tables.ArtikelTable
|
||||
import com.benasher44.uuid.Uuid
|
||||
import com.ionspin.kotlin.bignum.decimal.BigDecimal
|
||||
@@ -16,7 +15,7 @@ class PostgresArtikelRepository : ArtikelRepository {
|
||||
}
|
||||
|
||||
override suspend fun findById(id: Uuid): Artikel? = transaction {
|
||||
ArtikelTable.select { ArtikelTable.id eq id }
|
||||
ArtikelTable.selectAll().where { ArtikelTable.id eq id }
|
||||
.map { rowToArtikel(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
@@ -44,7 +43,7 @@ class PostgresArtikelRepository : ArtikelRepository {
|
||||
it[updatedAt] = Clock.System.now()
|
||||
}
|
||||
if (updateCount > 0) {
|
||||
ArtikelTable.select { ArtikelTable.id eq id }
|
||||
ArtikelTable.selectAll().where { ArtikelTable.id eq id }
|
||||
.map { rowToArtikel(it) }
|
||||
.singleOrNull()
|
||||
} else null
|
||||
@@ -55,14 +54,14 @@ class PostgresArtikelRepository : ArtikelRepository {
|
||||
}
|
||||
|
||||
override suspend fun findByVerbandsabgabe(istVerbandsabgabe: Boolean): List<Artikel> = transaction {
|
||||
ArtikelTable.select { ArtikelTable.istVerbandsabgabe eq istVerbandsabgabe }
|
||||
ArtikelTable.selectAll().where { ArtikelTable.istVerbandsabgabe eq istVerbandsabgabe }
|
||||
.map { rowToArtikel(it) }
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<Artikel> = transaction {
|
||||
ArtikelTable.select {
|
||||
ArtikelTable.selectAll().where {
|
||||
(ArtikelTable.bezeichnung.lowerCase() like "%${query.lowercase()}%") or
|
||||
(ArtikelTable.einheit.lowerCase() like "%${query.lowercase()}%")
|
||||
(ArtikelTable.einheit.lowerCase() like "%${query.lowercase()}%")
|
||||
}.map { rowToArtikel(it) }
|
||||
}
|
||||
|
||||
@@ -72,7 +71,7 @@ class PostgresArtikelRepository : ArtikelRepository {
|
||||
bezeichnung = row[ArtikelTable.bezeichnung],
|
||||
preis = try {
|
||||
BigDecimal.parseString(row[ArtikelTable.preis])
|
||||
} catch (e: Exception) {
|
||||
} catch (_: Exception) {
|
||||
BigDecimal.ZERO
|
||||
},
|
||||
einheit = row[ArtikelTable.einheit],
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.shared.enums.FunktionaerRolle
|
||||
import at.mocode.shared.stammdaten.LizenzInfo
|
||||
import at.mocode.shared.stammdaten.Person
|
||||
import at.mocode.enums.FunktionaerRolle
|
||||
import at.mocode.stammdaten.Person
|
||||
import at.mocode.tables.PersonenTable
|
||||
import com.benasher44.uuid.Uuid
|
||||
import com.benasher44.uuid.uuidFrom
|
||||
import kotlinx.datetime.Clock
|
||||
import org.jetbrains.exposed.sql.*
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
@@ -18,13 +16,13 @@ class PostgresPersonRepository : PersonRepository {
|
||||
}
|
||||
|
||||
override suspend fun findById(id: Uuid): Person? = transaction {
|
||||
PersonenTable.select { PersonenTable.id eq id }
|
||||
PersonenTable.selectAll().where { PersonenTable.id eq id }
|
||||
.map { rowToPerson(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
|
||||
override suspend fun findByOepsSatzNr(oepsSatzNr: String): Person? = transaction {
|
||||
PersonenTable.select { PersonenTable.oepsSatzNr eq oepsSatzNr }
|
||||
PersonenTable.selectAll().where { PersonenTable.oepsSatzNr eq oepsSatzNr }
|
||||
.map { rowToPerson(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
@@ -87,7 +85,7 @@ class PostgresPersonRepository : PersonRepository {
|
||||
it[updatedAt] = Clock.System.now()
|
||||
}
|
||||
if (updateCount > 0) {
|
||||
PersonenTable.select { PersonenTable.id eq id }
|
||||
PersonenTable.selectAll().where { PersonenTable.id eq id }
|
||||
.map { rowToPerson(it) }
|
||||
.singleOrNull()
|
||||
} else null
|
||||
@@ -98,15 +96,15 @@ class PostgresPersonRepository : PersonRepository {
|
||||
}
|
||||
|
||||
override suspend fun findByVereinId(vereinId: Uuid): List<Person> = transaction {
|
||||
PersonenTable.select { PersonenTable.stammVereinId eq vereinId }
|
||||
PersonenTable.selectAll().where { PersonenTable.stammVereinId eq vereinId }
|
||||
.map { rowToPerson(it) }
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<Person> = transaction {
|
||||
PersonenTable.select {
|
||||
PersonenTable.selectAll().where {
|
||||
(PersonenTable.nachname.lowerCase() like "%${query.lowercase()}%") or
|
||||
(PersonenTable.vorname.lowerCase() like "%${query.lowercase()}%") or
|
||||
(PersonenTable.email?.lowerCase()?.like("%${query.lowercase()}%") ?: Op.FALSE)
|
||||
(PersonenTable.vorname.lowerCase() like "%${query.lowercase()}%") or
|
||||
PersonenTable.email.lowerCase().like("%${query.lowercase()}%")
|
||||
}.map { rowToPerson(it) }
|
||||
}
|
||||
|
||||
@@ -149,7 +147,7 @@ class PostgresPersonRepository : PersonRepository {
|
||||
.mapNotNull { roleName ->
|
||||
try {
|
||||
FunktionaerRolle.valueOf(roleName.trim())
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.shared.stammdaten.Verein
|
||||
import at.mocode.stammdaten.Verein
|
||||
import at.mocode.tables.VereineTable
|
||||
import com.benasher44.uuid.Uuid
|
||||
import kotlinx.datetime.Clock
|
||||
@@ -15,13 +15,13 @@ class PostgresVereinRepository : VereinRepository {
|
||||
}
|
||||
|
||||
override suspend fun findById(id: Uuid): Verein? = transaction {
|
||||
VereineTable.select { VereineTable.id eq id }
|
||||
VereineTable.selectAll().where { VereineTable.id eq id }
|
||||
.map { rowToVerein(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
|
||||
override suspend fun findByOepsVereinsNr(oepsVereinsNr: String): Verein? = transaction {
|
||||
VereineTable.select { VereineTable.oepsVereinsNr eq oepsVereinsNr }
|
||||
VereineTable.selectAll().where { VereineTable.oepsVereinsNr eq oepsVereinsNr }
|
||||
.map { rowToVerein(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class PostgresVereinRepository : VereinRepository {
|
||||
it[updatedAt] = Clock.System.now()
|
||||
}
|
||||
if (updateCount > 0) {
|
||||
VereineTable.select { VereineTable.id eq id }
|
||||
VereineTable.selectAll().where { VereineTable.id eq id }
|
||||
.map { rowToVerein(it) }
|
||||
.singleOrNull()
|
||||
} else null
|
||||
@@ -73,15 +73,15 @@ class PostgresVereinRepository : VereinRepository {
|
||||
}
|
||||
|
||||
override suspend fun findByBundesland(bundesland: String): List<Verein> = transaction {
|
||||
VereineTable.select { VereineTable.bundesland eq bundesland }
|
||||
VereineTable.selectAll().where { VereineTable.bundesland eq bundesland }
|
||||
.map { rowToVerein(it) }
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<Verein> = transaction {
|
||||
VereineTable.select {
|
||||
VereineTable.selectAll().where {
|
||||
(VereineTable.name.lowerCase() like "%${query.lowercase()}%") or
|
||||
(VereineTable.kuerzel?.lowerCase()?.like("%${query.lowercase()}%") ?: Op.FALSE) or
|
||||
(VereineTable.ort?.lowerCase()?.like("%${query.lowercase()}%") ?: Op.FALSE)
|
||||
VereineTable.kuerzel.lowerCase().like("%${query.lowercase()}%") or
|
||||
VereineTable.ort.lowerCase().like("%${query.lowercase()}%")
|
||||
}.map { rowToVerein(it) }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.shared.stammdaten.Verein
|
||||
import at.mocode.stammdaten.Verein
|
||||
import com.benasher44.uuid.Uuid
|
||||
|
||||
interface VereinRepository {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package at.mocode.routes
|
||||
|
||||
import at.mocode.model.Artikel
|
||||
import at.mocode.model.ArtikelRepository
|
||||
import at.mocode.model.PostgresArtikelRepository
|
||||
import at.mocode.shared.model.Artikel
|
||||
import com.benasher44.uuid.uuidFrom
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.request.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
import kotlin.collections.mapOf
|
||||
|
||||
fun Route.artikelRoutes() {
|
||||
val artikelRepository: ArtikelRepository = PostgresArtikelRepository()
|
||||
@@ -38,7 +38,7 @@ fun Route.artikelRoutes() {
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "Artikel not found"))
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
@@ -99,7 +99,7 @@ fun Route.artikelRoutes() {
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "Artikel not found"))
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to e.message))
|
||||
@@ -120,7 +120,7 @@ fun Route.artikelRoutes() {
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "Artikel not found"))
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
|
||||
@@ -2,10 +2,9 @@ package at.mocode.routes
|
||||
|
||||
import at.mocode.model.PersonRepository
|
||||
import at.mocode.model.PostgresPersonRepository
|
||||
import at.mocode.shared.stammdaten.Person
|
||||
import at.mocode.stammdaten.Person
|
||||
import com.benasher44.uuid.uuidFrom
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.request.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
@@ -38,7 +37,7 @@ fun Route.personRoutes() {
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "Person not found"))
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
@@ -87,7 +86,7 @@ fun Route.personRoutes() {
|
||||
val uuid = uuidFrom(vereinId)
|
||||
val persons = personRepository.findByVereinId(uuid)
|
||||
call.respond(HttpStatusCode.OK, persons)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
@@ -120,7 +119,7 @@ fun Route.personRoutes() {
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "Person not found"))
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to e.message))
|
||||
@@ -141,7 +140,7 @@ fun Route.personRoutes() {
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "Person not found"))
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
|
||||
@@ -2,10 +2,9 @@ package at.mocode.routes
|
||||
|
||||
import at.mocode.model.PostgresVereinRepository
|
||||
import at.mocode.model.VereinRepository
|
||||
import at.mocode.shared.stammdaten.Verein
|
||||
import at.mocode.stammdaten.Verein
|
||||
import com.benasher44.uuid.uuidFrom
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.request.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
@@ -38,7 +37,7 @@ fun Route.vereinRoutes() {
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "Verein not found"))
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
@@ -117,7 +116,7 @@ fun Route.vereinRoutes() {
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "Verein not found"))
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to e.message))
|
||||
@@ -138,7 +137,7 @@ fun Route.vereinRoutes() {
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "Verein not found"))
|
||||
}
|
||||
} catch (e: IllegalArgumentException) {
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package at.mocode.tables
|
||||
|
||||
|
||||
import at.mocode.shared.enums.LizenzTypE
|
||||
import at.mocode.shared.enums.SparteE
|
||||
import at.mocode.enums.LizenzTypE
|
||||
import at.mocode.enums.SparteE
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import at.mocode.shared.enums.GeschlechtE
|
||||
import at.mocode.enums.GeschlechtE
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import at.mocode.shared.enums.GeschlechtPferdE
|
||||
import at.mocode.enums.GeschlechtPferdE
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import at.mocode.shared.enums.PlatzTypE
|
||||
import at.mocode.enums.PlatzTypE
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
|
||||
object PlaetzeTable : Table("plaetze") {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import at.mocode.shared.enums.VeranstalterTypE
|
||||
import at.mocode.enums.VeranstalterTypE
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
Reference in New Issue
Block a user