Bugfixes
This commit is contained in:
parent
dfb07e96ce
commit
4250497f80
|
@ -91,6 +91,7 @@ kotlin {
|
|||
|
||||
implementation 'org.xerial:sqlite-jdbc:3.25.2'
|
||||
api 'mysql:mysql-connector-java:8.0.16'
|
||||
api 'org.mariadb.jdbc:mariadb-java-client:1.1.7'
|
||||
implementation 'org.jetbrains.exposed:exposed:0.12.2'
|
||||
|
||||
implementation 'org.mindrot:jbcrypt:0.4'
|
||||
|
|
|
@ -330,6 +330,7 @@
|
|||
width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.calendar-table-box {
|
||||
|
@ -669,16 +670,15 @@
|
|||
.track-legend-list {
|
||||
display: flex;
|
||||
line-height: 2rem;
|
||||
height: 2rem;
|
||||
width: 100%;
|
||||
padding: 0 1rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.track-legend {
|
||||
flex-basis: 0;
|
||||
flex-grow: 1;
|
||||
flex-shrink: 1;
|
||||
flex-basis: 10rem;
|
||||
position: relative;
|
||||
height: 2rem;
|
||||
}
|
||||
|
||||
.track-legend-color {
|
||||
|
@ -694,5 +694,5 @@
|
|||
.track-legend-name {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 2rem;
|
||||
left: 1.5rem;
|
||||
}
|
|
@ -98,6 +98,7 @@ fun Application.main() {
|
|||
|
||||
// Web socket push notifications
|
||||
pushService()
|
||||
calendarExport()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ object Configuration {
|
|||
val url by required<String>()
|
||||
val username by required<String>()
|
||||
val password by required<String>()
|
||||
val name by required<String>()
|
||||
}
|
||||
|
||||
object Database {
|
||||
|
@ -145,6 +146,7 @@ object Configuration {
|
|||
val url by c(DatabaseSpec.url)
|
||||
val username by c(DatabaseSpec.username)
|
||||
val password by c(DatabaseSpec.password)
|
||||
val name by c(DatabaseSpec.name)
|
||||
}
|
||||
|
||||
init {
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.jetbrains.exposed.sql.SchemaUtils
|
|||
import org.jetbrains.exposed.sql.transactions.TransactionManager
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
import java.nio.file.Files
|
||||
import java.sql.Connection.TRANSACTION_READ_COMMITTED
|
||||
import java.sql.Connection.TRANSACTION_SERIALIZABLE
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
|
@ -30,30 +31,33 @@ object Connection {
|
|||
val url = Configuration.Database.url
|
||||
val username = Configuration.Database.username
|
||||
val password = Configuration.Database.password
|
||||
val name = Configuration.Database.name
|
||||
when (type) {
|
||||
"mysql" -> {
|
||||
Database.connect(
|
||||
"jdbc:mysql://$url:3306/akplan?user=$username&password=$password&serverTimezone=UTC",
|
||||
"jdbc:mysql://$url:3306/$name?user=$username&password=$password&serverTimezone=UTC",
|
||||
"com.mysql.cj.jdbc.Driver",
|
||||
username,
|
||||
password
|
||||
)
|
||||
TransactionManager.manager.defaultIsolationLevel = TRANSACTION_READ_COMMITTED
|
||||
}
|
||||
"mariadb" -> {
|
||||
Database.connect(
|
||||
"jdbc:mariadb://$url:3306/akplan?user=$username&password=$password&serverTimezone=UTC",
|
||||
"jdbc:mariadb://$url:3306/$name?user=$username&password=$password&serverTimezone=UTC",
|
||||
"org.mariadb.jdbc.Driver",
|
||||
username,
|
||||
password
|
||||
)
|
||||
TransactionManager.manager.defaultIsolationLevel = TRANSACTION_READ_COMMITTED
|
||||
}
|
||||
else -> {
|
||||
val dbPath = Configuration.Path.databasePath.toString()
|
||||
Database.connect("jdbc:sqlite:$dbPath", "org.sqlite.JDBC")
|
||||
}
|
||||
}
|
||||
|
||||
TransactionManager.manager.defaultIsolationLevel = TRANSACTION_SERIALIZABLE
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
create()
|
||||
|
|
|
@ -282,13 +282,13 @@ fun Route.calendar() {
|
|||
content {
|
||||
div("header") {
|
||||
div("header-left") {
|
||||
if (editable || day - 1 > range.start) {
|
||||
if (editable || day - 1 >= range.start) {
|
||||
a("$prefix/calendar/${day - 1}") { i("material-icons") { +"chevron_left" } }
|
||||
}
|
||||
span {
|
||||
+dateString
|
||||
}
|
||||
if (editable || day + 1 < range.endInclusive) {
|
||||
if (editable || day + 1 <= range.endInclusive) {
|
||||
a("$prefix/calendar/${day + 1}") { i("material-icons") { +"chevron_right" } }
|
||||
}
|
||||
}
|
||||
|
|
21
src/jvmMain/kotlin/de/kif/backend/route/CalendarExport.kt
Normal file
21
src/jvmMain/kotlin/de/kif/backend/route/CalendarExport.kt
Normal file
|
@ -0,0 +1,21 @@
|
|||
package de.kif.backend.route
|
||||
|
||||
import de.kif.backend.repository.ScheduleRepository
|
||||
import io.ktor.application.call
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.response.respondText
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.routing.get
|
||||
|
||||
|
||||
fun Route.calendarExport() {
|
||||
get("export/kif.ics") {
|
||||
val scheduleList = ScheduleRepository.all()
|
||||
|
||||
//TODO
|
||||
|
||||
val text = ""
|
||||
|
||||
call.respondText(contentType = ContentType.parse("text/calendar"), text = text)
|
||||
}
|
||||
}
|
|
@ -38,3 +38,4 @@ type = "sqlite"
|
|||
url = ""
|
||||
username = ""
|
||||
password = ""
|
||||
name = ""
|
||||
|
|
Loading…
Reference in a new issue