mirror of
https://github.com/documenso/documenso.git
synced 2025-11-17 18:21:32 +10:00
chore: cleanup and feedback implementation
This commit is contained in:
@ -6,7 +6,7 @@ export type DeleteTokenByIdOptions = {
|
||||
};
|
||||
|
||||
export const deleteTokenById = async ({ id, userId }: DeleteTokenByIdOptions) => {
|
||||
return prisma.apiToken.delete({
|
||||
return await prisma.apiToken.delete({
|
||||
where: {
|
||||
id,
|
||||
userId,
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
import { prisma } from '@documenso/prisma';
|
||||
|
||||
type GetDocumentsProps = {
|
||||
page: number;
|
||||
perPage: number;
|
||||
userId: number;
|
||||
};
|
||||
|
||||
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,
|
||||
}),
|
||||
await prisma.document.count(),
|
||||
]);
|
||||
|
||||
return {
|
||||
documents,
|
||||
totalPages: Math.ceil(count / perPage),
|
||||
};
|
||||
};
|
||||
@ -38,10 +38,8 @@ export const SendDocumentForSigningMutationSchema = z.object({
|
||||
});
|
||||
|
||||
export const UploadDocumentSuccessfulSchema = z.object({
|
||||
uploadedFile: z.object({
|
||||
url: z.string(),
|
||||
key: z.string(),
|
||||
}),
|
||||
url: z.string(),
|
||||
key: z.string(),
|
||||
});
|
||||
|
||||
export const CreateDocumentMutationSchema = z.object({
|
||||
|
||||
@ -23,6 +23,7 @@ export const apiTokenRouter = router({
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
getTokenById: authenticatedProcedure
|
||||
.input(ZGetApiTokenByIdQuerySchema)
|
||||
.query(async ({ input, ctx }) => {
|
||||
@ -40,6 +41,7 @@ export const apiTokenRouter = router({
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
createToken: authenticatedProcedure
|
||||
.input(ZCreateTokenMutationSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
@ -56,6 +58,7 @@ export const apiTokenRouter = router({
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
deleteTokenById: authenticatedProcedure
|
||||
.input(ZDeleteTokenByIdMutationSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
|
||||
Reference in New Issue
Block a user