UpdateSettings implements the UpdateSettings RPC from the UserService
(ctx context.Context, req *userv1.UpdateSettingsRequest)
| 11 | |
| 12 | // UpdateSettings implements the UpdateSettings RPC from the UserService |
| 13 | func (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 | } |
nothing calls this directly
no test coverage detected