Reminders pagination

This commit is contained in:
Vins 2024-11-28 11:26:42 +01:00
parent cded219707
commit 12c0cb3eb2
3 changed files with 28 additions and 0 deletions

View File

@ -50,6 +50,26 @@ export default class DocumentsReminderController extends ApiController {
}
}
@Get ("/api/v1/notary/document_reminders/count", [authHandler])
protected async count(req: Request, response: Response) {
try {
//get query
let query: Prisma.DocumentsReminderCountArgs = {};
//call service to get prisma entity
const count = await this.documentsReminderService.count(query);
const responseData = {
count: count
}
//success
this.httpSuccess(response, responseData);
} catch (error) {
this.httpInternalError(response, error);
return;
}
}
// /**
// * @description Get a specific document by uid
// */

View File

@ -43,4 +43,8 @@ export default class DocumentsReminderRepository extends BaseRepository {
return documentReminderCreated;
}
public async count (query: Prisma.DocumentsReminderCountArgs) {
return this.model.count(query);
}
}

View File

@ -25,4 +25,8 @@ export default class DocumentsReminderService extends BaseService {
public async create(document: DocumentReminder): Promise<DocumentsReminder> {
return this.documentsReminderRepository.create(document);
}
public async count (query: Prisma.DocumentsReminderCountArgs) {
return this.documentsReminderRepository.count(query);
}
}