koel/app/Http/Controllers/API/Interaction/BatchLikeController.php

44 lines
1.2 KiB
PHP
Raw Normal View History

2017-08-06 09:43:59 +00:00
<?php
namespace App\Http\Controllers\API\Interaction;
use App\Http\Requests\API\BatchInteractionRequest;
/**
* @group 3. Song interactions
*/
2017-08-06 09:43:59 +00:00
class BatchLikeController extends Controller
{
/**
* Like multiple songs
*
* Like several songs at once, useful for "batch" actions. An array of "interaction" records containing the song
* and user data will be returned.
*
* @bodyParam songs array required An array of song IDs.
* @responseFile responses/interactions.json
2017-08-06 09:43:59 +00:00
*/
2017-08-06 09:50:52 +00:00
public function store(BatchInteractionRequest $request)
2017-08-06 09:43:59 +00:00
{
2018-08-18 12:27:26 +00:00
$interactions = $this->interactionService->batchLike((array) $request->songs, $request->user());
return response()->json($interactions);
2017-08-06 09:43:59 +00:00
}
/**
* Unlike multiple songs
*
* Unlike several songs at once, useful for "batch" actions. An array of "interaction" records containing the song
* and user data will be returned.
*
* @bodyParam songs array required An array of song IDs.
* @responseFile responses/interactions.json
2017-08-06 09:43:59 +00:00
*/
public function destroy(BatchInteractionRequest $request)
{
2018-08-18 12:27:26 +00:00
$this->interactionService->batchUnlike((array) $request->songs, $request->user());
return response()->json();
2017-08-06 09:43:59 +00:00
}
}