feat: add authorization for api calls

This commit is contained in:
Catalin Pit
2023-11-30 14:39:31 +02:00
parent 76800674ee
commit 6be4b7ae90
4 changed files with 107 additions and 7 deletions

View File

@ -0,0 +1,15 @@
import { prisma } from '@documenso/prisma';
export const checkUserFromToken = async ({ token }: { token: string }) => {
const user = await prisma.user.findFirstOrThrow({
where: {
ApiToken: {
some: {
token: token,
},
},
},
});
return user;
};