Skip to content

Commit

Permalink
validate default is in users table
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmacartney committed Dec 12, 2024
1 parent 202b6f7 commit 1c5b362
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/server/implementation/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ async function defaultCreateOrUpdateUser(
existingUserId,
...args,
});
} else {
if (
existingUserId &&
ctx.db.normalizeId("users", existingUserId) === null
) {
throw new Error(
`User ID \`${existingUserId}\` is not in the \`users\` table`,
);
}
}

const {
Expand Down

0 comments on commit 1c5b362

Please sign in to comment.