MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Update

Method Update

app/controlplane/internal/service/group.go:167–200  ·  view source on GitHub ↗

Update updates an existing group in the organization.

(ctx context.Context, req *pb.GroupServiceUpdateRequest)

Source from the content-addressed store, hash-verified

165
166// Update updates an existing group in the organization.
167func (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.
203func (g *GroupService) Delete(ctx context.Context, req *pb.GroupServiceDeleteRequest) (*pb.GroupServiceDeleteResponse, error) {

Callers

nothing calls this directly

Calls 7

requireCurrentOrgFunction · 0.85
handleUseCaseErrFunction · 0.85
bizGroupToPbFunction · 0.85
ParseMethod · 0.80
ErrorMethod · 0.65
UpdateMethod · 0.65
GetGroupReferenceMethod · 0.45

Tested by

no test coverage detected