Files
sign/packages/lib/server-only/public-api/get-all-user-tokens.ts

25 lines
453 B
TypeScript
Raw Normal View History

2023-11-27 12:50:21 +02:00
import { prisma } from '@documenso/prisma';
export type GetUserTokensOptions = {
userId: number;
};
export const getUserTokens = async ({ userId }: GetUserTokensOptions) => {
return await prisma.apiToken.findMany({
2023-11-27 12:50:21 +02:00
where: {
userId,
teamId: null,
2023-11-27 12:50:21 +02:00
},
2023-11-28 15:49:46 +02:00
select: {
id: true,
name: true,
algorithm: true,
createdAt: true,
expires: true,
},
orderBy: {
createdAt: 'desc',
},
2023-11-27 12:50:21 +02:00
});
};