Commit ffc10033 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

WIP API

parent c734da69
Loading
Loading
Loading
Loading
+1 −0
Changes for docker-compose.yml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ services:
     - ./docker/apache/api.conf:/etc/apache2/conf-available/api.conf
     - ./docker/entrypoint.d/008_api:/entrypoint.d/008_api
     - ../sygal-pegase-connect/vendor/unicaen/sygal-api:/sygal-api
     - ./tmp/sygal.inscription_resource_logger.log:/var/log/sygal.inscription_resource_logger.log
    working_dir: /app
    networks:
      - sygalnet
+41 −0
Changes for module/SygalApiImpl/bin/_call-common.php: 41 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env php

<?php
$port = $_SERVER['PORT'] ?? null;
$version = $_SERVER['VERSION'] ?? 'v1';
$n = $_SERVER['N'] ?? 1;

if ($port === null) {
    echo "Le port doit être spécifié dans la variable d'env 'PORT'." . PHP_EOL;
    exit(1);
}

echo "PORT = $port" . PHP_EOL;
echo "VERSION = $version" . PHP_EOL;
echo "N = $n" . PHP_EOL;

$args = implode(' ', array_slice($_SERVER['argv'], 1));

$json = trim(file_get_contents(__DIR__ . '/data.json'));

$cmd = <<<EOT
curl $args \
--no-progress-meter \
--insecure \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Basic c3lnYWwtYXBwOmF6ZXJ0eQ==" \
-X POST \
-d '$json' \
https://localhost:$port/$version/inscription
EOT;

//echo $cmd . PHP_EOL;

if ($n > 1) {
    for ($i=1; $i<=$n; ++$i) {
        exec($cmd);
    }
} else {
    passthru($cmd);
}
 No newline at end of file
+5 −31
Changes for module/SygalApiImpl/bin/call-sygal-api-inscription: 5 added lines, 31 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env php
<?php
/**
 * Appel direct de l'API SyGAL (sans passer par "sygal-pegase-connect").
 */
$_SERVER['PORT'] = 8003;

$port = 8003;

$version = $_SERVER['VERSION'] ?? 'v1';
$n = $_SERVER['N'] ?? 1;

$args = implode(' ', array_slice($_SERVER['argv'], 1));

$data = include 'data.php';
$json = json_encode($data);

$cmd = <<<EOT
curl $args \
--no-progress-meter \
--insecure \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Basic c3lnYWwtYXBwOmF6ZXJ0eQ==" \
-X POST \
-d '$json' \
https://localhost:$port/$version/inscription
EOT;

echo $cmd . PHP_EOL;

if ($n > 1) {
    for ($i=1; $i<=$n; ++$i) {
        exec($cmd);
    }
} else {
    passthru($cmd);
}
 No newline at end of file
include '_call-common.php';
+5 −31
Changes for module/SygalApiImpl/bin/call-sygal-pegase-connect-api-inscription: 5 added lines, 31 removed lines.
Original line number Diff line number Diff line
#!/usr/bin/env php
<?php
/**
 * Appel de l'API "sygal-pegase-connect".
 */
$_SERVER['PORT'] = 8443;

$port = 8443;

$version = $_SERVER['VERSION'] ?? 'v1';
$n = $_SERVER['N'] ?? 1;

$args = implode(' ', array_slice($_SERVER['argv'], 1));

$data = include 'data.php';
$json = json_encode($data);

$cmd = <<<EOT
curl $args \
--no-progress-meter \
--insecure \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Basic c3lnYWwtYXBwOmF6ZXJ0eQ==" \
-X POST \
-d '$json' \
https://localhost:$port/$version/inscription
EOT;

echo $cmd . PHP_EOL;

