forked from SteamWar/SteamWar
Remove Event-related SQL classes and update relevant references across modules
Signed-off-by: Chaoscaot <max@maxsp.de>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user