Closed d02ev closed 4 weeks ago
The pull request introduces several changes across multiple files, primarily focusing on enhancing team management functionalities. Key updates include the addition of a new permission setOrg
in the settings, a new asynchronous function setOrganisation
in the team controller for creating organizations, and a corresponding route for this function. Additionally, new service methods for managing teams are introduced, along with modifications in the frontend to handle authentication types and integrate error handling in the user interface.
File Path | Change Summary |
---|---|
backend/config/settings.js | Added setOrg permission to team.permissions . |
backend/src/controllers/team.controller.js | Added setOrganisation function for creating organizations; updated exports to include this function. |
backend/src/routes/team.routes.js | Added new POST route /set-organisation protected by JWT and requiring setOrg permission. |
backend/src/service/team.service.js | Added createTeam(name) method; existing methods retain error handling. |
frontend/src/scenes/login/CreateAccountPage.jsx | Updated handleAuthSuccess to include AUTH_TYPE.SIGNUP in its parameters. |
frontend/src/scenes/login/LoginPage.jsx | Modified handleSubmit to pass AUTH_TYPE.LOGIN to handleAuthSuccess . |
frontend/src/scenes/progressSteps/ProgressStepsMain.jsx | Added state variables for error handling; introduced sendInvitesAndSetOrgName for sending invites and setting org name. |
frontend/src/services/teamServices.js | Introduced getTeamCount and modified setOrganisation functions for team operations. |
frontend/src/utils/constants.js | Updated roles constant to be immutable with Object.freeze . |
frontend/src/utils/loginHelper.js | Updated handleAuthSuccess to include getTeamCount for conditional navigation based on team count. |
backend/index.js | Commented out database synchronization logic, disabling automatic model syncing. |
backend/src/utils/constants.helper.js | Added constants MAX_ORG_NAME_LENGTH and ORG_NAME_REGEX for organization name validation. |
frontend/src/scenes/progressSteps/ProgressStepsMain.module.scss | Added .errorMessage class for styling error messages. |
frontend/src/controllers/invite.controller.js | Modified response structure in sendTeamInvite for standardized JSON response. |
frontend/src/services/inviteService.js | Introduced sendInvites function for handling team member invites via email. |
team.permissions
object and the addition of the setOrg
permission.backend
, frontend
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
I have changed the validation in the progress-steps
pages. I have made them dynamic and informative, also let me know if there are any other validation logics for the fields that needs to be integrated. I am adding screenshots of the same.
For now I have added a basic valid email regex and a non empty validation check for organisation name. The Next
button will be disabled until the user enters a valid text for the fields.
Invalid email
Valid email
Invalid org name
Valid org name
Let me know what you think about these changes.
I think you may not have pushed your changes. Also, please check if the 'invite' section allows inviting multiple emails. An email should be added to the list when the user presses Enter in that field.
Yes, I have not yet pushed the latest changes. I wanted to get your views before pushing any further updates. Also, the invite section allows for multiple emails, that functionality remains untouched. I will push these latest changes now.
I’m also able to proceed to the fourth page without setting an organization name. The validation only activates when I start typing something.
Also make sure you add 8px between inputs here.
Also, did you copied those inputs from our components folder?
Yes, I copied the input
fields from the components folder.
When you start typing an email but then delete it, the Next button remains disabled. I suggest activating the email check when the user presses Enter and keeping the Next button enabled at all times.
Here's a screen recording, where only when the user presses Enter
the email validations are done and also these invalid emails are not added to the list and when the user enters a valid email and presses Enter
, the error message disappears and the email is added to the list. I have also removed button being disabled if the validation fails, should I make this field required ? or keep it as it is
Screencast from 2024-10-30 21-15-13.webm
You can make the field for organization name required. The validation for email invites looks good now
You can make the field for organization name required. The validation for email invites looks good now
If an error occurred either while setting an organization or sending invites in the last step. Should I display a generic error or an error toast and navigate the user to home page ?
Don’t navigate the user to the home page if an error occurs. Instead, display the error message on the last step to prompt the user to make changes. Ideally, though, we shouldn't encounter an error in the last step, as the necessary checks are done beforehand.