Commit b3a74998 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

refacto data

parent 2b1b11e8
Loading
Loading
Loading
Loading
+2 −2
Changes for front/Mission/OffreEmploi.vue: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
<template>

    <div class="col" v-if="!this.extended">
    <div class="col" v-if="!this.extended && offre.canVisualiser">
        <div class="card h-100">
            <div class="card-header">
                <h4> {{ offre.titre }}</h4>
@@ -44,7 +44,7 @@
            </div>
        </div>
    </div>
    <div v-if="this.extended">
    <div v-if="this.extended && offre.canVisualiser">
        <h1 class="page-header">{{ offre.titre }}</h1>
        <div v-if="!this.utilisateur" class="alert alert-primary d-flex align-items-center" role="alert">
            <i class="fa-solid fa-user"></i>
+3 −2
Changes for module/Mission/config/offre-emploi.config.php: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ return [
            'route'         => '/offre-emploi',
            'controller'    => OffreEmploiController::class,
            'action'        => 'index',
            'privileges'    => Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION,
            //   'privileges'    => Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION,
            'may_terminate' => true,
            'child_routes'  => [
                'saisir'               => [
@@ -32,6 +32,7 @@ return [
                'detail'               => [
                    'route'      => '/detail[/:offreEmploi]',
                    'controller' => OffreEmploiController::class,
                    'privileges' => Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION,
                    'action'     => 'detail',
                ],
                'get'                  => [
@@ -43,7 +44,6 @@ return [
                    'route'      => '/liste',
                    'controller' => OffreEmploiController::class,
                    'action'     => 'liste',
                    'privileges' => Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION,
                ],
                'supprimer'            => [
                    'route'      => '/supprimer/:offreEmploi',
@@ -125,6 +125,7 @@ return [
        [
            'privileges' => [
                Privileges::MISSION_OFFRE_EMPLOI_MODIFIER,
                Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION,
                Privileges::MISSION_OFFRE_EMPLOI_VALIDER,
                Privileges::MISSION_OFFRE_EMPLOI_POSTULER,
                Privileges::MISSION_CANDIDATURE_VISUALISATION,
+6 −7
Changes for module/Mission/src/Assertion/OffreEmploiAssertion.php: 6 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -56,12 +56,9 @@ class OffreEmploiAssertion extends AbstractAssertion

    protected function assertOffreEmploiVisualisation(Role $role, OffreEmploi $offre)
    {

        if ($offre->isValide()) {
            return true;
        }

        return true;
        return $this->asserts(
            $this->assertStructure($role, $offre->getStructure()),
        );
    }


@@ -165,7 +162,9 @@ class OffreEmploiAssertion extends AbstractAssertion
            return true;
        }

        return $role->getStructure() === $structure;
        $test = ($role->getStructure() == $structure);

        return $role->getStructure() == $structure;
    }


+3 −48
Changes for module/Mission/src/Controller/OffreEmploiController.php: 3 added lines, 48 removed lines.
Original line number Diff line number Diff line
@@ -86,36 +86,9 @@ class OffreEmploiController extends AbstractController
     */
    public function listeAction()
    {
        $parameters = [];
        $role = $this->getServiceContext()->getSelectedIdentityRole();

        /**
         * @var Query $query
         */
        $query = $this->getServiceOffreEmploi()->query([], $role);


        $properties = [
            'id',
            ['typeMission', ['libelle']],
            'dateDebut',
            'dateFin',
            ['structure', ['libelleLong', 'libelleCourt', 'code', 'id']],
            'titre',
            'description',
            'nombreHeures',
            'nombrePostes',
            'histoCreation',
            'histoCreateur',
            'validation',
            'candidats',
            'candidaturesValides',
            'valide',
            ['candidatures', ['id', ['intervenant', ['id', 'nomUsuel', 'prenom', 'emailPro', 'code', ['structure', ['libelleLong', 'libelleCourt', 'code', 'id']], ['statut', ['libelle', 'code']]]], 'histoCreation', 'validation']],
        ];


        return new AxiosModel($query, $properties, $this->getServiceOffreEmploi()->getOffreEmploiPrivileges());
        return $this->getServiceOffreEmploi()->data([], $role);
    }


@@ -249,26 +222,8 @@ class OffreEmploiController extends AbstractController

        $this->em()->clear();

        $properties = [
            'id',
            ['typeMission', ['libelle']],
            'dateDebut',
            'dateFin',
            ['structure', ['libelleLong', 'libelleCourt', 'code', 'id']],
            'titre',
            'description',
            'nombreHeures',
            'nombrePostes',
            'histoCreation',
            'histoCreateur',
            'validation',
            'candidats',
            'candidaturesValides',
            ['candidatures', ['id', ['intervenant', ['id', 'nomUsuel', 'prenom', 'emailPro', 'code', ['structure', ['libelleLong', 'libelleCourt', 'code', 'id']], ['statut', ['libelle', 'code']]]], 'histoCreation', 'validation']],
        ];

        $query = $this->getServiceOffreEmploi()->query(['offreEmploi' => $offreEmploi]);
        $model = new AxiosModel($query, $properties, $this->getServiceOffreEmploi()->getOffreEmploiPrivileges());
        $role  = $this->getServiceContext()->getSelectedIdentityRole();
        $model = $this->getServiceOffreEmploi()->data(['offreEmploi' => $offreEmploi], $role);
        $model->returnFirstItem();

        return $model;
+28 −7
Changes for module/Mission/src/Service/OffreEmploiService.php: 28 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Application\Service\AbstractEntityService;
use Application\Service\Traits\SourceServiceAwareTrait;
use Mission\Entity\Db\Candidature;
use Mission\Entity\Db\OffreEmploi;
use UnicaenVue\View\Model\AxiosModel;

/**
 * Description of OffreEmploiService
@@ -49,7 +50,7 @@ class OffreEmploiService extends AbstractEntityService



    public function query(array $parameters, ?Role $role = null)
    public function data(array $parameters, ?Role $role = null)
    {


@@ -78,7 +79,31 @@ class OffreEmploiService extends AbstractEntityService
          oe . dateDebut
        ";

        return $this->getEntityManager()->createQuery($dql)->setParameters($parameters);
        $query = $this->getEntityManager()->createQuery($dql)->setParameters($parameters);

        $triggers = $this->getOffreEmploiPrivileges();

        $properties = [
            'id',
            ['typeMission', ['libelle']],
            'dateDebut',
            'dateFin',
            ['structure', ['libelleLong', 'libelleCourt', 'code', 'id']],
            'titre',
            'description',
            'nombreHeures',
            'nombrePostes',
            'histoCreation',
            'histoCreateur',
            'validation',
            'candidats',
            'candidaturesValides',
            'valide',
            ['candidatures', ['id', ['intervenant', ['id', 'nomUsuel', 'prenom', 'emailPro', 'code', ['structure', ['libelleLong', 'libelleCourt', 'code', 'id']], ['statut', ['libelle', 'code']]]], 'histoCreation', 'validation']],
        ];


        return new AxiosModel($query, $properties, $triggers);
    }


@@ -103,17 +128,13 @@ class OffreEmploiService extends AbstractEntityService

        return [
            '/' => function (OffreEmploi $offre, array $extracted) {

                $extracted['canModifier']   = $this->getAuthorize()->isAllowed($offre, Privileges::MISSION_OFFRE_EMPLOI_MODIFIER);
                $extracted['canValider']    = $this->getAuthorize()->isAllowed($offre, Privileges::MISSION_OFFRE_EMPLOI_VALIDER);
                $extracted['canPostuler']   = $this->getAuthorize()->isAllowed($offre, Privileges::MISSION_OFFRE_EMPLOI_POSTULER);
                $extracted['canVisualiser'] = $this->getAuthorize()->isAllowed($offre, Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION);
                $extracted['canSupprimer']  = $this->getAuthorize()->isAllowed($offre, Privileges::MISSION_OFFRE_EMPLOI_SUPPRESSION);


                /*$extracted['canValider']   = $this->isAllowed($original, Privileges::MISSION_VALIDATION);
                $extracted['canDevalider'] = $this->isAllowed($original, Privileges::MISSION_DEVALIDATION);
                $extracted['canSupprimer'] = $this->isAllowed($original, Privileges::MISSION_EDITION);*/

                return $extracted;
            },