Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package data.remote.mongoDataSource

import com.mongodb.client.model.Filters
import com.mongodb.client.model.Filters.and
import com.mongodb.client.model.Filters.eq
import com.mongodb.client.model.Updates
import com.mongodb.client.model.Updates.combine
Expand All @@ -16,6 +17,7 @@ import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.withContext
import logic.entities.Audit
import logic.entities.Task
import logic.exceptions.*
import org.bson.conversions.Bson
Expand Down Expand Up @@ -62,19 +64,29 @@ class MongoDBDataSourceImpl(

//region audit operations
override suspend fun getAllAuditLogs(): List<AuditDto> {
TODO("Not yet implemented")
return auditsCollection.find().toList()
}

override suspend fun addAuditLog(audit: AuditDto) {
TODO("Not yet implemented")
auditsCollection.insertOne(audit)
}

override suspend fun getAuditLogsByProjectId(projectId: String): List<AuditDto> {
TODO("Not yet implemented")
return auditsCollection.find(
and(
eq<String>("entityId", projectId),
eq<String>("entityType", Audit.EntityType.PROJECT.name)
)
).toList()
}

override suspend fun getAuditLogsByTaskId(taskId: String): List<AuditDto> {
TODO("Not yet implemented")
return auditsCollection.find(
and(
eq("entityId", taskId),
eq("entityType", Audit.EntityType.TASK.name)
)
).toList()
}
//endregion

Expand Down