Skip to content

Commit

Permalink
Update server/src/main/scala/za/co/absa/atum/server/model/CheckpointI…
Browse files Browse the repository at this point in the history
…temWithPartitioningFromDB.scala

Co-authored-by: David Benedeki <[email protected]>
  • Loading branch information
salamonpavel and benedeki authored Nov 22, 2024
1 parent 7e4513a commit 30c0766
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,16 @@ object CheckpointItemWithPartitioningFromDB {
}
val partitioningOrErr: Either[DecodingFailure, PartitioningWithIdDTO] = {
val decodingResult = checkpointItems.head.partitioning.as[PartitioningForDB]
decodingResult match {
case Left(decodingFailure) => Left(decodingFailure)
case Right(partitioningForDB) =>
val partitioningDTO = partitioningForDB.keys.map { key =>
PartitionDTO(key, partitioningForDB.keysToValuesMap(key))
}
Right(
PartitioningWithIdDTO(
id = checkpointItems.head.idPartitioning,
partitioning = partitioningDTO,
author = checkpointItems.head.partitioningAuthor
)
)
decodingResult.map{ partitioningForDB =>
val partitioningDTO = partitioningForDB.keys.map { key =>
PartitionDTO(key, partitioningForDB.keysToValuesMap(key))
}
PartitioningWithIdDTO(
id = checkpointItems.head.idPartitioning,
partitioning = partitioningDTO,
author = checkpointItems.head.partitioningAuthor
)
}
}

}
Expand Down

0 comments on commit 30c0766

Please sign in to comment.