fix(api): 🐛 Fix incorrect db fetching code breaking OAuth2

This commit is contained in:
Jesse Wierzbinski 2024-04-17 15:56:17 -10:00
parent 9804180123
commit f9f4a99cb9
No known key found for this signature in database

View file

@ -49,7 +49,7 @@ export default apiRoute(async (req, matchedRoute, extraData) => {
currentUrl.searchParams.delete("state"); currentUrl.searchParams.delete("state");
const issuerParam = matchedRoute.params.issuer; const issuerParam = matchedRoute.params.issuer;
const flow = await db.query.openIdLoginFlow.findFirst({ const flow = await db.query.OpenIdLoginFlows.findFirst({
where: (flow, { eq }) => eq(flow.id, matchedRoute.query.flow), where: (flow, { eq }) => eq(flow.id, matchedRoute.query.flow),
with: { with: {
application: true, application: true,
@ -144,7 +144,7 @@ export default apiRoute(async (req, matchedRoute, extraData) => {
); );
const userId = ( const userId = (
await db.query.openIdAccount.findFirst({ await db.query.OpenIdAccounts.findFirst({
where: (account, { eq, and }) => where: (account, { eq, and }) =>
and(eq(account.serverId, sub), eq(account.issuerId, issuer.id)), and(eq(account.serverId, sub), eq(account.issuerId, issuer.id)),
}) })