Set default since timestamp to 0
This commit is contained in:
parent
4c4803f117
commit
0d6492e99d
@ -53,7 +53,7 @@ class EpisodeActionController extends Controller {
|
||||
* @param int $since
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function list(int $since): JSONResponse {
|
||||
public function list(int $since = 0): JSONResponse {
|
||||
$episodeActions = $this->episodeActionRepository->findAll($since, $this->userId);
|
||||
$untypedEpisodeActionData = [];
|
||||
|
||||
|
@ -54,8 +54,8 @@ class SubscriptionChangeController extends Controller {
|
||||
* @param int|null $since
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function list(int $since = null): JSONResponse {
|
||||
$sinceDatetime = $this->createDateTimeFromTimestamp($since);
|
||||
public function list(int $since = 0): JSONResponse {
|
||||
$sinceDatetime = (new DateTime)->setTimestamp($since);
|
||||
return new JSONResponse([
|
||||
"add" => $this->extractUrlList($this->subscriptionChangeRepository->findAllSubscribed($sinceDatetime, $this->userId)),
|
||||
"remove" => $this->extractUrlList($this->subscriptionChangeRepository->findAllUnSubscribed($sinceDatetime, $this->userId)),
|
||||
@ -63,16 +63,6 @@ class SubscriptionChangeController extends Controller {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $since
|
||||
* @return DateTime
|
||||
*/
|
||||
private function createDateTimeFromTimestamp(?int $since): DateTime {
|
||||
return ($since !== null)
|
||||
? (new DateTime)->setTimestamp($since)
|
||||
: (new DateTime('-1 week'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $allSubscribed
|
||||
* @return mixed
|
||||
|
Loading…
Reference in New Issue
Block a user