mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
28 lines
562 B
TypeScript
28 lines
562 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
export interface GetLastVerificationTokenOptions {
|
|
userId: number;
|
|
}
|
|
|
|
export const getLastVerificationToken = async ({ userId }: GetLastVerificationTokenOptions) => {
|
|
const user = await prisma.user.findFirstOrThrow({
|
|
where: {
|
|
id: userId,
|
|
},
|
|
include: {
|
|
VerificationToken: {
|
|
select: {
|
|
expires: true,
|
|
createdAt: true,
|
|
},
|
|
orderBy: {
|
|
createdAt: 'desc',
|
|
},
|
|
take: 1,
|
|
},
|
|
},
|
|
});
|
|
|
|
return user.VerificationToken;
|
|
};
|