Update updates an existing group in the organization.
(ctx context.Context, req *pb.GroupServiceUpdateRequest)
| 165 | |
| 166 | // Update updates an existing group in the organization. |
| 167 | func (g *GroupService) Update(ctx context.Context, req *pb.GroupServiceUpdateRequest) (*pb.GroupServiceUpdateResponse, error) { |
| 168 | currentOrg, err := requireCurrentOrg(ctx) |
| 169 | if err != nil { |
| 170 | return nil, err |
| 171 | } |
| 172 | |
| 173 | // Parse orgID |
| 174 | orgUUID, err := uuid.Parse(currentOrg.ID) |
| 175 | if err != nil { |
| 176 | return nil, errors.BadRequest("invalid", "invalid organization ID") |
| 177 | } |
| 178 | |
| 179 | // Parse groupID and groupName from the request |
| 180 | id, name, err := req.GetGroupReference().Parse() |
| 181 | if err != nil { |
| 182 | return nil, errors.BadRequest("invalid", fmt.Sprintf("invalid project reference: %s", err.Error())) |
| 183 | } |
| 184 | |
| 185 | // Update the group with the provided options |
| 186 | gr, err := g.groupUseCase.Update(ctx, orgUUID, &biz.IdentityReference{ |
| 187 | Name: name, |
| 188 | ID: id, |
| 189 | }, &biz.UpdateGroupOpts{ |
| 190 | NewDescription: req.NewDescription, |
| 191 | NewName: req.NewName, |
| 192 | }) |
| 193 | if err != nil { |
| 194 | return nil, handleUseCaseErr(err, g.log) |
| 195 | } |
| 196 | |
| 197 | return &pb.GroupServiceUpdateResponse{ |
| 198 | Group: bizGroupToPb(gr), |
| 199 | }, nil |
| 200 | } |
| 201 | |
| 202 | // Delete soft-deletes a group by its ID within the current organization. |
| 203 | func (g *GroupService) Delete(ctx context.Context, req *pb.GroupServiceDeleteRequest) (*pb.GroupServiceDeleteResponse, error) { |
nothing calls this directly
no test coverage detected