sorting on documents

This commit is contained in:
2022-01-31 20:11:31 +00:00
parent 3cecafc380
commit 2ec88c995c
15 changed files with 240 additions and 70 deletions
@@ -1,5 +1,6 @@
import axios from "axios";
import CryptoJS from "crypto-js";
import { query } from "jsonpath";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
@@ -26,6 +27,9 @@ export default async function ApiProxy(req, res) {
var pageNumber = req.query.pageNumber;
var token = await getToken();
var orderby = req.query.orderby;
var fieldSort = req.query.fieldSort;
searchString = _.isEmpty(searchString)
? searchString
: JSON.parse(decodeURI(searchString));
@@ -60,11 +64,17 @@ export default async function ApiProxy(req, res) {
var queryUrl =
"incidents?$select=description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
queryString +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=" +
orderby +
" " +
fieldSort +
"&$count=true" +
(typeof pageNumber != "undefined"
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
: "");
console.log("adv qu: ", queryUrl);
var apiResponse = _.isEmpty(searchString)
? res.status(400).json()
: axios