mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Transform digest config to a JSON string before setting
This commit is contained in:
parent
9a3474bf66
commit
bbf3de1f86
1 changed files with 6 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ import {
|
|||
MutationSetUserPersonalizationArgs,
|
||||
SetUserPersonalizationError,
|
||||
SetUserPersonalizationErrorCode,
|
||||
SetUserPersonalizationInput,
|
||||
SetUserPersonalizationSuccess,
|
||||
SortOrder,
|
||||
} from '../../generated/graphql'
|
||||
|
|
@ -15,11 +16,15 @@ export const setUserPersonalizationResolver = authorized<
|
|||
SetUserPersonalizationError,
|
||||
MutationSetUserPersonalizationArgs
|
||||
>(async (_, { input }, { authTrx, uid }) => {
|
||||
const newValues = input as Omit<SetUserPersonalizationInput, 'digestConfig'>
|
||||
const result = await authTrx(async (t) => {
|
||||
return t.getRepository(UserPersonalization).upsert(
|
||||
{
|
||||
user: { id: uid },
|
||||
...input,
|
||||
...newValues,
|
||||
digestConfig: () => {
|
||||
return JSON.stringify(input.digestConfig)
|
||||
},
|
||||
},
|
||||
['user']
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue