Fix condition for deleting custom field value

This commit is contained in:
Eike Kettner 2020-11-21 21:22:12 +01:00
parent 4059ef31c1
commit af1cca7d83
2 changed files with 5 additions and 1 deletions

View File

@ -161,6 +161,7 @@ object OCustomFields {
val update =
for {
field <- OptionT(RCustomField.findByIdOrName(in.field, in.collective))
_ <- OptionT.liftF(logger.debug(s"Field found by '${in.field}': $field"))
n <- OptionT.liftF(RCustomFieldValue.deleteValue(field.id, in.item))
} yield n

View File

@ -60,5 +60,8 @@ object RCustomFieldValue {
deleteFrom(table, Columns.itemId.is(item)).update.run
def deleteValue(fieldId: Ident, items: NonEmptyList[Ident]): ConnectionIO[Int] =
deleteFrom(table, and(Columns.id.is(fieldId), Columns.itemId.isIn(items))).update.run
deleteFrom(
table,
and(Columns.field.is(fieldId), Columns.itemId.isIn(items))
).update.run
}