if ($n > 1) {
    for ($i=1; $i<=$n; ++$i) {
        exec($cmd);
    }
} else {
    passthru($cmd);
}
include '_call-common.php';
+180 −0
Changes for module/SygalApiImpl/bin/data.json: 180 added lines, 0 removed lines.
Original line number Diff line number Diff line
{
  "descSchema": {
    "idSchemaDonnees": "string",
    "version": "string"
  },
  "routage": {
    "codeInstancePegase": "string"
  },
  "structure": {
    "codeUAI": "string"
  },
  "periode": {
    "codePeriode": "string"
  },
  "apprenant": {
    "code_apprenant": "string",
    "etatCivil": {
      "nomDeNaissance": "string",
      "nomUsuel": "string",
      "prenom": "string",
      "deuxiemePrenom": "string",
      "troisiemePrenom": "string",
      "genre": "string"
    },
    "naissance": {
      "dateDeNaissance": "string",
      "paysDeNaissance": "100",
      "libellePaysDeNaissance": "France",
      "communeDeNaissance": "67482",
      "libelleCommuneDeNaissance": "Strasbourg",
      "communeDeNaissanceEtranger": "string",
      "nationalite": "string",
      "libelleNationalite": "string",
      "deuxiemeNationalite": "string",
      "libelleDeuxiemeNationalite": "string",
      "dateDObtentionDeLaDeuxiemeNationalite": "string"
    },
    "situationPersonnelle": {
      "situationFamiliale": "string",
      "enfants": 0,
      "situationMilitaire": "string"
    },
    "profession": {
      "etudiant": "string",
      "parent1": "string",
      "parent2": "string",
      "quotite": "string"
    },
    "contacts": [
      {
        "canalCommunication": "ContactAdresseComplet",
        "demandeDeContact": {
          "est1": "string",
          "code": "string",
          "codeStructure": "string",
          "libelleAffichage": "string",
          "canalCommunication": "MAIL",
          "temoinSaisie": "OBLIGATOIRE",
          "temoinSaisieProprietaire": "OBLIGATOIRE"
        },
        "proprietaire": "string"
      }
    ],
    "bac": {
      "titreAcces": "string",
      "anneeObtention": "string",
      "serie": "string",
      "libelleSerie": "string",
      "premiereSpecialiteBac": "string",
      "libellePremiereSpecialiteBac": "string",
      "deuxiemeSpecialiteBac": "string",
      "libelleDeuxiemeSpecialiteBac": "string",
      "mention": "string",
      "libelleMention": "string",
      "typeEtablissement": "string",
      "pays": "string",
      "libellePays": "string",
      "departement": "string",
      "libelleDepartement": "string",
      "etablissement": "string",
      "ine": "string",
      "etablissementLibre": "string",
      "detailTitre": "string"
    },
    "premieresInscriptions": {
      "anneeEnseignementSuperieur": "string",
      "anneeUniversite": "string",
      "anneeEtablissement": "string"
    }
  },
  "inscription": {
    "cible": {
      "est1": "string",
      "code": "string",
      "libelleCourt": "string",
      "libelleLong": "string",
      "codeStructure": "ETAB00",
      "formation": {
        "est1": "string",
        "code": "string",
        "libelleCourt": "string",
        "libelleLong": "string"
      },
      "chemin": [
        {
          "est1": "string",
          "code": "string",
          "libelleCourt": "string",
          "libelleLong": "string",
          "nature": "ObjetFormation"
        }
      ]
    },
    "noCandidat": "string",
    "origine": "concours",
    "principale": true,
    "statutInscription": "preinscrit",
    "statutPaiement": "sans_statut",
    "statutPieces": "sans_statut",
    "regimeInscription": {
      "nomenclature": "RegimeInscription",
      "code": "string",
      "libelle": "string",
      "contexteConsommation": "string"
    },
    "boursesEtAides": [
      {
        "nomenclature": "RegimeInscription",
        "code": "string",
        "libelle": "string",
        "contexteConsommation": "string"
      }
    ],
    "situationPersonnelleInscription": {
      "amenagementsSpecifiques": [
        "RSE"
      ],
      "souhaitAmenagement": true,
      "profilsSpecifiques": [
        "string"
      ]
    },
    "cvec": {
      "numero": "string"
    },
    "admission": {
      "voie": "concours",
      "anneeConcours": 0,
      "concours": "string",
      "rangConcours": 0,
      "anneePrecedente": 0,
      "temoinClassePrepa": true,
      "typePrepa": "string",
      "puissancePrepa": "string",
      "typeEtablissementPrecedent": "string",
      "departementEtablissementPrecedent": "string",
      "paysEtablissementPrecedent": "string",
      "etablissementPrecedent": "string",
      "etablissementPrecedentEtranger": "string"
    },
    "situationUniversitaire": {
      "cesure": "SANS",
      "mobilite": "SANS"
    },
    "situationPrecedente": {
      "anneePrecedente": 0,
      "situationPrecedente": {
        "typeNomenclature": "string",
        "code": "string",
        "libelle": "string",
        "prioriteAffichage": 0,
        "codeBcn": "string"
      },
      "anneeObtentionDuDernierDiplome": 0,
      "dernierDiplome": "string"
    },
    "dateInscription": "string",
    "dateDerniereModification": "string"
  }
}
Loading