document filter and sort by name

This commit is contained in:
2022-05-09 11:09:54 +01:00
parent 05c6844cc1
commit 8c99516213
7 changed files with 234 additions and 25 deletions
@@ -42,11 +42,19 @@ export default async function ApiProxy(req, res) {
var orderby = req.query.orderby;
var fieldSort = req.query.fieldSort;
var showNumberOfRecords = req.query.showNumberOfRecords;
var documentType = req.query.documentType || "all";
console.log("has this passed docuemntType:", documentType);
//(documentType !="all" && " pinswg_pinswg_isharedocumentlocations eq " + )
var queryUrl =
"pinswg_documents?$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
incidentID +
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate&$orderby=" +
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null" +
(documentType != "all"
? " and pinswg_isharedocumentlocations eq " + documentType
: "") +
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate&$orderby=" +
orderby +
" " +
fieldSort +