Remove Event-related SQL classes and update relevant references across modules

Signed-off-by: Chaoscaot <max@maxsp.de>
This commit is contained in:
2025-10-30 23:14:25 +01:00
parent eea1073892
commit 4e6933f2fd
30 changed files with 679 additions and 797 deletions
@@ -48,11 +48,11 @@ fun Route.configureEventRelations() {
post {
val create = call.receive<CreateEventRelation>()
val fight = EventFight.get(create.fightId) ?: return@post call.respond(HttpStatusCode.NotFound)
val fight = EventFight.byId(create.fightId) ?: return@post call.respond(HttpStatusCode.NotFound)
when (create.fromType) {
EventRelation.FromType.FIGHT -> EventFight.get(create.fromId) ?: return@post call.respond(HttpStatusCode.BadRequest)
EventRelation.FromType.GROUP -> EventGroup.get(create.fromId) ?: return@post call.respond(HttpStatusCode.BadRequest)
EventRelation.FromType.FIGHT -> EventFight.byId(create.fromId) ?: return@post call.respond(HttpStatusCode.BadRequest)
EventRelation.FromType.GROUP -> EventGroup.byId(create.fromId) ?: return@post call.respond(HttpStatusCode.BadRequest)
}
val relation = EventRelation.create(fight, create.team, create.fromType, create.fromId, create.fromPlace)
@@ -70,10 +70,10 @@ fun Route.configureEventRelations() {
update.from?.let {
when(it.fromType) {
EventRelation.FromType.FIGHT -> relation.setFromFight(EventFight.get(it.fromId) ?: return@put call.respond(HttpStatusCode.BadRequest),
EventRelation.FromType.FIGHT -> relation.setFromFight(EventFight.byId(it.fromId) ?: return@put call.respond(HttpStatusCode.BadRequest),
it.fromPlace
)
EventRelation.FromType.GROUP -> relation.setFromGroup(EventGroup.get(it.fromId).orElse(null) ?: return@put call.respond(HttpStatusCode.BadRequest),
EventRelation.FromType.GROUP -> relation.setFromGroup(EventGroup.byId(it.fromId).orElse(null) ?: return@put call.respond(HttpStatusCode.BadRequest),
it.fromPlace
)
}
@@ -99,7 +99,7 @@ suspend fun ApplicationCall.receiveEventRelation(): EventRelation? {
return null
}
val relation = EventRelation.get(relationId)
val relation = EventRelation.byId(relationId)
if (relation == null) {
respond(HttpStatusCode.NotFound)
return null