Skip to content

Commit

Permalink
feat: just return the basic log, no data anyhow
Browse files Browse the repository at this point in the history
  • Loading branch information
cif committed Oct 5, 2024
1 parent eee4f6c commit 43a3b62
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 26 deletions.
2 changes: 2 additions & 0 deletions src/main/kotlin/com/stabledata/dao/LogsDao.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.stabledata.dao

import kotlinx.serialization.Serializable
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.insert
import org.jetbrains.exposed.sql.select
Expand All @@ -9,6 +10,7 @@ import java.util.*
/**
* LogEntry records every single event that is synchronized across team workspaces in Stable
*/
@Serializable
data class LogEntry (
val id: String,
val teamId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.stabledata.DatabaseOperations
import com.stabledata.dao.CollectionsTable
import com.stabledata.dao.LogsTable
import com.stabledata.endpoint.io.CollectionRequest
import com.stabledata.endpoint.io.CollectionsResponse
import com.stabledata.plugins.JWT_NAME
import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.http.*
Expand Down Expand Up @@ -57,11 +56,7 @@ fun Application.configureCreateCollectionRoute() {

return@post call.respond(
HttpStatusCode.OK,
CollectionsResponse(
id = collection.id,
eventId = envelope.eventId,
confirmedAt = finalLogEntry.confirmedAt
)
finalLogEntry
)

} catch (e: ExposedSQLException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.stabledata.dao.CollectionDeleteFailedException
import com.stabledata.dao.CollectionsTable
import com.stabledata.dao.LogsTable
import com.stabledata.endpoint.io.CollectionRequest
import com.stabledata.endpoint.io.CollectionsResponse
import com.stabledata.plugins.JWT_NAME
import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.http.*
Expand Down Expand Up @@ -47,11 +46,7 @@ fun Application.configureDeleteCollectionRoute() {

return@post call.respond(
HttpStatusCode.OK,
CollectionsResponse(
id = collection.id,
eventId = envelope.eventId,
confirmedAt = finalLogEntry.confirmedAt
)
finalLogEntry
)
} catch (e: CollectionDeleteFailedException) {
logger.error { "Delete collection transaction failed at delete query: ${e.localizedMessage}" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.stabledata.dao.CollectionUpdateFailedException
import com.stabledata.dao.CollectionsTable
import com.stabledata.dao.LogsTable
import com.stabledata.endpoint.io.CollectionRequest
import com.stabledata.endpoint.io.CollectionsResponse
import com.stabledata.plugins.JWT_NAME
import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.http.*
Expand Down Expand Up @@ -46,11 +45,7 @@ fun Application.configureUpdateCollectionRoute() {

return@post call.respond(
HttpStatusCode.OK,
CollectionsResponse(
id = collection.id,
eventId = envelope.eventId,
confirmedAt = finalLogEntry.confirmedAt
)
finalLogEntry
)
} catch (e: CollectionUpdateFailedException) {
logger.error { "Update collection transaction failed at update query: ${e.localizedMessage}" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,4 @@ data class CollectionRequest (
return jsonParser.decodeFromString<CollectionRequest>(json)
}
}
}

@Serializable
data class CollectionsResponse (
val id: String,
val eventId: String,
val confirmedAt: Long?
)
}

0 comments on commit 43a3b62

Please sign in to comment.