2017-08-06 09:43:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API\Interaction;
|
|
|
|
|
|
|
|
use App\Http\Requests\API\BatchInteractionRequest;
|
|
|
|
|
2018-12-09 21:24:43 +00:00
|
|
|
/**
|
|
|
|
* @group 3. Song interactions
|
|
|
|
*/
|
2017-08-06 09:43:59 +00:00
|
|
|
class BatchLikeController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
2020-04-12 08:18:17 +00:00
|
|
|
* Like multiple songs
|
2018-12-09 21:24:43 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-04-12 08:18:17 +00:00
|
|
|
* Unlike multiple songs
|
2018-12-09 21:24:43 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
}
|
|
|
|
}
|