Skip to content

Commit

Permalink
fix updateuser endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
robomill committed Nov 4, 2024
1 parent e887f1b commit 90b3c90
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit 90b3c90

Please sign in to comment.