Skip to content

Commit

Permalink
m6l3 - Validation: Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
svok committed Jul 3, 2024
1 parent a218260 commit 0f64db1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ru.otus.otuskotlin.marketplace.backend.repo.cassandra

import com.benasher44.uuid.uuid4
import com.datastax.oss.driver.api.core.CqlSession
import com.datastax.oss.driver.api.core.cql.AsyncResultSet
import com.datastax.oss.driver.api.querybuilder.SchemaBuilder
import com.datastax.oss.driver.internal.core.type.codec.extras.enums.EnumNameCodec
import com.datastax.oss.driver.internal.core.type.codec.registry.DefaultCodecRegistry
Expand Down Expand Up @@ -82,7 +83,7 @@ class RepoAdCassandra(

override suspend fun createAd(rq: DbAdRequest): IDbAdResponse = tryAdMethod {
val new = rq.ad.copy(id = MkplAdId(randomUuid()), lock = MkplAdLock(randomUuid()))
dao.create(AdCassandraDTO(new))
dao.create(AdCassandraDTO(new)).await()
DbAdResponseOk(new)
}

Expand All @@ -98,7 +99,7 @@ class RepoAdCassandra(
val new = rq.ad.copy(lock = MkplAdLock(randomUuid()))
val dto = AdCassandraDTO(new)

val res = dao.update(dto, prevLock).await()
val res: AsyncResultSet = dao.update(dto, prevLock).await()
val isSuccess = res.wasApplied()
val resultField = res.one()
?.takeIf { it.columnDefinitions.contains(AdCassandraDTO.COLUMN_LOCK) }
Expand Down

0 comments on commit 0f64db1

Please sign in to comment.