Skip to content

Commit f9428bf

Browse files
Fix pipe and reason being swapped
1 parent 9f66693 commit f9428bf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Backuper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function backup(): BackupDto
5656
}
5757

5858
$zipMeta->each(fn ($meta, $key) => match ($key) {
59-
'skipped' => $meta->each($metadata->addSkippedPipe(...)),
59+
'skipped' => $meta->each(fn (string $reason, string $pipe) => $metadata->addSkippedPipe($pipe, $reason)),
6060
});
6161

6262
event(new BackupCreated($backup));

src/Http/Resources/MetadataResource.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Itiden\Backup\Http\Resources;
66

77
use Illuminate\Http\Resources\Json\JsonResource;
8+
use Itiden\Backup\DataTransferObjects\SkippedPipeDto;
89

910
/**
1011
* @mixin \Itiden\Backup\Models\Metadata
@@ -17,7 +18,10 @@ public function toArray($request)
1718
'created_by' => $this->getCreatedBy(),
1819
'downloads' => $this->getDownloads(),
1920
'restores' => $this->getRestores(),
20-
'skipped_pipes' => $this->getSkippedPipes(),
21+
'skipped_pipes' => $this->getSkippedPipes()->map(fn (SkippedPipeDto $pipe) => [
22+
'pipe' => $pipe->pipe::getKey(),
23+
'reason' => $pipe->reason,
24+
]),
2125
];
2226
}
2327
}

0 commit comments

Comments
 (0)