configId Migration Plan
Objective: Add configId as a parameter to all API calls across 4 routes.
Source of configId: auth.persistedRowData.configId (from Redux store)
Legend
- HAS configId = Already includes
configId — no changes needed
- NEEDS configId = Does NOT include
configId — must be updated
- Auto = Fires automatically on page load (useEffect)
- User = Fires on user interaction (button click, toggle, etc.)
Route 1: /quick-overview (SurveysQuickOverview)
GET Requests
| # | Thunk / Call | Trigger | Endpoint | configId Status | Thunk File | Dispatched From |
|---|
| 1 | getSurveyDataForGraph | Auto | home/get-survey-data-for-graph | HAS configId | store/Surveys/Features/SurveyOverview/index.ts | pages/SurveysQuickOverview/index.tsx |
| 2 | getOverviewInitialOrgs | Auto | org-tree-generate (module=statscompare) | HAS configId | store/Surveys/Features/SurveyOverview/index.ts | pages/SurveysQuickOverview/index.tsx |
| 3 | getYearDataList | Auto (conditional) | Surveys/get-year-list | HAS configId | store/masterData/index.ts | pages/SurveysQuickOverview/index.tsx |
| 4 | getSurveyGraphDataForTwoYears | User (Compare) | home/get-survey-data-for-two-year | NEEDS configId | store/Surveys/Features/SurveyOverview/index.ts | pages/SurveysQuickOverview/index.tsx |
| 5 | getSurveyChildrenOrgs | User (Tree expand) | org-tree-generate (type=Children) | HAS configId | store/Surveys/Features/SurveyOverview/index.ts | molecules/OverviewTreeView/backend.ts |
| 6 | getSurveyPreviewParams | User (Preview btn) | surveys/get-survey-preview-params | NEEDS configId | store/features/Auth/index.ts | molecules/Header/index.tsx |
| 7 | getReportAsFile | User (SignalR) | Report/get-report-as-file | NEEDS configId | store/features/Report/index.ts | pages/SurveysQuickOverview/index.tsx |
POST Requests
| # | Thunk / Call | Trigger | Endpoint | configId Status | Thunk File | Dispatched From |
|---|
| 8 | downloadOverviewAllData (direct) | User (Download) | respondent/download-orgunit-answer-percentage-data | NEEDS configId | N/A (direct service call) | pages/SurveysQuickOverview/index.tsx |
Summary: 4 already done, 4 need configId
Route 2: /settings (Settings)
GET Requests
| # | Thunk / Call | Trigger | Endpoint | configId Status | Thunk File | Dispatched From |
|---|
| 1 | getSurveySettingsGeneralDataList | Auto | surveys/get-survey-settings-general | HAS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | pages/Settings/index.tsx |
| 2 | getTemplateLanguagesData | Auto | SurveyTemplates/get-template-languages | HAS configId | store/masterData/index.ts | molecules/AdminSettings/General/index.tsx |
| 3 | getSurveyInitialOrgs | Auto (conditional) | org-tree-generate (type=Children, module=surveysettings) | HAS configId | store/features/OrgUnits/index.ts | molecules/OrgUnits/SurveyOrgTreeView/index.tsx |
| 4 | getSurveySearchedOrgUnits | Auto (conditional) | org-tree-generate (type=ParentFullPath) | NEEDS configId | store/features/OrgUnits/index.ts | molecules/OrgUnits/SurveyOrgTreeView/index.tsx |
| 5 | getSurveySelectableQuestionsData | Auto | surveys/get-survey-selectable-questions | NEEDS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | molecules/AdminSettings/CustomizeSurvey/index.tsx |
| 6 | getSurveyAppearanceDataList | Auto | surveys/get-survey-appearance | NEEDS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | molecules/AdminSettings/CustomizeAppearance/index.tsx |
| 7 | getAdditionalSurveyTemplates | Auto | surveys/get-additional-template-list | NEEDS configId | store/masterData/index.ts | molecules/AdminSettings/AdditionalSurvey/index.tsx |
|
POST Requests
| # | Thunk / Call | Trigger | Endpoint | configId Status | Thunk File | Dispatched From |
|---|
| 13 | updateSurveySettingsDataList | User (Save) | surveys/update-survey-settings | NEEDS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | molecules/AdminSettings/General/index.tsx |
| 14 | updateSurveySettingsDataListWithDateChange | User (Save) | surveys/update-survey-settings | NEEDS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | molecules/AdminSettings/General/index.tsx |
| 15 | updateSurveySelectableQuestionsData | User (Save) | surveys/update-survey-selectable-questions | NEEDS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | molecules/AdminSettings/CustomizeSurvey/index.tsx |
| 16 | updateSurveyAppearanceList | User (Save) | surveys/update-survey-appearance | NEEDS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | molecules/AdminSettings/CustomizeAppearance/index.tsx |
| 17 | updateSurveyAppearanceLogo | User (Upload) | surveys/update-survey-appearance-logo | NEEDS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | molecules/CustomizeMainSurvey/index.tsx |
| 18 | addAdditionalTemplateDataList | User (Save) | surveys/add-additional-template | NEEDS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | molecules/AdminSettings/AdditionalSurvey/index.tsx |
| 19 | getAdditionalSurveyPreviewParams | User (Preview) | surveys/get-survey-preview-params-additionalsurvey | NEEDS configId | store/features/Auth/index.ts |
Summary: 4 already done, 18 need configId
Route 3: /send-out (SendOut)
GET Requests
| # | Thunk / Call | Trigger | Endpoint | configId Status | Thunk File | Dispatched From |
|---|
| 1 | getDistributionDetailsData | Auto | respondent/get-distribution-details | HAS configId | store/Surveys/Features/Respondents/index.ts | pages/SendOut/index.tsx |
| 2 | getSurveyInitialOrgs | Auto (conditional) | org-tree-generate (type=Children, module=surveysettings) | HAS configId | store/features/OrgUnits/index.ts | molecules/OrgUnits/SurveyOrgTreeView/index.tsx |
| 3 | getSurveySearchedOrgUnits | Auto (conditional) | org-tree-generate (type=ParentFullPath) | NEEDS configId | store/features/OrgUnits/index.ts | molecules/OrgUnits/SurveyOrgTreeView/index.tsx |
| 4 | getEmailSMSGeneralSettingsData | Auto (EmailSMS tab) | respondent/get-emailsms-general-settings | NEEDS configId | store/Surveys/Features/Respondents/EmailAndSms/index.ts | molecules/EmailSMS/EmailSMSGenaral/index.tsx |
| 5 | getEmailSmsRespondentCount | Auto (EmailSMS tab) | respondent/get-respondent-count-for-distribution-type | NEEDS configId | store/Surveys/Features/Respondents/EmailAndSms/index.ts | molecules/EmailSMS/EmailSMSGenaral/index.tsx |
| 6 | getEmailSmsRespondentEnableDeleteAll | Auto (EmailSMS tab) | respondent/enable-delete-all-for-distribution-type | NEEDS configId | store/Surveys/Features/Respondents/EmailAndSms/index.ts | molecules/EmailSMS/EmailSMSTemplate/index.tsx |
| 7 | getEmailsmsStatusesData | Auto (EmailSMS tab) | Respondent/get-emailsms-statuses | NEEDS configId | store/masterData/index.ts | |
POST Requests
| # | Thunk / Call | Trigger | Endpoint | configId Status | Thunk File | Dispatched From |
|---|
| 21 | getEmailRespondents | Auto (EmailSMS tab) | respondent/get-emailing-respondents | NEEDS configId | store/Surveys/Features/Respondents/EmailAndSms/index.ts | molecules/EmailSMS/EmailSMSRespondents/index.tsx |
| 22 | getSvarUTRespondents | Auto (SvarUT tab) | respondent/get-svarut-respondents | NEEDS configId | store/Surveys/Features/Respondents/SvarUT/index.ts | molecules/SvarUT/SvarUTRespondents/index.tsx |
| 23 | getOTPRespondents | Auto (OTP tab) | respondent/get-otp-respondents | NEEDS configId | store/Surveys/Features/Respondents/OTP/index.ts | molecules/OTP/OTPPassord/index.tsx |
| 24 | updateActivityLogData | Auto (Activity log) | respondent/audit-trail-list | NEEDS configId | store/Surveys/Features/ActivityLog/index.ts | molecules/EmailSMS/ActivityLogView/index.tsx |
| 25 | updateDistributionDetailsData | User (Toggle) | respondent/update-distribution-details | NEEDS configId | store/Surveys/Features/Respondents/index.ts | pages/SendOutInitialView/index.tsx |
| 26 | generateOpenLink | User (Toggle) | respondent/generate-open-link | NEEDS configId | store/Surveys/Features/Respondents/index.ts | pages/SendOutInitialView/index.tsx |
| 27 | updateEmailSMSGeneralSettingsData | User (Save) | respondent/update-emailsms-general-settings | NEEDS configId | store/Surveys/Features/Respondents/EmailAndSms/index.ts | molecules/EmailSMS/EmailSMSGenaral/index.tsx |
|
Summary: 2 already done, 27 need configId
Route 4: /reports (WebReportsMainPage)
GET Requests
| # | Thunk / Call | Trigger | Endpoint | configId Status | Thunk File | Dispatched From |
|---|
| 1 | getReportList | Auto | ReportConfig/report-list | NEEDS configId | store/features/ReportConfig/index.ts | pages/WebReportsMainPage/index.tsx |
| 2 | getInitialOrgUnits | Auto | org-tree-generate (module=webreports) | HAS configId | store/features/OrgUnits/index.ts | molecules/OrgUnits/WebReportsOrgTreeView/index.tsx |
| 3 | getSearchedOrgUnits | Auto (conditional) | org-tree-generate (type=ParentFullPath) | NEEDS configId | store/features/OrgUnits/index.ts | molecules/OrgUnits/WebReportsOrgTreeView/index.tsx |
| 4 | getChindrenOrgs | User (Tree expand) | org-tree-generate (type=Children) | NEEDS configId | store/features/OrgUnits/index.ts | molecules/OrgUnits/WebReportsOrgTreeView/backend.ts |
| 5 | searchOrgUnits | User (Search) | org-unit-search | NEEDS configId | store/features/OrgUnits/index.ts | molecules/OrgUnits/WebReportsOrgTreeView/index.tsx |
| 6 | getReportAsFile | User (SignalR) | Report/get-report-as-file | NEEDS configId | store/features/Report/index.ts | pages/WebReports/index.tsx |
| 7 | agent.Orgs.searchOrgs (direct) | User (Compare search) | org-unit-search (module=webreportscompare) | NEEDS configId | N/A (direct service call) | molecules/ReportOptionHeader/index.tsx |
POST Requests
| # | Thunk / Call | Trigger | Endpoint | configId Status | Thunk File | Dispatched From |
|---|
| 8 | getReportData | Auto (cascading) | Report/get-report | NEEDS configId | store/features/Report/index.ts | pages/WebReportsMainPage/index.tsx |
| 9 | agent.Report.downloadReport (direct) | User (Download) | Report/download-report | NEEDS configId | N/A (direct service call) | pages/WebReports/index.tsx |
| 10 | exportReportsByType | User (Export) | Report/export-report | NEEDS configId | store/features/Report/index.ts | ExportTypeModal |
| 11 | emailReport | User (Share) | Report/email-report | NEEDS configId | store/features/Report/index.ts | ShareReportSidePanel |
Summary: 1 already done, 10 need configId
Overall Summary
Migration Status: COMPLETE ✓ All endpoints now include configId.
| Route | Total API Calls | Has configId |
|---|
/quick-overview | 8 | 8 |
/settings | 22 | 22 |
/send-out | 29 | 29 |
/reports | 11 | 11 |
| Additional (post-testing) | 7 | 7 |
| TOTAL | 77 | 77 |
Additional Endpoints Found During Post-Migration Testing
These endpoints were not under the original 4 routes but were discovered during testing. All are now migrated.
| # | Thunk / Call | Method | Endpoint | configId Status | Thunk File | Service File |
|---|
| 1 | duplicateSurveyDataList | POST | surveys/duplicate-survey | HAS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | services/surveys/index.ts |
| 2 | postDeleteSurveyDataList | POST | surveys/delete-survey | HAS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | services/surveys/index.ts |
| 3 | getTemplateVersionsData | GET | SurveyTemplates/get-template-versions | HAS configId | store/masterData/index.ts | services/masterData/index.ts |
| 4 | agent.Orgs.list (direct) | GET | org-tree-generate (module=webreportscompare) | HAS configId | N/A (direct component call) | services/orgs/Orgs.ts |
| 5 | moveStartedSurvey | POST | surveys/move-survey | HAS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | services/surveys/index.ts |
| 6 | getSurveyPrivacyPolicyDataList | GET | surveys/get-survey-privacy-policy | HAS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | services/surveys/index.ts |
| 7 | updateSurveyPrivacyPolicyList | POST | surveys/update-survey-privacy-policy | HAS configId | store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | services/surveys/index.ts |
Changes made:
services/surveys/index.ts: duplicateSurvey and postDeleteSurvey now accept configId?: string | null and spread it into the JSON body.
store/Surveys/Features/SurveysAndSurveyTemplates/index.ts: Both thunks read configId from auth.persistedRowData via getState().
services/masterData/index.ts: getTemplateVersions now accepts configId?: string | null and appends &configId=${configId} to the URL.
store/masterData/index.ts: getTemplateVersionsData reads configId from auth.persistedRowData via getState().
components/molecules/Orgs/WebReportOrgs/index.tsx: Added configId selector via useAppSelector; passed as 7th arg to agent.Orgs.list.
services/surveys/index.ts: moveSurvey spreads configId into POST body; getSurveyPrivacyPolicy accepts configId as 5th param and appends &configId=${configId} to the URL; updateSurveyPrivacyPolicy spreads configId into POST body.
store/Surveys/Features/SurveysAndSurveyTemplates/index.ts: moveStartedSurvey, getSurveyPrivacyPolicyDataList, and updateSurveyPrivacyPolicyList thunks read configId from auth.persistedRowData ?? {} via getState().
models/Surveys/models.ts: Added configId?: string | null to IMoveSurvey, PrivacyPolicyParams, and PrivacyPolicyData interfaces.
Key Store Files to Modify
These are the thunk files that need configId added. Each thunk should read configId from auth.persistedRowData.configId (with = '' default).
| Store File | Thunks to Update | Routes Affected |
|---|
store/Surveys/Features/SurveyOverview/index.ts | getSurveyGraphDataForTwoYears | /quick-overview |
store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | getSurveySelectableQuestionsData, getSurveyAppearanceDataList, getSurveySelectableQuestionsRevertedData, getSurveyAppearanceRevertedDataList, getAutomaticReportEmailUsersDataList, getSurveyReportTypesData, updateSurveySettingsDataList, updateSurveySettingsDataListWithDateChange, updateSurveySelectableQuestionsData, updateSurveyAppearanceList, updateSurveyAppearanceLogo, addAdditionalTemplateDataList, deleteAutomaticReportEmailUserDataList, addAutomaticReportEmailUserDataList, updateSurveyReportTypesData | /settings |
store/Surveys/Features/Respondents/index.ts | updateDistributionDetailsData, generateOpenLink, generateInitialOpenLink | /send-out |
store/Surveys/Features/Respondents/EmailAndSms/index.ts | getEmailSMSGeneralSettingsData, getEmailSmsRespondentCount, getEmailSmsRespondentEnableDeleteAll, getRevertedEmailSMSGeneralSettingsData, getEmailRespondents, updateEmailSMSGeneralSettingsData | /send-out |
store/Surveys/Features/Respondents/SvarUT/index.ts | getSvarutGeneralSettingsData, getSvarUTRespondentCount, getSvarUTRespondentEnableDeleteAll, getRevertedSvarutGeneralSettingsData, getSvarUTRespondents, updateSvarutGeneralSettingsData | /send-out |
store/Surveys/Features/Respondents/OTP/index.ts | getOTPRespondentCount, getOTPRespondentEnableDeleteAll, getOTPRespondents | /send-out |
store/Surveys/Features/ActivityLog/index.ts | getAuditTrailTypesData, updateActivityLogData, |
Key Service Files to Modify
Each service method needs configId added to its URL or request body.
| Service File | Methods to Update |
|---|
services/quickOverview/index.ts | surveyGraphDataForTwoYears, downloadOverviewAllData |
services/surveys/index.ts | getSurveySelectableQuestions, getSurveyAppearance, updateSurveySettings, updateSurveySelectableQuestions, updateSurveyAppearance, updateSurveyAppearanceLogo, getAutomaticReportEmailUsers, deleteAutomaticReportEmailUser, addAutomaticReportEmailUser, getSurveyReportTypes, updateSurveyReportTypes |
services/respondent/index.ts | getEmailSMSGeneralSettings, getEmailSmsRespondentCount, enableDeleteAllForDistributionType, getEmailRespondents, updateEmailSMSGeneralSettings, getSvarutGeneralSettings, getSvarUTRespondentCount, getSvarUTRespondents, updateSvarutGeneralSettings, getOTPRespondents, updateDistributionDetails, generateOpenLink, generateInitialOpenLink, getAuditTrailType, auditTrailList |
services/orgs/fullOrgs.ts | getChildren (survey), searchedOrgUnits (survey) |
services/orgs/Orgs.ts | searchedOrgUnits, list, searchOrgs |
services/reportConfig/index.ts | getReportConfigData |
services/report/index.ts | getReport, downloadReport, getReportAsFile, exportReports, emailReport |
services/masterData/index.ts | getAdditionalSurveyTemplates, getEmailsmsStatuses, getSvarutStatuses, getExportTypes |
services/auth/index.ts | getSurveyPreviewParams, getAdditionalSurveyPreviewParams |
Redux State Sync — configId After Survey Creation
When a new survey is created via surveys/add-survey, the API response includes the new survey's configId. This configId must be synced into auth.persistedRowData.configId immediately so that all subsequent calls (which read from the store) use the correct value.
Change made:
| File | Change |
|---|
store/features/Auth/index.ts | Added persistedRowData: any to AuthState (initial value null); added setPersistedRowData reducer to set the full persistedRowData object from payload; added updatePersistedRowDataConfigId reducer action that updates only state.persistedRowData.configId |
store/Surveys/Features/SurveysAndSurveyTemplates/index.ts | postAddSurveyDataList thunk dispatches updatePersistedRowDataConfigId(response.data.configId) on success; imports the action directly from the auth slice (safe import direction — auth does not import from surveys) |
Note: This is not an endpoint migration (the surveys/add-survey request body does not need configId). It is a store-sync step to keep persistedRowData.configId current after the API creates a survey and returns its new configId.
Implementation Pattern
For GET requests (query parameter):
const { auth }: any = getState();
const { configId = '' } = auth.persistedRowData ?? {};
`...&configId=${configId}`
For POST requests (request body):
const { auth }: any = thunkAPI.getState();
const { configId = '' } = auth.persistedRowData ?? {};
const response = await agent.Service.method({ ...existingPayload, configId });
Note: Always use ?? {} when destructuring from persistedRowData since its initial Redux state is null.