entProjectMembershipToBiz converts an ent.Membership to a biz.ProjectMembership and includes user or group details if available
(m *ent.Membership, u *ent.User, g *ent.Group)
| 386 | // entProjectMembershipToBiz converts an ent.Membership to a biz.ProjectMembership |
| 387 | // and includes user or group details if available |
| 388 | func entProjectMembershipToBiz(m *ent.Membership, u *ent.User, g *ent.Group) *biz.ProjectMembership { |
| 389 | mem := &biz.ProjectMembership{ |
| 390 | MembershipType: m.MembershipType, |
| 391 | Role: m.Role, |
| 392 | CreatedAt: &m.CreatedAt, |
| 393 | UpdatedAt: &m.UpdatedAt, |
| 394 | ParentID: m.ParentID, |
| 395 | } |
| 396 | |
| 397 | // Add the parent resource ID if it exists |
| 398 | if m.Edges.Parent != nil { |
| 399 | mem.ParentResourceID = &m.Edges.Parent.ResourceID |
| 400 | } |
| 401 | |
| 402 | if u != nil { |
| 403 | mem.User = entUserToBizUser(u) |
| 404 | } |
| 405 | |
| 406 | if g != nil { |
| 407 | mem.Group = entGroupToBiz(g) |
| 408 | } |
| 409 | |
| 410 | return mem |
| 411 | } |
| 412 | |
| 413 | // ListPendingInvitationsByProject retrieves pending invitations for a specific project in an organization. |
| 414 | func (r *ProjectRepo) ListPendingInvitationsByProject(ctx context.Context, orgID uuid.UUID, projectID uuid.UUID, paginationOpts *pagination.OffsetPaginationOpts) ([]*biz.OrgInvitation, int, error) { |
no test coverage detected