mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Use an upsert for the default shortcuts
This commit is contained in:
parent
13cdedf655
commit
deaa0e8856
1 changed files with 4 additions and 5 deletions
|
|
@ -88,19 +88,18 @@ export const setShortcuts = async (
|
|||
): Promise<Shortcut[]> => {
|
||||
const result = await authTrx(
|
||||
(t) =>
|
||||
t.getRepository(UserPersonalization).update(
|
||||
t.getRepository(UserPersonalization).upsert(
|
||||
{
|
||||
user: { id: userId },
|
||||
},
|
||||
{
|
||||
shortcuts: shortcuts,
|
||||
}
|
||||
},
|
||||
['user']
|
||||
),
|
||||
{
|
||||
uid: userId,
|
||||
}
|
||||
)
|
||||
if (!result.affected || result.affected < 1) {
|
||||
if (!result.identifiers || result.identifiers.length < 1) {
|
||||
throw Error('Could not update shortcuts')
|
||||
}
|
||||
return shortcuts
|
||||
|
|
|
|||
Loading…
Reference in a new issue