mirror of
https://github.com/documenso/documenso.git
synced 2026-06-22 04:12:06 +10:00
32 lines
651 B
TypeScript
32 lines
651 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
import type { Context } from 'hono';
|
|
|
|
import { getSession } from './get-session';
|
|
|
|
export type PartialAccount = {
|
|
id: string;
|
|
userId: number;
|
|
type: string;
|
|
provider: string;
|
|
providerAccountId: string;
|
|
createdAt: Date;
|
|
};
|
|
|
|
export const getAccounts = async (c: Context | Request): Promise<PartialAccount[]> => {
|
|
const { user } = await getSession(c);
|
|
|
|
return await prisma.account.findMany({
|
|
where: {
|
|
userId: user.id,
|
|
},
|
|
select: {
|
|
id: true,
|
|
userId: true,
|
|
type: true,
|
|
provider: true,
|
|
providerAccountId: true,
|
|
createdAt: true,
|
|
},
|
|
});
|
|
};
|