Skip to content

Commit

Permalink
refactor(backend): generate new agenda version automatically with OP.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed Dec 7, 2024
1 parent a002dd3 commit 1b2fbb5
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.paligot.confily.backend.third.parties.openplanner

import com.paligot.confily.backend.NotAuthorized
import com.paligot.confily.backend.events.EventModule.eventRepositoryV4
import com.paligot.confily.backend.third.parties.openplanner.OpenPlannerModule.openPlannerRepository
import io.ktor.http.HttpStatusCode
import io.ktor.server.response.respond
Expand All @@ -9,10 +10,12 @@ import io.ktor.server.routing.post

fun Routing.registerOpenPlannerRoutes() {
val repository by openPlannerRepository
val eventRepository by eventRepositoryV4

post("openplanner/webhook") {
val eventId = call.parameters["eventId"]!!
val apiKey = call.request.queryParameters["api_key"] ?: throw NotAuthorized
call.respond(HttpStatusCode.Created, repository.update(eventId, apiKey))
repository.update(eventId, apiKey)
call.respond(HttpStatusCode.Created, eventRepository.generateAgenda(eventId, apiKey))
}
}

0 comments on commit 1b2fbb5

Please sign in to comment.