Skip to content

Commit

Permalink
User API: Add missing project display name and description (#3451)
Browse files Browse the repository at this point in the history
User API: Add project display name and description

This commit popukates the missing description and display name to the user API.

Signed-off-by: Adolfo García Veytia (puerco) <puerco@stacklok.com>
  • Loading branch information
puerco authored Jun 5, 2024
1 parent 3d23d1e commit b2aecdf
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions internal/controlplane/handlers_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,22 @@ func (s *Server) getUserDependencies(ctx context.Context, user db.User) ([]*pb.P
return nil, err
}

// Try to parse the project metadata to complete the response fields
pDisplay := pinfo.Name
pDescr := ""
meta, err := projects.ParseMetadata(&pinfo)
if err == nil {
pDisplay = meta.Public.DisplayName
pDescr = meta.Public.Description
}

projectsPB = append(projectsPB, &pb.Project{
ProjectId: proj.String(),
Name: pinfo.Name,
CreatedAt: timestamppb.New(pinfo.CreatedAt),
UpdatedAt: timestamppb.New(pinfo.UpdatedAt),
ProjectId: proj.String(),
Name: pinfo.Name,
CreatedAt: timestamppb.New(pinfo.CreatedAt),
UpdatedAt: timestamppb.New(pinfo.UpdatedAt),
DisplayName: pDisplay,
Description: pDescr,
})
}

Expand Down

0 comments on commit b2aecdf

Please sign in to comment.