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

Method UpdateNameAndLastName

app/controlplane/pkg/data/user.go:78–88  ·  view source on GitHub ↗

UpdateNameAndLastName updates the first and last name of a user

(ctx context.Context, userID uuid.UUID, firstName, lastName *string)

Source from the content-addressed store, hash-verified

76
77// UpdateNameAndLastName updates the first and last name of a user
78func (r *userRepo) UpdateNameAndLastName(ctx context.Context, userID uuid.UUID, firstName, lastName *string) (*biz.User, error) {
79 ctx, span := otelx.Start(ctx, userRepoTracer, "UserRepo.UpdateNameAndLastName")
80 defer span.End()
81
82 u, err := r.data.DB.User.UpdateOneID(userID).SetNillableFirstName(firstName).SetNillableLastName(lastName).SetUpdatedAt(time.Now()).Save(ctx)
83 if err != nil {
84 return nil, fmt.Errorf("error updating user name: %w", err)
85 }
86
87 return entUserToBizUser(u), nil
88}
89
90// Find by ID, returns nil if not found
91func (r *userRepo) FindByID(ctx context.Context, userID uuid.UUID) (*biz.User, error) {

Callers

nothing calls this directly

Calls 7

StartFunction · 0.92
entUserToBizUserFunction · 0.85
SaveMethod · 0.65
SetUpdatedAtMethod · 0.45
SetNillableLastNameMethod · 0.45
SetNillableFirstNameMethod · 0.45
UpdateOneIDMethod · 0.45

Tested by

no test coverage detected