Add CLI audit command docs
This commit is contained in:
@@ -101,7 +101,7 @@ final class CheckArtworkUserReferencesCommand extends Command
|
||||
/**
|
||||
* @return array{
|
||||
* summary: array{checked:int, valid:int, missing:int, null_user_ids:int},
|
||||
* sample_missing: array<int, array{artwork_id:int, user_id:string, title:string}>,
|
||||
* sample_missing: array<int, array{artwork_id:int, user_id:string, title:string, active:string, published:string, artwork_status:string}>,
|
||||
* missing_user_ids: array<int, true>
|
||||
* }
|
||||
*/
|
||||
@@ -120,6 +120,9 @@ final class CheckArtworkUserReferencesCommand extends Command
|
||||
'artworks.id',
|
||||
'artworks.user_id',
|
||||
'artworks.title',
|
||||
'artworks.is_public',
|
||||
'artworks.published_at',
|
||||
'artworks.artwork_status',
|
||||
DB::raw('users.id as matched_user_id'),
|
||||
])
|
||||
->when($artworkId !== null, fn ($q) => $q->where('artworks.id', $artworkId))
|
||||
@@ -146,6 +149,9 @@ final class CheckArtworkUserReferencesCommand extends Command
|
||||
'artwork_id' => (int) $artwork->id,
|
||||
'user_id' => $artwork->user_id === null ? '[null]' : (string) $artwork->user_id,
|
||||
'title' => (string) ($artwork->title ?? ''),
|
||||
'active' => (bool) ($artwork->is_public ?? false) ? 'yes' : 'no',
|
||||
'published' => $artwork->published_at !== null ? 'yes' : 'no',
|
||||
'artwork_status' => (string) ($artwork->artwork_status ?? ''),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -478,8 +484,15 @@ final class CheckArtworkUserReferencesCommand extends Command
|
||||
if ($sampleRows !== []) {
|
||||
$this->newLine();
|
||||
$this->warn('Sample missing references:');
|
||||
$this->table(['Artwork ID', 'user_id', 'Title'], array_map(
|
||||
static fn (array $row): array => [$row['artwork_id'], $row['user_id'], $row['title']],
|
||||
$this->table(['Artwork ID', 'user_id', 'Title', 'Active', 'Published', 'Status'], array_map(
|
||||
static fn (array $row): array => [
|
||||
$row['artwork_id'],
|
||||
$row['user_id'],
|
||||
$row['title'],
|
||||
$row['active'],
|
||||
$row['published'],
|
||||
$row['artwork_status'],
|
||||
],
|
||||
$sampleRows,
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user