added fixes to reduce error when calling module details and filtering of docs
This commit is contained in:
@@ -92,6 +92,37 @@ export default async function ApiProxy(req, res) {
|
||||
var showNumberOfRecords = req.query.showNumberOfRecords;
|
||||
var documentType = req.query.documentType || "all";
|
||||
|
||||
// (documentType != "all"
|
||||
// ? documentType.indexOf(",")<0?" and pinswg_isharedocumentlocations eq " + documentType :
|
||||
// : "") +
|
||||
|
||||
var docTypeQueryString = "";
|
||||
|
||||
if (documentType != "all") {
|
||||
if (documentType.indexOf(",") >= 0) {
|
||||
const documentTypeArr = documentType.split(",");
|
||||
|
||||
docTypeQueryString = " and (";
|
||||
documentTypeArr.forEach(function (item, index) {
|
||||
console.log(item, index);
|
||||
|
||||
if (item != "all") {
|
||||
docTypeQueryString +=
|
||||
" pinswg_isharedocumentlocations eq " + item;
|
||||
|
||||
docTypeQueryString +=
|
||||
index < documentTypeArr.length - 1 ? " or " : "";
|
||||
}
|
||||
});
|
||||
docTypeQueryString += " )";
|
||||
} else {
|
||||
docTypeQueryString +=
|
||||
" and pinswg_isharedocumentlocations eq " + documentType;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(docTypeQueryString);
|
||||
|
||||
//console.log("has this passed docuemntType:", documentType);
|
||||
//(documentType !="all" && " pinswg_pinswg_isharedocumentlocations eq " + )
|
||||
|
||||
@@ -99,9 +130,7 @@ export default async function ApiProxy(req, res) {
|
||||
"pinswg_documents?$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||
incidentID +
|
||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null" +
|
||||
(documentType != "all"
|
||||
? " and pinswg_isharedocumentlocations eq " + documentType
|
||||
: "") +
|
||||
docTypeQueryString +
|
||||
"&$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 +
|
||||
" " +
|
||||
@@ -111,7 +140,7 @@ export default async function ApiProxy(req, res) {
|
||||
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||
: "");
|
||||
|
||||
//console.log("docu paged: ", queryUrl);
|
||||
console.log("docu paged: ", queryUrl);
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
Reference in New Issue
Block a user