Edit dates of multiple items

This commit is contained in:
Eike Kettner
2020-10-26 13:16:03 +01:00
parent 7ade7dd70b
commit 2e6026b817
7 changed files with 121 additions and 50 deletions

View File

@ -285,18 +285,8 @@ object RItem {
).update.run
} yield n
def updateDate(itemId: Ident, coll: Ident, date: Option[Timestamp]): ConnectionIO[Int] =
for {
t <- currentTime
n <- updateRow(
table,
and(id.is(itemId), cid.is(coll)),
commas(itemDate.setTo(date), updated.setTo(t))
).update.run
} yield n
def updateDueDate(
itemId: Ident,
def updateDate(
itemIds: NonEmptyList[Ident],
coll: Ident,
date: Option[Timestamp]
): ConnectionIO[Int] =
@ -304,7 +294,21 @@ object RItem {
t <- currentTime
n <- updateRow(
table,
and(id.is(itemId), cid.is(coll)),
and(id.isIn(itemIds), cid.is(coll)),
commas(itemDate.setTo(date), updated.setTo(t))
).update.run
} yield n
def updateDueDate(
itemIds: NonEmptyList[Ident],
coll: Ident,
date: Option[Timestamp]
): ConnectionIO[Int] =
for {
t <- currentTime
n <- updateRow(
table,
and(id.isIn(itemIds), cid.is(coll)),
commas(dueDate.setTo(date), updated.setTo(t))
).update.run
} yield n