Merge branch 'dev' into staging

This commit is contained in:
Vins 2025-04-10 16:29:28 +02:00
commit 07ac73b806
2 changed files with 24 additions and 3 deletions

View File

@ -45,13 +45,15 @@ export default class DocumentReminders extends BaseNotary {
}
}
public count = async (): Promise<IGetDocumentRemindersCountresponse> => {
public async count(q: IGetDocumentRemindersparams): Promise<IGetDocumentRemindersCountresponse> {
const url = new URL(this.baseURl.concat("/count"));
const query = { q };
Object.entries(query).forEach(([key, value]) => url.searchParams.set(key, JSON.stringify(value)));
try {
return await this.getRequest<IGetDocumentRemindersCountresponse>(url);
} catch (err) {
this.onError(err);
return Promise.reject(err);
}
};
}
}

View File

@ -58,7 +58,17 @@ export default function DocumentsReminderHistory(props: IProps) {
const fetchTotalPages = useCallback(() => {
DocumentReminders.getInstance()
.count()
.count({
where: {
...(folderUid && {
document: {
folder: {
uid: folderUid as string,
},
},
}),
},
})
.then((response) => {
const totalPages = Math.ceil(response.count / pageSize);
setTotalPages(totalPages);
@ -70,6 +80,15 @@ export default function DocumentsReminderHistory(props: IProps) {
DocumentReminders.getInstance()
.get({
...(customerOption && customerOption.id !== "tous" && { where: { document: { depositor: { uid: customerOption.id } } } }),
where: {
...(folderUid && {
document: {
folder: {
uid: folderUid as string,
},
},
}),
},
include: {
document: {
include: {