Commit d8c3925b authored by Andreas Muttscheller's avatar Andreas Muttscheller

Add station to PlannedTimetableElement

parent f6fbc63a
......@@ -81,6 +81,8 @@ functions:
APISlackBotEventHandlerWorker:
handler: de.codecentric.amuttsch.bahndelayinfo.aws.lambda.APISlackBotEventHandlerWorker::handleRequest
reservedConcurrency: 1 # Only one instance may run at a time
events:
- schedule: cron(0/2 6-18 ? * MON-FRI *)
APIStationQuery:
handler: de.codecentric.amuttsch.bahndelayinfo.aws.lambda.APIStationQuery::handleRequest
iamRoleStatementsInherit: true
......
package de.codecentric.amuttsch.bahndelayinfo.aws
case class PlannedTimetableElement(
var eva: String,
var lastFetched: String
eva: String,
lastFetched: String,
station: String
)
\ No newline at end of file
......@@ -51,6 +51,7 @@ class ScheduledPlannedTimetableFetchWorker {
}.await
val timetableInformations = dbPlannedTimetableFetcher.fetchTimetablesForEvas(evaToFetch)
var station = ""
timetableInformations.foreach { tti =>
esClient.execute {
......@@ -62,9 +63,15 @@ class ScheduledPlannedTimetableFetchWorker {
.withJSON("tti", tti.toJson)
.withLong("ttl", System.currentTimeMillis() / 1000 + 24 * 60 * 60)
tableTimetableStops.putItem(item)
station = tti.station
}
val newElement = aws.PlannedTimetableElement(eva, LocalDate.now.toString)
val newElement = aws.PlannedTimetableElement(
eva,
LocalDate.now.toString,
station
)
tablePlannedTimetables.putItem(Item.fromJSON(write(newElement)))
if (tail.nonEmpty) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment