BatchLikeController::store()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace App\Http\Controllers\API\Interaction;
4
5
use App\Http\Requests\API\BatchInteractionRequest;
6
7
/**
8
 * @group 3. Song interactions
9
 */
10
class BatchLikeController extends Controller
11
{
12
    /**
13
     * Like multiple songs.
14
     *
15
     * Like several songs at once, useful for "batch" actions. An array of "interaction" records containing the song
16
     * and user data will be returned.
17
     *
18
     * @bodyParam songs array required An array of song IDs.
19
     * @responseFile responses/interactions.json
20
     */
21 1
    public function store(BatchInteractionRequest $request)
22
    {
23 1
        $interactions = $this->interactionService->batchLike((array) $request->songs, $request->user());
24
25 1
        return response()->json($interactions);
26
    }
27
28
    /**
29
     * Unlike multiple songs.
30
     *
31
     * Unlike several songs at once, useful for "batch" actions. An array of "interaction" records containing the song
32
     * and user data will be returned.
33
     *
34
     * @bodyParam songs array required An array of song IDs.
35
     * @responseFile responses/interactions.json
36
     */
37 1
    public function destroy(BatchInteractionRequest $request)
38
    {
39 1
        $this->interactionService->batchUnlike((array) $request->songs, $request->user());
40
41 1
        return response()->json();
42
    }
43
}
44