17 lines
484 B
TypeScript
17 lines
484 B
TypeScript
|
|
import { eq } from "drizzle-orm";
|
||
|
|
import { database } from "~/database/context";
|
||
|
|
import * as schema from "~/database/schema";
|
||
|
|
|
||
|
|
export type LinkedAccount = {
|
||
|
|
id: string;
|
||
|
|
providerId: string;
|
||
|
|
};
|
||
|
|
|
||
|
|
export async function findLinkedAccountsByUserId(userId: string): Promise<LinkedAccount[]> {
|
||
|
|
const db = database();
|
||
|
|
return db
|
||
|
|
.select({ id: schema.accounts.id, providerId: schema.accounts.providerId })
|
||
|
|
.from(schema.accounts)
|
||
|
|
.where(eq(schema.accounts.userId, userId));
|
||
|
|
}
|