-
Notifications
You must be signed in to change notification settings - Fork 11
Role by CSV file and by manual insertion #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
For addition to UI, post images of before and after in PR |
|
UI needs to be improved. Remove the 'Or Upload CSV'. Add a toggle instead to switch between single member creation and multi member by csv upload |
Refer to new role page in frontend repo for this. Toggles switches are present there, reuse it. Also please go through the comments and review notes here.
|
dvishal485
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks good, great work :)
Just one minor change is required, since roles can change overtime, make sure not to hardcode them.
src/pages/Member/AddMember/index.tsx
Outdated
| const roleMap: { [key: string]: string } = { | ||
| "Superhuman": "64b1f0d8e4a0c12345678901", | ||
| "Npc": "64b1f0d8e4a0c12345678902", | ||
| "Coordinator": "64b1f0d8e4a0c12345678903", | ||
| "Columnist": "64b1f0d8e4a0c12345678904", | ||
| "Developer": "64b1f0d8e4a0c12345678905", | ||
| "Designer": "64b1f0d8e4a0c12345678906", | ||
| "Illustrator": "64b1f0d8e4a0c12345678907", | ||
| "Alumni": "64b1f0d8e4a0c12345678908", | ||
| "Photographer": "64b1f0d8e4a0c12345678909", | ||
| "Editor": "64b1f0d8e4a0c12345678910", | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not hardcode this, our nix portal is very dynamic. a role which exists today may not exists tomorrow. Take reference from here which fetches the available roles.
nix-frontend-v2/src/pages/Roles/AllRoles/index.tsx
Lines 29 to 45 in 1014fce
| const fetchRoles = () => { | |
| const rolesEndpoint = "/role"; | |
| API.get(rolesEndpoint) | |
| .then((rolesResponse) => { | |
| setRolesList(rolesResponse.data.data); | |
| setLoading(false); | |
| }) | |
| .catch((error) => { | |
| setLoading(false); | |
| setError(error); | |
| }); | |
| }; | |
| useEffect(() => { | |
| fetchRoles(); | |
| }, []); |
The roles name as well as id can be accessed as with fields role_name and role_id. For instance -
nix-frontend-v2/src/pages/Roles/AllRoles/index.tsx
Lines 61 to 67 in 1014fce
| <div key={role.role_id}> | |
| <Collapsible | |
| label={ | |
| role.role_name.charAt(0).toUpperCase() + | |
| role.role_name.slice(1).toLowerCase() | |
| } | |
| > |
| const sampleData = [ | ||
| ["name", "email", "role"], | ||
| ["John Doe", "john.doe@example.com", "Developer"], | ||
| ["Jane Smith", "jane.smith@example.com", "Designer"], | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sample data have a valid entry for each role fetched earlier. Like -
const sampleData = ["name", "email", "role"] + (for role in roles) {
["john", "john@doe.com", role.role_name]
}
Ofc this is a pseudo code for explanation.
* adjusted the update member to use the new bulk auth route * reconfigured .env and .gitignore like before * Added support for to add role in /signup and /post-add-user * added .env and well as formatted the code




No description provided.