feat: ship creator journey v2 and profile updates
This commit is contained in:
@@ -6,6 +6,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Artwork;
|
||||
use App\Models\ArtworkDownload;
|
||||
use App\Services\ArtworkStatsService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -34,6 +35,10 @@ final class ArtworkDownloadController extends Controller
|
||||
'gz',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
private readonly ArtworkStatsService $stats,
|
||||
) {}
|
||||
|
||||
public function __invoke(Request $request, int $id): BinaryFileResponse
|
||||
{
|
||||
$artwork = Artwork::query()->find($id);
|
||||
@@ -51,6 +56,15 @@ final class ArtworkDownloadController extends Controller
|
||||
$this->recordDownload($request, $artwork->id);
|
||||
$this->incrementDownloadCountIfAvailable($artwork->id);
|
||||
|
||||
try {
|
||||
$this->stats->incrementDownloads((int) $artwork->id, 1, defer: false);
|
||||
} catch (\Throwable $exception) {
|
||||
Log::warning('Failed to increment artwork_stats download counter.', [
|
||||
'artwork_id' => $artwork->id,
|
||||
'error' => $exception->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
if (! File::isFile($filePath)) {
|
||||
Log::warning('Artwork original file missing for download.', [
|
||||
'artwork_id' => $artwork->id,
|
||||
|
||||
Reference in New Issue
Block a user