Skip to content

Artyom - Added Proper Frontend User Invitations #165

Draft
Artyom-G wants to merge 9 commits intomainfrom
F25/artyom/invite-user
Draft

Artyom - Added Proper Frontend User Invitations #165
Artyom-G wants to merge 9 commits intomainfrom
F25/artyom/invite-user

Conversation

@Artyom-G
Copy link
Member

Notion ticket link

Ticket Name

Implementation description

  • Added invitations to the frontend
  • You can now invite a new user, this will
  • Create a new user
  • Send an invitation email
  • If the invitation fails then it deletes the user to keep it atomic
  • If the email invitation is successful then the user can accept it and register via an email link

Steps to test

  1. Go to the user page and click Invite
  2. Fill in the information boxes and hit invite, this will send a registration email
  3. Register via the email and see your user activated
  4. To test for failure, you can go to backend/authRoutes.tsx and make the invite function throw an error (throw "bingus";) right before the res.status(204).send(); line. This will always fail the invitation and you can see that the newly created user is successfully deleted (check the postgres)

What should reviewers focus on?

  • The successful invitations
  • Check how atomic the process is, should any other cases be added?

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

@Artyom-G Artyom-G requested a review from matthewd-so November 21, 2025 01:21
Copy link
Contributor

@matthewd-so matthewd-so left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just fix linting errors

Copy link
Collaborator

@sthuray sthuray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ticket requirements not fulfilled, marked as draft.

return res.status(400).send(getApiValidationError("role", "string"));
}
if (!validatePrimitive(req.body.colorLevel, "integer")) {
// put a false here, not sure what a color level is because the backend literally sets it to 1 on creation anyway
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix this

res.status(404).send(getErrorMessage(error));
} else {
res.status(500).json({ error: getErrorMessage(error) });
await userService.deleteUserByEmail(req.body.email);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behaviour wasn't part of the ticket requirements, can you explain this decision?

Note: invite user endpoint does NOT create a user.

id: number;
firstName: string;
lastName: string;
name: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this change?

Did you check whether it causes any regressions?

@sthuray sthuray marked this pull request as draft December 18, 2025 02:44
@VictorChan880 VictorChan880 force-pushed the F25/artyom/invite-user branch from 0135b3c to ad20aea Compare February 4, 2026 02:54
@Akishai18
Copy link
Collaborator

@VictorChan880 Fix merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants