mirror of
https://github.com/documenso/documenso.git
synced 2026-07-11 13:35:20 +10:00
9ac7b94d9a
Allow organisations to manage an SSO OIDC compliant portal. This method is intended to streamline the onboarding process and paves the way to allow organisations to manage their members in a more strict way.
33 lines
652 B
TypeScript
33 lines
652 B
TypeScript
import type { Context } from 'hono';
|
|
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
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,
|
|
},
|
|
});
|
|
};
|