patch to only support play action
This commit is contained in:
parent
b59e65bf46
commit
496b5dfac0
@ -41,6 +41,7 @@ class EpisodeActionController extends Controller {
|
||||
public function create(): JSONResponse {
|
||||
|
||||
$episodeActionsArray = $this->filterEpisodesFromRequestParams($this->request->getParams());
|
||||
$episodeActionsArray = $this->filterOnlyPlays($episodeActionsArray);
|
||||
$this->episodeActionSaver->saveEpisodeActions($episodeActionsArray, $this->userId);
|
||||
|
||||
return new JSONResponse(["timestamp" => time()]);
|
||||
@ -74,4 +75,12 @@ class EpisodeActionController extends Controller {
|
||||
public function filterEpisodesFromRequestParams(array $data): array {
|
||||
return array_filter($data, "is_numeric", ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @return array $episodeActionsArray
|
||||
*/
|
||||
private function filterOnlyPlays(array $data): array {
|
||||
return array_filter($data, fn($ep) => isset($ep['action']) && strtolower($ep['action']) === 'play');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user