fixed: do not show disabled jobs in list of jobs from the api

This commit is contained in:
Julien Fastré 2022-07-11 16:20:48 +02:00
parent 692c2bdac0
commit c69af351cc
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,25 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Symfony\Component\HttpFoundation\Request;
class UserJobApiController extends ApiController
{
protected function customizeQuery(string $action, Request $request, $query): void
{
if ('_index' === $action) {
$query->andWhere($query->expr()->eq('e.active', "'TRUE'"));
}
}
}

View File

@ -19,6 +19,7 @@ use Chill\MainBundle\Controller\LanguageController;
use Chill\MainBundle\Controller\LocationController;
use Chill\MainBundle\Controller\LocationTypeController;
use Chill\MainBundle\Controller\UserController;
use Chill\MainBundle\Controller\UserJobApiController;
use Chill\MainBundle\Controller\UserJobController;
use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface;
use Chill\MainBundle\Doctrine\DQL\GetJsonFieldByKey;
@ -501,6 +502,7 @@ class ChillMainExtension extends Extension implements
'name' => 'user_job',
'base_path' => '/api/1.0/main/user-job',
'base_role' => 'ROLE_USER',
'controller' => UserJobApiController::class,
'actions' => [
'_index' => [
'methods' => [