79 lines
2.3 KiB
JavaScript
79 lines
2.3 KiB
JavaScript
/**
|
|
* @swagger
|
|
* /api/endpoint/getsearchdocumenthistorypaged_api:
|
|
* get:
|
|
* tags: [Search,]
|
|
* description: Basic search documents history paged
|
|
* parameters:
|
|
* - name: documentid
|
|
* in: query
|
|
* required: true
|
|
* example: e09d7297-2a13-ed11-aadf-00224800be9c
|
|
* schema:
|
|
* type: string
|
|
* - name: pageNumber
|
|
* in: query
|
|
* required: true
|
|
* example: 1
|
|
* schema:
|
|
* type: string
|
|
* - name: orderby
|
|
* in: query
|
|
* required: true
|
|
* example: createdon
|
|
* schema:
|
|
* type: string
|
|
* - name: fieldSort
|
|
* in: query
|
|
* required: true
|
|
* description: asc or desc
|
|
* example: asc
|
|
* schema:
|
|
* type: string
|
|
* - name: showNumberOfRecords
|
|
* in: query
|
|
* required: true
|
|
* description: number of records to return per page
|
|
* example: 10
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Success
|
|
*/
|
|
|
|
import { azureHeadersPaged } from "../../../actions/core/headers";
|
|
import { respondError } from "../middleware/apiResponse";
|
|
import { relayGet } from "../middleware/relayForwarding";
|
|
|
|
export default async function ApiProxy(req, res) {
|
|
const documentID = req.query.documentid;
|
|
|
|
if (typeof documentID !== "string" || documentID.trim().length === 0) {
|
|
return respondError(res, {
|
|
status: 400,
|
|
code: "DOCUMENT_ID_REQUIRED",
|
|
message: "documentid is required"
|
|
});
|
|
}
|
|
|
|
const queryUrl =
|
|
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
|
|
documentID;
|
|
// +
|
|
// (typeof pageNumber != "undefined"
|
|
// ? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
|
// : "");
|
|
|
|
return relayGet({
|
|
queryUrl,
|
|
res,
|
|
requestOptionsBuilder: (accessToken) => azureHeadersPaged(accessToken),
|
|
errorResponse: {
|
|
status: 400,
|
|
code: "SEARCH_DOCUMENT_HISTORY_PAGED_FETCH_FAILED",
|
|
message: "Failed to fetch paged search document history"
|
|
}
|
|
});
|
|
}
|