Skip to content

Commit

Permalink
Rename nested history collection
Browse files Browse the repository at this point in the history
  • Loading branch information
VovaStelmashchuk committed Aug 17, 2024
1 parent d5b6fc7 commit 70bec07
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class NestHistoryRepository(
private val database by lazy { client.getDatabase("nest2d") }

suspend fun createNestResult(projectSlug: String): NestResultDatabase {
val collection = database.getCollection<NestResultDatabase>(collectionName = "nest-history")
val collection = database.getCollection<NestResultDatabase>(collectionName = COLLECTION_NAME)
val nestResult = NestResultDatabase(
id = ObjectId(),
projectSlug = projectSlug,
Expand All @@ -26,7 +26,7 @@ class NestHistoryRepository(
}

suspend fun makeNestFinish(id: ObjectId, svgPath: String, dxfPath: String) {
val collection = database.getCollection<NestResultDatabase>(collectionName = "nest-history")
val collection = database.getCollection<NestResultDatabase>(collectionName = COLLECTION_NAME)
val query = Filters.eq("_id", id)

val update = org.bson.Document(
Expand All @@ -38,6 +38,10 @@ class NestHistoryRepository(

collection.updateOne(query, update)
}

companion object {
private const val COLLECTION_NAME = "nestHistory"
}
}

data class NestResultDatabase(
Expand Down

0 comments on commit 70bec07

Please sign in to comment.