Ignore errors on duplicate uuid loging event

This commit is contained in:
Mikołaj Pich 2023-09-24 21:56:33 +02:00
parent 63fea6a7aa
commit d03d150a76

View file

@ -7,6 +7,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.jetbrains.exposed.sql.ResultRow import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.insert import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.insertIgnore
import org.jetbrains.exposed.sql.selectAll import org.jetbrains.exposed.sql.selectAll
import org.jetbrains.exposed.sql.transactions.transaction import org.jetbrains.exposed.sql.transactions.transaction
import java.time.Instant import java.time.Instant
@ -30,7 +31,7 @@ class LoginEventDao {
suspend fun addLoginEvent(event: LoginEvent) = withContext(Dispatchers.IO) { suspend fun addLoginEvent(event: LoginEvent) = withContext(Dispatchers.IO) {
transaction { transaction {
LoginEvents.insert { LoginEvents.insertIgnore {
it[uuid] = event.uuid it[uuid] = event.uuid
it[schoolName] = event.schoolName it[schoolName] = event.schoolName
it[schoolShort] = event.schoolShort it[schoolShort] = event.schoolShort