2024-01-02 12:07:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Http\Requests\API\UpdateQueueStateRequest;
|
|
|
|
use App\Http\Resources\QueueStateResource;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Services\QueueService;
|
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
|
|
|
|
|
|
class QueueStateController extends Controller
|
|
|
|
{
|
|
|
|
/** @param User $user */
|
2024-04-18 14:36:28 +00:00
|
|
|
public function __construct(private readonly QueueService $queueService, private readonly ?Authenticatable $user)
|
2024-01-02 12:07:37 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public function show()
|
|
|
|
{
|
|
|
|
return QueueStateResource::make($this->queueService->getQueueState($this->user));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function update(UpdateQueueStateRequest $request)
|
|
|
|
{
|
|
|
|
$this->queueService->updateQueueState($this->user, $request->songs);
|
|
|
|
|
|
|
|
return response()->noContent();
|
|
|
|
}
|
|
|
|
}
|