feat: ship creator journey v2 and profile updates
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Models\Artwork;
|
||||
use App\Models\Collection;
|
||||
use App\Models\Group;
|
||||
use App\Models\User;
|
||||
use App\Services\Maturity\ArtworkMaturityService;
|
||||
use App\Services\ThumbnailPresenter;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
@@ -32,6 +33,7 @@ class GroupService
|
||||
private readonly GroupActivityService $activity,
|
||||
private readonly GroupHistoryService $history,
|
||||
private readonly GroupReputationService $reputation,
|
||||
private readonly ArtworkMaturityService $maturity,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -372,6 +374,8 @@ class GroupService
|
||||
->where('is_approved', true)
|
||||
->whereNotNull('published_at');
|
||||
|
||||
$this->maturity->applyViewerFilter($query, request()->user());
|
||||
|
||||
if ((int) ($group->featured_artwork_id ?? 0) > 0) {
|
||||
$featuredArtwork = (clone $query)
|
||||
->where('id', (int) $group->featured_artwork_id)
|
||||
@@ -461,14 +465,18 @@ class GroupService
|
||||
|
||||
public function publicArtworkCards(Group $group, int $limit = 18): array
|
||||
{
|
||||
return Artwork::query()
|
||||
$query = Artwork::query()
|
||||
->with(['user.profile', 'group', 'primaryAuthor.profile'])
|
||||
->where('group_id', $group->id)
|
||||
->whereNull('deleted_at')
|
||||
->where('is_public', true)
|
||||
->where('is_approved', true)
|
||||
->whereNotNull('published_at')
|
||||
->latest('published_at')
|
||||
->latest('published_at');
|
||||
|
||||
$this->maturity->applyViewerFilter($query, request()->user());
|
||||
|
||||
return $query
|
||||
->limit($limit)
|
||||
->get()
|
||||
->map(fn (Artwork $artwork): array => $this->mapPublicArtworkCard($artwork))
|
||||
@@ -493,7 +501,7 @@ class GroupService
|
||||
|
||||
private function mapPublicArtworkCard(Artwork $artwork): array
|
||||
{
|
||||
return [
|
||||
return $this->maturity->decoratePayload([
|
||||
'id' => (int) $artwork->id,
|
||||
'title' => (string) $artwork->title,
|
||||
'url' => route('art.show', ['id' => $artwork->id, 'slug' => Str::slug((string) ($artwork->slug ?: $artwork->title)) ?: $artwork->id]),
|
||||
@@ -501,7 +509,7 @@ class GroupService
|
||||
'thumb_srcset' => ThumbnailPresenter::srcsetForArtwork($artwork),
|
||||
'author' => $artwork->primaryAuthor?->name ?: $artwork->primaryAuthor?->username ?: $artwork->user?->name ?: $artwork->user?->username ?: 'Artist',
|
||||
'published_at' => $artwork->published_at?->toISOString(),
|
||||
];
|
||||
], $artwork, request()->user());
|
||||
}
|
||||
|
||||
public function studioDashboardSummary(Group $group): array
|
||||
|
||||
Reference in New Issue
Block a user