Skip to content
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
18 changes: 15 additions & 3 deletions app/controlplane/api/controlplane/v1/project.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/controlplane/api/controlplane/v1/project.proto
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ message ProjectMember {
google.protobuf.Timestamp updated_at = 5;
// The ID of latest project version this member is associated with
string latest_project_version_id = 6;
// Optional parent ID for nested project memberships
optional string parent_id = 7;
}

// ProjectServiceAddMemberRequest contains the information needed to add a user to a project
Expand Down
16 changes: 16 additions & 0 deletions app/controlplane/api/gen/frontend/controlplane/v1/project.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions app/controlplane/internal/service/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,16 @@ func mapProjectMemberRoleToAuthzRole(role pb.ProjectMemberRole) authz.Role {

// bizProjectMembershipToPb converts a biz.ProjectMembership to a pb.ProjectMember
func bizProjectMembershipToPb(m *biz.ProjectMembership) *pb.ProjectMember {
var role pb.ProjectMemberRole

// Map the role string back to a protobuf enum
role = mapAuthzRoleToProjectMemberRole(m.Role)
role := mapAuthzRoleToProjectMemberRole(m.Role)

pbMember := &pb.ProjectMember{
Role: role,
}

if m.ParentID != nil {
pbMember.ParentId = biz.ToPtr(m.ParentID.String())
}

if m.User != nil {
pbMember.Subject = &pb.ProjectMember_User{
User: bizUserToPb(m.User),
Expand Down
2 changes: 2 additions & 0 deletions app/controlplane/pkg/biz/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ type ProjectMembership struct {
CreatedAt *time.Time
// UpdatedAt is the timestamp when the membership was last updated.
UpdatedAt *time.Time
// ParentID is used for nested memberships, if applicable
ParentID *uuid.UUID
}

// GroupProjectInfo represents detailed information about a project that a group is a member of
Expand Down
1 change: 1 addition & 0 deletions app/controlplane/pkg/data/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ func entProjectMembershipToBiz(m *ent.Membership, u *ent.User, g *ent.Group) *bi
Role: m.Role,
CreatedAt: &m.CreatedAt,
UpdatedAt: &m.UpdatedAt,
ParentID: m.ParentID,
}

if u != nil {
Expand Down
Loading