feat: Adding states endpoint and regex find to current endpoints

This commit is contained in:
2023-10-06 00:23:36 -06:00
parent bf65d9a5cf
commit ce3ec074eb
11 changed files with 117 additions and 16 deletions

View File

@@ -25,10 +25,10 @@ function getPagination( query ){
return limit;
}
async function queryPage( page , elements , model ){
async function queryPage( page, elements, model, filter=null, projection=null){
const skip = elements * page;
const total = await model.count();
const list = await model.find( null , null, { skip : skip , limit : elements } );
const list = await model.find( filter, projection, { skip : skip , limit : elements } );
return {
total : total,
limit : elements,