Get retrieves a group by its ID within the current organization.
(ctx context.Context, req *pb.GroupServiceGetRequest)
| 80 | |
| 81 | // Get retrieves a group by its ID within the current organization. |
| 82 | func (g *GroupService) Get(ctx context.Context, req *pb.GroupServiceGetRequest) (*pb.GroupServiceGetResponse, error) { |
| 83 | currentOrg, err := requireCurrentOrg(ctx) |
| 84 | if err != nil { |
| 85 | return nil, err |
| 86 | } |
| 87 | |
| 88 | // Parse orgID |
| 89 | orgUUID, err := uuid.Parse(currentOrg.ID) |
| 90 | if err != nil { |
| 91 | return nil, errors.BadRequest("invalid", "invalid organization ID") |
| 92 | } |
| 93 | |
| 94 | // Parse groupID and groupName from the request |
| 95 | id, name, err := req.GetGroupReference().Parse() |
| 96 | if err != nil { |
| 97 | return nil, errors.BadRequest("invalid", fmt.Sprintf("invalid group reference: %s", err.Error())) |
| 98 | } |
| 99 | |
| 100 | // Initialize the options for getting the group |
| 101 | opts := &biz.IdentityReference{ |
| 102 | ID: id, |
| 103 | Name: name, |
| 104 | } |
| 105 | |
| 106 | gr, err := g.groupUseCase.Get(ctx, orgUUID, opts) |
| 107 | if err != nil { |
| 108 | return nil, handleUseCaseErr(err, g.log) |
| 109 | } |
| 110 | |
| 111 | return &pb.GroupServiceGetResponse{ |
| 112 | Group: bizGroupToPb(gr), |
| 113 | }, nil |
| 114 | } |
| 115 | |
| 116 | // List retrieves a list of groups within the current organization, with optional filters and pagination. |
| 117 | func (g *GroupService) List(ctx context.Context, req *pb.GroupServiceListRequest) (*pb.GroupServiceListResponse, error) { |
nothing calls this directly
no test coverage detected