Skip to content
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

[DPLATFORM-291] fix the updateUser endpoint #110

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func (c *Client) CreateUser(u User) (User, error) {
return created, nil
}

func (c *Client) UpdateUser(u User) (User, error) {
url := fmt.Sprintf("%s/api/user", c.BaseURL)
func (c *Client) UpdateUser(u User, id int) (User, error) {
url := fmt.Sprintf("%s/api/user/%d", c.BaseURL, id)
b := new(bytes.Buffer)
_ = json.NewEncoder(b).Encode(u)
req, err := http.NewRequest(http.MethodPut, url, b)
Expand Down
2 changes: 1 addition & 1 deletion client/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func TestUser(t *testing.T) {
HTTPClient: &http.Client{},
}

us, err := c.UpdateUser(userToBeUpdated)
us, err := c.UpdateUser(userToBeUpdated, 1)

assert.Nil(t, err)
assert.Equal(t, expected, us)
Expand Down
2 changes: 1 addition & 1 deletion metabase/resource_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func resourceUserUpdate(_ context.Context, d *schema.ResourceData, meta interfac
}

// Update the user
updated, err := c.UpdateUser(u)
updated, err := c.UpdateUser(u, userId)
if err != nil {
diags = append(diags, diag.Diagnostic{
Severity: diag.Error,
Expand Down
Loading