import{ensureArrayQueryFilter as e}from"../ensureArrayQueryFilter.mjs";import{getFiltersAndPaginationFromBody as t}from"./getFiltersAndPaginationFromBody.mjs";const n=(n,r)=>{let{filters:i,...a}=t(n),{roles:o,organization:s}=r?.locals||n.locals||{},c={},l={updatedAt:-1},{name:u,search:d,ids:f,keys:p,organizationId:m,fetchAll:h}=i??{};if(f&&(c={...c,_id:{$in:e(f)}}),p&&(c={...c,key:{$in:e(p)}}),u&&(c={...c,name:new RegExp(u,`i`)}),d){let e=new RegExp(d,`i`);c={...c,$or:[{name:e},{key:e},{description:e},{instructions:e}]}}return m&&(c={...c,organizationId:m}),o.includes(`admin`)&&h===`true`||(c={...c,organizationId:s?.id}),{filters:c,sortOptions:l,...a}};export{n as getTagFiltersAndPagination};
//# sourceMappingURL=getTagFiltersAndPagination.mjs.map