refactor phase 3a myportal representation and case imports

This commit is contained in:
2026-03-12 09:26:34 +00:00
parent dacf2511f5
commit 72e4655188
2 changed files with 38 additions and 29 deletions
+13 -8
View File
@@ -2,19 +2,24 @@ import useTranslation from "next-translate/useTranslation";
import Head from "next/head"; import Head from "next/head";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { getIP } from "../../../actions/core/logger";
import { import {
getBasicSearch,
getCaseMessage,
getIP,
getMyCases,
getMyLPACases,
getPersonalAccount, getPersonalAccount,
getPortalLogin, getPortalLogin
} from "../../../actions/services/accountService";
import {
getCaseMessage,
getPortalModuleDetails, getPortalModuleDetails,
getWatchedCases,
getSIPSEvents, getSIPSEvents,
getSIPSMedia getSIPSMedia
} from "../../../actions"; } from "../../../actions/services/caseService";
import { getRepsFromBlob } from "../../../actions/services/documentService";
import {
getMyCases,
getMyLPACases,
getWatchedCases
} from "../../../actions/services/portalService";
import { getBasicSearch } from "../../../actions/services/searchService";
import { getFormCollectionByID } from "../../../components/utils"; import { getFormCollectionByID } from "../../../components/utils";
import { getSession } from "next-auth/react"; import { getSession } from "next-auth/react";
+25 -21
View File
@@ -7,14 +7,18 @@ import { useRouter } from "next/router";
import { connect, useDispatch } from "react-redux"; import { connect, useDispatch } from "react-redux";
import { import {
getPersonalAccount, getPersonalAccount,
getPortalLoginProxy,
getPortalLogin, getPortalLogin,
getRepsFromBlob, getPortalLoginProxy
} from "../../actions/services/accountService";
import {
getCase, getCase,
getPortalModuleDetails, getPortalModuleDetails
getBasicSearch, } from "../../actions/services/caseService";
import {
getFilesFromBlob, getFilesFromBlob,
} from "../../actions"; getRepsFromBlob
} from "../../actions/services/documentService";
import { getBasicSearch } from "../../actions/services/searchService";
import { getFormCollectionByID } from "../../components/utils"; import { getFormCollectionByID } from "../../components/utils";
import Breadcrumbs from "../../components/breadcrumbs"; import Breadcrumbs from "../../components/breadcrumbs";
import CookieBanner from "../../components/cookieBanner"; import CookieBanner from "../../components/cookieBanner";
@@ -24,7 +28,7 @@ import Case from "../../components/representation";
import { import {
setAccountDetails, setAccountDetails,
setContainerID, setContainerID,
setLoggedInUserId, setLoggedInUserId
} from "../../store/accountDetails/action"; } from "../../store/accountDetails/action";
import { wrapper } from "../../store/store"; import { wrapper } from "../../store/store";
import { getSearchDetails } from "../../components/utils"; import { getSearchDetails } from "../../components/utils";
@@ -33,11 +37,11 @@ import {
setCurrentReference, setCurrentReference,
setCurrentView, setCurrentView,
setFilesForRepresentations, setFilesForRepresentations,
setRepresentationCapacity, setRepresentationCapacity
} from "../../store/currentView/action"; } from "../../store/currentView/action";
import { import {
setSearchDetails, setSearchDetails,
setSearchResults, setSearchResults
} from "../../store/searchOutput/action"; } from "../../store/searchOutput/action";
import { setSearch } from "../../store/search/action"; import { setSearch } from "../../store/search/action";
@@ -49,7 +53,7 @@ import {
setMyRepresentations, setMyRepresentations,
setMyRepresentationsDetails, setMyRepresentationsDetails,
setMySubmittedReps, setMySubmittedReps,
setMySubmittedRepsDetails, setMySubmittedRepsDetails
} from "../../store/myRepresentations/action"; } from "../../store/myRepresentations/action";
import { getRepsFilesBlobs } from "../../actions/azurestorage"; import { getRepsFilesBlobs } from "../../actions/azurestorage";
@@ -236,12 +240,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
return { return {
redirect: { redirect: {
destination: "/auth/signin", destination: "/auth/signin",
permanent: false, permanent: false
}, }
}; };
} else { } else {
[loggedInUser] = await Promise.all([ [loggedInUser] = await Promise.all([
await getPortalLogin(thisSession.user.email), await getPortalLogin(thisSession.user.email)
]); ]);
console.log( console.log(
@@ -255,7 +259,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
const [accountDetails, myRepresentations] = await Promise.all([ const [accountDetails, myRepresentations] = await Promise.all([
await getPersonalAccount(loggedInUser), await getPersonalAccount(loggedInUser),
await getRepsFromBlob(thisSession.user.id), await getRepsFromBlob(thisSession.user.id)
]); ]);
const myRepresentationsDetails = await getDetails( const myRepresentationsDetails = await getDetails(
@@ -304,7 +308,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
"incidentid": result.incidentID, "incidentid": result.incidentID,
"appealType": result.appealType, "appealType": result.appealType,
"repDetails": result, "repDetails": result,
"filesList": result.filesList, "filesList": result.filesList
}) })
); );
@@ -329,8 +333,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
return { return {
props: { props: {
containerID: thisSession.user.id, containerID: thisSession.user.id,
docsOffline: process.env.DOCAPI_OFFLINE || false, docsOffline: process.env.DOCAPI_OFFLINE || false
}, }
}; };
} else { } else {
const searchResultsObj = await getBasicSearch(query.case); const searchResultsObj = await getBasicSearch(query.case);
@@ -343,7 +347,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch( store.dispatch(
setCurrentView({ setCurrentView({
"viewName": "My Representations", "viewName": "My Representations",
"viewKey": "myRepresentations", "viewKey": "myRepresentations"
}) })
); );
@@ -376,7 +380,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
.pinswg_speacialistcaseprocess || .pinswg_speacialistcaseprocess ||
searchDetailsObj[0].value[0] searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess .pinswg_specialistcaseprocess
: "", : ""
}) })
); );
@@ -385,8 +389,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
return { return {
props: { props: {
containerID: thisSession.user.id, containerID: thisSession.user.id,
docsOffline: process.env.DOCAPI_OFFLINE || false, docsOffline: process.env.DOCAPI_OFFLINE || false
}, }
}; };
} }
} }
@@ -498,7 +502,7 @@ const mapStateToProps = (state) => {
myCases: state.myCases, myCases: state.myCases,
watchedCases: state.watchedCases, watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations, myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission, awaitingSubmission: state.awaitingSubmission
}; };
}; };