feat: ship creator journey v2 and profile updates

This commit is contained in:
2026-04-12 21:42:07 +02:00
parent a2457f4e49
commit d5cff21ea2
335 changed files with 20147 additions and 1545 deletions

View File

@@ -7,6 +7,7 @@ namespace App\Services;
use App\Models\Artwork;
use App\Models\Collection;
use App\Models\User;
use App\Services\Maturity\ArtworkMaturityService;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Pagination\LengthAwarePaginator;
@@ -15,6 +16,10 @@ use Illuminate\Validation\ValidationException;
class SmartCollectionService
{
public function __construct(private readonly ArtworkMaturityService $maturity)
{
}
public function sanitizeRules(?array $input): ?array
{
if ($input === null) {
@@ -278,6 +283,8 @@ class SmartCollectionService
->where('artworks.is_approved', true)
->whereNotNull('artworks.published_at')
->where('artworks.published_at', '<=', now());
$this->maturity->applyViewerFilter($query, request()->user());
}
$method = ($sanitized['match'] ?? 'all') === 'any' ? 'orWhere' : 'where';
@@ -382,7 +389,10 @@ class SmartCollectionService
{
return match ($sort) {
Collection::SORT_OLDEST => $query->orderBy('artworks.published_at')->orderBy('artworks.id'),
Collection::SORT_POPULAR => $query->orderByDesc('artworks.view_count')->orderByDesc('artworks.id'),
Collection::SORT_POPULAR => $query
->leftJoin('artwork_stats as artwork_stats_sort', 'artwork_stats_sort.artwork_id', '=', 'artworks.id')
->orderByRaw('COALESCE(artwork_stats_sort.views, 0) DESC')
->orderByDesc('artworks.id'),
default => $query->orderByDesc('artworks.published_at')->orderByDesc('artworks.id'),
};
}