Merge branch 'Development' into SIPS-Development

This commit is contained in:
2025-07-03 11:20:38 +01:00
16 changed files with 93 additions and 1326 deletions
+4 -4
View File
@@ -23,10 +23,10 @@ class MyDocument extends Document {
const cookieObj = ctx.req.cookies.CookiePolicy || {};
console.log("useGATracking: ", useGATracking);
// setCookie(ctx, "pedw_locale", ctx.locale, {
// path: "/",
// });
//console.log("useGATracking: ", useGATracking);
setCookie(ctx, "pedw_locale", ctx.locale, {
path: "/",
});
const headers = ctx.req?.headers;
const generatedNonce = headers?.["x-nonce"];
-102
View File
@@ -1,102 +0,0 @@
import { createSwaggerSpec } from "next-swagger-doc";
import dynamic from "next/dynamic";
import "swagger-ui-react/swagger-ui.css";
const SwaggerUI = dynamic(import("swagger-ui-react"), { ssr: false });
function ApiDoc({ spec }) {
return <SwaggerUI spec={spec} docExpansion={"list"} />;
}
let BASE_URL;
const port = parseInt(process.env.PORT, 10) || 3000;
if (process.browser) {
BASE_URL = window.apiRoot;
} else {
BASE_URL = process.env.API_ROOT || `http://localhost:${port}`;
}
const WORDKEY = process.env.HASHKEY;
const cache = {};
const API_PATH = "/api/data/v8.2/";
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
const tenantId = process.env.TENANT;
export const getStaticProps = async () => {
const spec = createSwaggerSpec({
layout: "StandaloneLayout",
apiFolder: "pages/api",
schemaFolders: ["models"],
definition: {
openapi: "3.0.3",
info: {
title: "PEDW API",
version: "1.0",
contact: {
email: "rob@rdbsolutions.co.uk",
},
},
docExpansion: "none",
components: {
schemas: {
emailBody: {
type: "object",
properties: {
reference: {
type: "string",
example: "PEDW-COMPLETE",
},
templateId: {
type: "string",
example: "618e0463-b092-4733-a024-bf8a3bbde808",
},
emailAddress: {
type: "string",
example: "rob@rdbtech.co.uk",
},
personalisation: {
type: "object",
example: {
caseReference: "CAS-TEST-TEST",
emailAddress: "rob@rdbtech.co.uk",
linkExpiry: "10 * 60",
},
},
},
},
},
// securitySchemes: {
// pedw_auth: {
// type: "oauth2",
// flows: {
// clientCredentials: {
// tokenUrl: `${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`,
// scopes:
// "https://" +
// process.env.RELAYURI +
// "/.default",
// },
// },
// },
// api_key: {
// type: "apiKey",
// name: "api_key",
// in: "header",
// },
// },
},
},
});
//console.log(JSON.stringify(spec));
return {
props: {
spec,
},
};
};
export default ApiDoc;
+9 -1
View File
@@ -35,7 +35,15 @@ export default async function ApiProxy(req, res) {
var token = await getToken();
var queryUrl =
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' " +
(process.env.SHOWSIPS !== "true"
? "and pinswg_appealcasetype ne 846040002"
: "") +
"&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
// for sips
// "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
// "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
//"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Developments of National Significance' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
+5 -1
View File
@@ -49,7 +49,11 @@ export default async function ApiProxy(req, res) {
searchString +
"') or contains(ticketnumber, '" +
searchString +
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
"')) and pinswg_appealcasetype ne null " +
(process.env.SHOWSIPS !== "true"
? "and pinswg_appealcasetype ne 846040002"
: "") +
"and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
console.log(
"\n==========================================\n",
@@ -66,13 +66,15 @@ export default async function ApiProxy(req, res) {
"&$count=true";
//" and statuscode eq 1&$count=true";
queryUrl =
queryUrl +
getSelectQuery(appealTypeName) +
",_" +
(primaryIdAttribute == "pinswg_sipscase"
? "pinswg_sipscase_value"
: primaryIdAttribute + "s_value");
// queryUrl =
// queryUrl +
// getSelectQuery(appealTypeName) +
// ",_" +
// (primaryIdAttribute == "pinswg_sipscase"
// ? "pinswg_sipscase_value"
// : primaryIdAttribute + "s_value");
queryUrl = queryUrl + getSelectQuery(appealTypeName);
// console.log(
// "\n==========================================\n",
@@ -83,7 +83,11 @@ export default async function ApiProxy(req, res) {
searchString +
"') or contains(ticketnumber, '" +
searchString +
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=" +
"')) and pinswg_appealcasetype ne null " +
(process.env.SHOWSIPS !== "true"
? "and pinswg_appealcasetype ne 846040002"
: "") +
"and pinswg_publishtoweb eq true&$orderby=" +
orderby +
" " +
fieldSort +