MCPcopy Create free account
hub / github.com/PaperDebugger/paperdebugger / UpdateSettings

Method UpdateSettings

internal/api/user/update_settings.go:13–29  ·  view source on GitHub ↗

UpdateSettings implements the UpdateSettings RPC from the UserService

(ctx context.Context, req *userv1.UpdateSettingsRequest)

Source from the content-addressed store, hash-verified

11
12// UpdateSettings implements the UpdateSettings RPC from the UserService
13func (s *UserServer) UpdateSettings(ctx context.Context, req *userv1.UpdateSettingsRequest) (*userv1.UpdateSettingsResponse, error) {
14 actor, err := contextutil.GetActor(ctx)
15 if err != nil {
16 return nil, shared.ErrInvalidActor("user not authenticated")
17 }
18
19 modelSettings := mapper.MapProtoSettingsToModel(req.GetSettings())
20 updatedSettings, err := s.userService.UpdateUserSettings(ctx, actor.ID, *modelSettings)
21 if err != nil {
22 s.logger.Error("Failed to update user settings", "error", err, "userID", actor.ID)
23 return nil, shared.ErrInternal("failed to update user settings")
24 }
25
26 return &userv1.UpdateSettingsResponse{
27 Settings: mapper.MapModelSettingsToProto(updatedSettings),
28 }, nil
29}

Callers

nothing calls this directly

Calls 5

GetActorFunction · 0.92
MapProtoSettingsToModelFunction · 0.92
MapModelSettingsToProtoFunction · 0.92
UpdateUserSettingsMethod · 0.80
GetSettingsMethod · 0.65

Tested by

no test coverage detected