mirror of
https://github.com/documenso/documenso.git
synced 2025-11-22 12:41:36 +10:00
fix: wip
This commit is contained in:
@ -40,7 +40,7 @@ export const findDocuments = async ({
|
||||
orderBy,
|
||||
period,
|
||||
senderIds,
|
||||
query,
|
||||
query = '',
|
||||
}: FindDocumentsOptions) => {
|
||||
const user = await prisma.user.findFirstOrThrow({
|
||||
where: {
|
||||
@ -226,6 +226,8 @@ export const findDocuments = async ({
|
||||
};
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(whereClause, null, 2));
|
||||
|
||||
const [data, count] = await Promise.all([
|
||||
prisma.document.findMany({
|
||||
where: whereClause,
|
||||
|
||||
@ -17,7 +17,7 @@ export type GetStatsInput = {
|
||||
search?: string;
|
||||
};
|
||||
|
||||
export const getStats = async ({ user, period, search, ...options }: GetStatsInput) => {
|
||||
export const getStats = async ({ user, period, search = '', ...options }: GetStatsInput) => {
|
||||
let createdAt: Prisma.DocumentWhereInput['createdAt'];
|
||||
|
||||
if (period) {
|
||||
|
||||
@ -172,18 +172,33 @@ export const documentRouter = router({
|
||||
};
|
||||
}
|
||||
|
||||
console.log({
|
||||
userId: user.id,
|
||||
teamId,
|
||||
query,
|
||||
templateId,
|
||||
page,
|
||||
perPage,
|
||||
source,
|
||||
status,
|
||||
period,
|
||||
senderIds,
|
||||
orderBy: orderByColumn ? { column: orderByColumn, direction: orderByDirection } : undefined,
|
||||
});
|
||||
|
||||
const [stats, documents] = await Promise.all([
|
||||
getStats(getStatOptions),
|
||||
findDocuments({
|
||||
userId: user.id,
|
||||
teamId,
|
||||
templateId,
|
||||
query,
|
||||
source,
|
||||
status,
|
||||
templateId,
|
||||
page,
|
||||
perPage,
|
||||
source,
|
||||
status,
|
||||
period,
|
||||
senderIds,
|
||||
orderBy: orderByColumn
|
||||
? { column: orderByColumn, direction: orderByDirection }
|
||||
: undefined,
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
||||
|
||||
Reference in New Issue
Block a user