Filter Startpage Apps

This commit is contained in:
Kekskurse 2019-07-23 17:48:11 +02:00
parent a41c747bcd
commit d8a212b230
3 changed files with 13 additions and 0 deletions

View file

@ -7,6 +7,7 @@ use App\Exceptions\NoPermissionException;
use App\Exceptions\NotLoggedInException; use App\Exceptions\NotLoggedInException;
use App\Exceptions\ResourceNotFound; use App\Exceptions\ResourceNotFound;
use App\Models\User; use App\Models\User;
use http\Env\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Laravel\Lumen\Routing\Controller as BaseController; use Laravel\Lumen\Routing\Controller as BaseController;
use TaGeSo\APIResponse\Response; use TaGeSo\APIResponse\Response;
@ -50,4 +51,5 @@ class AccountController extends BaseController
return $response->withData(new \App\Http\Resources\API\User($user)); return $response->withData(new \App\Http\Resources\API\User($user));
} }
} }

View file

@ -89,6 +89,7 @@ class AppController extends BaseController
$this->validate($request, [ $this->validate($request, [
'apiKey' => '', 'apiKey' => '',
'startpage' => ''
]); ]);
$query = \App\Models\App::query(); $query = \App\Models\App::query();
@ -97,6 +98,11 @@ class AppController extends BaseController
$query->where("apiKey", "=", $request->input("apiKey")); $query->where("apiKey", "=", $request->input("apiKey"));
} }
if($request->input("webpage", false)) {
$query->where("show_on_webpage", "=", 1);
}
$apps = $query->paginate(20); $apps = $query->paginate(20);
$response->setPagination($apps->currentPage(), $apps->lastPage(), $apps->perPage()); $response->setPagination($apps->currentPage(), $apps->lastPage(), $apps->perPage());

View file

@ -509,6 +509,11 @@ paths:
description: "Search an app based on the API-Key" description: "Search an app based on the API-Key"
required: false required: false
type: string type: string
- in: query
name: webpage
description: "Return Apps shown on the Startpage"
required: false
type: boolean
responses: responses:
200: 200:
description: "List of Apps" description: "List of Apps"