-
Notifications
You must be signed in to change notification settings - Fork 74
feat: add api for membership management #2821
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
base: main
Are you sure you want to change the base?
Conversation
Add and delete users from a team
…pattern-matching to better handle with clause
…are into etienne/admin-api-updates
Ziinc
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.
as discussed, would also need private:admin scope for pseudo rbac
| |> add_access_token(user, "private") | ||
| |> post(~p"/api/teams/#{main_team.token}/members", %{email: new_member.email}) | ||
| |> response(204) | ||
| |> assert_schema("AcceptedResponse") == "" |
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.
should return created user, should also be a 201 since we're creating a team_user
| test "returns not found if doesn't own the team", %{conn: conn, main_team: main_team} do | ||
| invalid_user = insert(:user) | ||
| new_member = insert(:user) | ||
|
|
||
| assert conn | ||
| |> add_access_token(invalid_user, "private") | ||
| |> post(~p"/api/teams/#{main_team.token}/members", %{email: new_member.email}) | ||
| |> json_response(404) | ||
| |> assert_schema("NotFoundResponse") == %{error: "Not Found"} | ||
| end |
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.
401 would be more appropriate.
would also need a 400 test for bad team_user attrs
| end | ||
| end | ||
|
|
||
| describe "remove_member/2" do |
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.
| describe "remove_member/2" do | |
| describe "remove_member/2 for team_user with user record" do |
Also needs a test for team_user with when there is no user record, which is when they are invited without having a prior account.
| end | ||
|
|
||
| describe "add_member/2" do | ||
| test "adds an existing user to a team", %{ |
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.
also needs case where there is no existing user record and we only create the record on team_users table
Add and delete users from a team