add remaining org/proj/user initial sync
This commit is contained in:
@@ -47,12 +47,18 @@ type User struct {
|
||||
}
|
||||
|
||||
func (u *User) ToDetails() *models.UserDetails {
|
||||
if u.ID == "" {
|
||||
var id string
|
||||
|
||||
if u != nil {
|
||||
id = idOrLinkID(u.ID, u.HREF)
|
||||
}
|
||||
|
||||
if id == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &models.UserDetails{
|
||||
ID: u.ID,
|
||||
ID: id,
|
||||
FullName: u.FullName,
|
||||
Organizations: nil,
|
||||
Projects: u.Projects.ToDetails(),
|
||||
@@ -62,9 +68,9 @@ func (u *User) ToDetails() *models.UserDetails {
|
||||
func (c *Client) getUser(ctx context.Context, id string) (*User, error) {
|
||||
var user User
|
||||
|
||||
_, err := c.DoRequest(ctx, http.MethodGet, c.baseURL.JoinPath(usersPath, id).String(), nil, &user)
|
||||
_, err := c.DoRequest(ctx, http.MethodGet, usersPath+"/"+id, nil, &user)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error loading user: %w", err)
|
||||
return nil, fmt.Errorf("error loading organization: %w", err)
|
||||
}
|
||||
|
||||
return &user, nil
|
||||
@@ -78,3 +84,11 @@ func (c *Client) GetUserDetails(ctx context.Context, id gidx.PrefixedID) (*model
|
||||
|
||||
return user.ToDetails(), nil
|
||||
}
|
||||
|
||||
func (c *Client) GetUserOrganizationRole(ctx context.Context, userID, orgID gidx.PrefixedID) (string, error) {
|
||||
return "collaborator", nil
|
||||
}
|
||||
|
||||
func (c *Client) GetUserProjectRole(ctx context.Context, userID, projectID gidx.PrefixedID) (string, error) {
|
||||
return "collaborator", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user