Skip to content

Commit 5e02579

Browse files
committed
fix preference update again
1 parent 4752ab3 commit 5e02579

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/server/routes/user.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,14 @@ userRouter.put('/preferences', async (req, res) => {
124124

125125
const preferences = UserPreferencesSchema.parse(req.body)
126126

127+
const dbUser = await User.findByPk(user.id)
128+
129+
if (!dbUser) {
130+
throw ApplicationError.InternalServerError('User not found')
131+
}
132+
127133
const newPreferences = {
128-
...(user.preferences ?? {}),
134+
...(dbUser.preferences ?? {}),
129135
}
130136

131137
// Assign only defined values

0 commit comments

Comments
 (0)