Bugfixes
This commit is contained in:
parent
dfb07e96ce
commit
4250497f80
|
@ -91,6 +91,7 @@ kotlin {
|
||||||
|
|
||||||
implementation 'org.xerial:sqlite-jdbc:3.25.2'
|
implementation 'org.xerial:sqlite-jdbc:3.25.2'
|
||||||
api 'mysql:mysql-connector-java:8.0.16'
|
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.jetbrains.exposed:exposed:0.12.2'
|
||||||
|
|
||||||
implementation 'org.mindrot:jbcrypt:0.4'
|
implementation 'org.mindrot:jbcrypt:0.4'
|
||||||
|
|
|
@ -330,6 +330,7 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-table-box {
|
.calendar-table-box {
|
||||||
|
@ -669,16 +670,15 @@
|
||||||
.track-legend-list {
|
.track-legend-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
line-height: 2rem;
|
line-height: 2rem;
|
||||||
height: 2rem;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.track-legend {
|
.track-legend {
|
||||||
flex-basis: 0;
|
flex-basis: 10rem;
|
||||||
flex-grow: 1;
|
|
||||||
flex-shrink: 1;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
height: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.track-legend-color {
|
.track-legend-color {
|
||||||
|
@ -694,5 +694,5 @@
|
||||||
.track-legend-name {
|
.track-legend-name {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 2rem;
|
left: 1.5rem;
|
||||||
}
|
}
|
|
@ -98,6 +98,7 @@ fun Application.main() {
|
||||||
|
|
||||||
// Web socket push notifications
|
// Web socket push notifications
|
||||||
pushService()
|
pushService()
|
||||||
|
calendarExport()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@ object Configuration {
|
||||||
val url by required<String>()
|
val url by required<String>()
|
||||||
val username by required<String>()
|
val username by required<String>()
|
||||||
val password by required<String>()
|
val password by required<String>()
|
||||||
|
val name by required<String>()
|
||||||
}
|
}
|
||||||
|
|
||||||
object Database {
|
object Database {
|
||||||
|
@ -145,6 +146,7 @@ object Configuration {
|
||||||
val url by c(DatabaseSpec.url)
|
val url by c(DatabaseSpec.url)
|
||||||
val username by c(DatabaseSpec.username)
|
val username by c(DatabaseSpec.username)
|
||||||
val password by c(DatabaseSpec.password)
|
val password by c(DatabaseSpec.password)
|
||||||
|
val name by c(DatabaseSpec.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.jetbrains.exposed.sql.SchemaUtils
|
||||||
import org.jetbrains.exposed.sql.transactions.TransactionManager
|
import org.jetbrains.exposed.sql.transactions.TransactionManager
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
import java.sql.Connection.TRANSACTION_READ_COMMITTED
|
||||||
import java.sql.Connection.TRANSACTION_SERIALIZABLE
|
import java.sql.Connection.TRANSACTION_SERIALIZABLE
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
@ -30,31 +31,34 @@ object Connection {
|
||||||
val url = Configuration.Database.url
|
val url = Configuration.Database.url
|
||||||
val username = Configuration.Database.username
|
val username = Configuration.Database.username
|
||||||
val password = Configuration.Database.password
|
val password = Configuration.Database.password
|
||||||
|
val name = Configuration.Database.name
|
||||||
when (type) {
|
when (type) {
|
||||||
"mysql" -> {
|
"mysql" -> {
|
||||||
Database.connect(
|
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",
|
"com.mysql.cj.jdbc.Driver",
|
||||||
username,
|
username,
|
||||||
password
|
password
|
||||||
)
|
)
|
||||||
|
TransactionManager.manager.defaultIsolationLevel = TRANSACTION_READ_COMMITTED
|
||||||
}
|
}
|
||||||
"mariadb" -> {
|
"mariadb" -> {
|
||||||
Database.connect(
|
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",
|
"org.mariadb.jdbc.Driver",
|
||||||
username,
|
username,
|
||||||
password
|
password
|
||||||
)
|
)
|
||||||
|
TransactionManager.manager.defaultIsolationLevel = TRANSACTION_READ_COMMITTED
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val dbPath = Configuration.Path.databasePath.toString()
|
val dbPath = Configuration.Path.databasePath.toString()
|
||||||
Database.connect("jdbc:sqlite:$dbPath", "org.sqlite.JDBC")
|
Database.connect("jdbc:sqlite:$dbPath", "org.sqlite.JDBC")
|
||||||
|
|
||||||
|
TransactionManager.manager.defaultIsolationLevel = TRANSACTION_SERIALIZABLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TransactionManager.manager.defaultIsolationLevel = TRANSACTION_SERIALIZABLE
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
create()
|
create()
|
||||||
} catch (e: ExposedSQLException) {
|
} catch (e: ExposedSQLException) {
|
||||||
|
|
|
@ -282,13 +282,13 @@ fun Route.calendar() {
|
||||||
content {
|
content {
|
||||||
div("header") {
|
div("header") {
|
||||||
div("header-left") {
|
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" } }
|
a("$prefix/calendar/${day - 1}") { i("material-icons") { +"chevron_left" } }
|
||||||
}
|
}
|
||||||
span {
|
span {
|
||||||
+dateString
|
+dateString
|
||||||
}
|
}
|
||||||
if (editable || day + 1 < range.endInclusive) {
|
if (editable || day + 1 <= range.endInclusive) {
|
||||||
a("$prefix/calendar/${day + 1}") { i("material-icons") { +"chevron_right" } }
|
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 = ""
|
url = ""
|
||||||
username = ""
|
username = ""
|
||||||
password = ""
|
password = ""
|
||||||
|
name = ""
|
||||||
|
|
Loading…
Reference in a new issue