From d03d150a76b7e49b4dff5320a4d9eacd7f71b025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Sun, 24 Sep 2023 21:56:33 +0200 Subject: [PATCH] Ignore errors on duplicate uuid loging event --- .../kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt b/src/main/kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt index 8b181f1..8c9baad 100644 --- a/src/main/kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt +++ b/src/main/kotlin/io/github/wulkanowy/schools/dao/LoginEventDao.kt @@ -7,6 +7,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.jetbrains.exposed.sql.ResultRow import org.jetbrains.exposed.sql.insert +import org.jetbrains.exposed.sql.insertIgnore import org.jetbrains.exposed.sql.selectAll import org.jetbrains.exposed.sql.transactions.transaction import java.time.Instant @@ -30,7 +31,7 @@ class LoginEventDao { suspend fun addLoginEvent(event: LoginEvent) = withContext(Dispatchers.IO) { transaction { - LoginEvents.insert { + LoginEvents.insertIgnore { it[uuid] = event.uuid it[schoolName] = event.schoolName it[schoolShort] = event.schoolShort