Open erenfn opened 6 days ago
Should the organisation name be saved in the db? If yes, then should there be a different model or an extra field within the user model?
Yes, it should be saved in the db. Check the develop branch -this is our most up-to-date branch. We have 'team' table there which includes the organisation name
I want to work on this issue can you please assign it to me?
Hi @erenfn, There are certain doubts regarding the 3rd point. I studied the code base and found that there are already routes defined to add and fetch organisation name from the backend.
I don't remember having a 'set organization' route, but I may have overlooked that. In that case, just use that endpoint in the frontend; you don't have to create one for the backend.
`js const getTeamDetails = async (req, res) => try { const data = await teamService.getTeam(); if (!data || !data.team || !data.users) { throw new Error("Team data not found"); } const result = { name: data.team.name, users: data.users.map((user)=> ({ name: user.name, email: user.email, role: settings.user.roleName[user.role] })), } return res.status(200).json(result); } catch (err) { const { statusCode, payload } = internalServerError( "GET_TEAM_ERROR", err.message, ); res.status(statusCode).json(payload); } };
const updateTeamDetails = async (req, res) => { const userId = req.user.id; const { name } = req.body; try { await teamService.updateTeam(userId, name); return res.status(200).json({ message: "Team Details Updated Successfully" }); } catch (err) { const { statusCode, payload } = internalServerError( "UPDATE_TEAM_ERROR", err.message, ); res.status(statusCode).json(payload); } };`
These are the 2 controllers I am talking about.
The updateTeamDetails endpoint is for 'editing' and is a PUT request. We need to create a POST request to add the organization name. Although the implementation will be very similar, it is better to follow REST API conventions.
Hi @erenfn, I have certain doubts regarding the tasks
[ ] After the first user (admin) registers, it should be directed to '/progress-steps' page, and after these steps are done, this page should no longer be visible to anyone.
[ ] Use team/invite endpoint to send invites in the first page
[ ] Create an endpoint in the backend to set the organisation name and use it in the third progress-steps page
Work on the develop branch