Skip to content

Commit

Permalink
Add a check to ensure insertedMetaData is using an ID of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
hichamboushaba committed Aug 19, 2024
1 parent ed72eda commit fa5cf81
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ data class UpdateMetadataRequest(
val insertedMetadata: List<WCMetaData> = emptyList(),
val updatedMetadata: List<WCMetaData> = emptyList(),
val deletedMetadata: List<WCMetaData> = emptyList(),
)

) {
init {
// The ID of inserted metadata is ignored, so to ensure that there is no data loss here,
// we require that all inserted metadata have an ID of 0.
require(insertedMetadata.all { it.id == 0L }) {
"Inserted metadata must have an ID of 0"
}
}
}

0 comments on commit fa5cf81

Please sign in to comment.