ExportProgress returns progress of the export job.
(ctx context.Context, session *auth.Session, spaceRef string, )
| 33 | |
| 34 | // ExportProgress returns progress of the export job. |
| 35 | func (c *Controller) ExportProgress(ctx context.Context, |
| 36 | session *auth.Session, |
| 37 | spaceRef string, |
| 38 | ) (ExportProgressOutput, error) { |
| 39 | space, err := c.getSpaceCheckAuth(ctx, session, spaceRef, enum.PermissionSpaceView) |
| 40 | if err != nil { |
| 41 | return ExportProgressOutput{}, fmt.Errorf("failed to acquire access to space: %w", err) |
| 42 | } |
| 43 | |
| 44 | progress, err := c.exporter.GetProgressForSpace(ctx, space.ID) |
| 45 | if errors.Is(err, exporter.ErrNotFound) { |
| 46 | return ExportProgressOutput{}, usererror.NotFound("No recent or ongoing export found for space.") |
| 47 | } |
| 48 | if err != nil { |
| 49 | return ExportProgressOutput{}, fmt.Errorf("failed to retrieve export progress: %w", err) |
| 50 | } |
| 51 | |
| 52 | return ExportProgressOutput{Repos: progress}, nil |
| 53 | } |
no test coverage detected