bluewave-labs / bluewave-onboarding

https://bluewavelabs.ca
GNU Affero General Public License v3.0
26 stars 19 forks source link

First User Register Steps #303

Open erenfn opened 6 days ago

erenfn commented 6 days ago

Work on the develop branch

d02ev commented 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?

erenfn commented 5 days ago

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

d02ev commented 5 days ago

I want to work on this issue can you please assign it to me?

d02ev commented 5 days ago

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.

erenfn commented 5 days ago

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.

d02ev commented 4 days ago

`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.

erenfn commented 3 days ago

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.

d02ev commented 1 day ago

Hi @erenfn, I have certain doubts regarding the tasks

  1. "After the first user (admin) registers, it should be directed to '/progress-steps' page, and after these steps are done, this page should be visible again to anybody." What do you mean by "visible again to anybody" ?
  2. "Use team/invite endpoint to send invites in the first page". Should there be a 'Submit' or 'Send Invites' button right next to the input box, to send the invites or should it be handled by the 'Next' button itself?
  3. "Create an endpoint in the backend to set the organisation name and use it in the third progress-steps page". Similarly should there be a 'Submit' or 'Set Org Name' button right next to the input name or should it be handled by the 'Next' button ?
erenfn commented 1 day ago
  1. Thank you for pointing that out is should be 'should not be visible'
  2. Those endpoints should be called when the user completes progress-steps in the 4th page by clicking 'Sweet!' image