mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Prevent duplicate bookmark names
This commit is contained in:
@ -57,14 +57,11 @@ object OQueryBookmarks {
|
||||
_.map(r => Bookmark(r.id, r.name, r.label, r.query, r.isPersonal, r.created))
|
||||
)
|
||||
|
||||
def create(account: AccountId, b: NewBookmark): F[AddResult] =
|
||||
store
|
||||
.transact(for {
|
||||
r <- RQueryBookmark.createNew(account, b.name, b.label, b.query, b.personal)
|
||||
n <- RQueryBookmark.insert(r)
|
||||
} yield n)
|
||||
.attempt
|
||||
.map(AddResult.fromUpdate)
|
||||
def create(account: AccountId, b: NewBookmark): F[AddResult] = {
|
||||
val record =
|
||||
RQueryBookmark.createNew(account, b.name, b.label, b.query, b.personal)
|
||||
store.transact(RQueryBookmark.insertIfNotExists(account, record))
|
||||
}
|
||||
|
||||
def update(account: AccountId, id: Ident, b: NewBookmark): F[UpdateResult] =
|
||||
UpdateResult.fromUpdate(
|
||||
|
Reference in New Issue
Block a user