feat(surveys): implement account setup survey functionality

- Added new database migration to create survey-related tables for storing questions and responses.
- Developed SurveyController to handle fetching and submitting survey data.
- Created survey API routes for account setup, including endpoints for retrieving the survey and submitting responses.
- Implemented frontend components for displaying the survey and capturing user responses, integrating with Redux for state management.
- Enhanced localization files to include survey-related text for multiple languages.
- Added validation middleware for survey submissions to ensure data integrity.
This commit is contained in:
chamikaJ
2025-07-24 17:12:47 +05:30
parent 15ff69a031
commit fe7c15ced1
22 changed files with 1344 additions and 204 deletions

View File

@@ -1,4 +1,5 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { IAccountSetupSurveyData } from '@/types/account-setup/survey.types';
interface Task {
id: number;
@@ -17,6 +18,7 @@ interface AccountSetupState {
tasks: Task[];
teamMembers: Email[];
currentStep: number;
surveyData: IAccountSetupSurveyData;
}
const initialState: AccountSetupState = {
@@ -26,6 +28,7 @@ const initialState: AccountSetupState = {
tasks: [{ id: 0, value: '' }],
teamMembers: [{ id: 0, value: '' }],
currentStep: 0,
surveyData: {},
};
const accountSetupSlice = createSlice({
@@ -50,6 +53,9 @@ const accountSetupSlice = createSlice({
setCurrentStep: (state, action: PayloadAction<number>) => {
state.currentStep = action.payload;
},
setSurveyData: (state, action: PayloadAction<Partial<IAccountSetupSurveyData>>) => {
state.surveyData = { ...state.surveyData, ...action.payload };
},
resetAccountSetup: () => initialState,
},
});
@@ -61,6 +67,7 @@ export const {
setTasks,
setTeamMembers,
setCurrentStep,
setSurveyData,
resetAccountSetup,
} = accountSetupSlice.actions;