doc link fix for unpublished docs and cases
This commit is contained in:
@@ -99,19 +99,6 @@ export default async function ApiProxy(req, res) {
|
||||
return resultDate.toISOString().replace(/\.000Z$/, "Z"); // format as 'YYYY-MM-DDT00:00:00Z'
|
||||
}
|
||||
|
||||
function flattenDocuments(response) {
|
||||
return {
|
||||
...response,
|
||||
value: Array.isArray(response.value)
|
||||
? response.value.map((doc) => ({
|
||||
...doc,
|
||||
ticketnumber:
|
||||
doc.pinswg_DocumentIds?.ticketnumber || null,
|
||||
}))
|
||||
: [],
|
||||
};
|
||||
}
|
||||
|
||||
var queryUrl =
|
||||
"pinswg_documents?$select=pinswg_name,createdon,pinswg_publishtoweb,_pinswg_documentids_value,pinswg_isharedocumentlocations,pinswg_isharedocumentreference,pinswg_uploadurl,pinswg_uploadstatus,pinswg_origin&$filter=createdon ge " +
|
||||
daysAgoISO(numberOfWeeks) +
|
||||
@@ -121,7 +108,7 @@ export default async function ApiProxy(req, res) {
|
||||
" " +
|
||||
fieldSort +
|
||||
"&$count=true" +
|
||||
"&$expand=pinswg_DocumentIds($select = ticketnumber)" +
|
||||
"&$expand=pinswg_DocumentIds($select = ticketnumber,pinswg_publishtoweb)" +
|
||||
(typeof pageNumber != "undefined"
|
||||
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||
: "");
|
||||
@@ -143,6 +130,7 @@ export default async function ApiProxy(req, res) {
|
||||
let flattened = data.value.map((r) => ({
|
||||
...r,
|
||||
ticketnumber: r.pinswg_DocumentIds?.ticketnumber || null,
|
||||
publishtoweb: r.pinswg_DocumentIds?.pinswg_publishtoweb || null,
|
||||
}));
|
||||
|
||||
data.value = flattened;
|
||||
|
||||
@@ -52,7 +52,7 @@ export default async function ApiProxy(req, res) {
|
||||
var showNumberOfRecords = req.query.showNumberOfRecords || 10;
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$filter=caseorigincode eq 3&$orderby=" +
|
||||
"incidents?$select=caseorigincode,pinswg_publishtoweb,modifiedon,description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value,pinswg_lpareference,pinswg_appellantagent,pinswg_appellantfirstname,pinswg_appellantlastname&$expand=primarycontactid($select=fullname)&$orderby=" +
|
||||
orderby +
|
||||
" " +
|
||||
fieldSort +
|
||||
|
||||
Reference in New Issue
Block a user