mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
feat: add authorization for api calls
This commit is contained in:
@ -3,11 +3,15 @@ import { prisma } from '@documenso/prisma';
|
||||
type GetDocumentsProps = {
|
||||
page: number;
|
||||
perPage: number;
|
||||
userId: number;
|
||||
};
|
||||
|
||||
export const getDocuments = async ({ page = 1, perPage = 10 }: GetDocumentsProps) => {
|
||||
export const getDocuments = async ({ page = 1, perPage = 10, userId }: GetDocumentsProps) => {
|
||||
const [documents, count] = await Promise.all([
|
||||
await prisma.document.findMany({
|
||||
where: {
|
||||
userId,
|
||||
},
|
||||
take: perPage,
|
||||
skip: Math.max(page - 1, 0) * perPage,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user