Compare commits

...

258 Commits

Author SHA1 Message Date
VANNEAU c9717c8af8 Début de upgrade version et docker 3 years ago
Yanaël GRETTE c316fe1b1c Correction bug avec les demandes origines pour les demandes de formation EP 3 years ago
Yanaël GRETTE 644d473ce7 Implémentation de la récupération des demandes de formation avec un EP 3 years ago
Yanaël GRETTE b1d3ebdaeb Ajout d'un endpoint pour la récupération des typesentretiens 3 years ago
Yanaël GRETTE fb8fff4a92 Ajout de la récupération d'un EP dans le controleur ep 3 years ago
Yanaël GRETTE d15c4a3a3b Corrections de bugs pour la gestion des clés étrangères 3 years ago
Yanaël GRETTE 2a8d199020 Mise à jour des tests EP en cours 3 years ago
jboinembalome 559cec8611 Résolution des conflits 3 years ago
Yanaël GRETTE fedbd4b901 Merge branch 'ep-details' into develop 3 years ago
Yanaël GRETTE 73e9a0315c Implémentatin de la récupération de la demande d'EPI 3 years ago
Yanaël GRETTE c54d9fc48b Implémentation de la récupération des objectifs et objectifs précédents 3 years ago
Yanaël GRETTE b59e2d9617 Implémentation de la récupération des choix de type d'entretien 3 years ago
Yanaël GRETTE 6197d6d0a6 Récupération du nom et du prénom de l'assistant qui a écrit la note 3 years ago
Yanaël GRETTE 5af948d0ea Implémantation de la récupération du choix du rdventretien et des propositions 3 years ago
jboinembalome 3fd54f315d Petite correction du jeu de données pour les demandes de formation 3 years ago
jboinembalome b0bc3d9d5f Mise à jour des tests unitaires en fonction du paramètres statutsEp 3 years ago
jboinembalome 301c6e456a Ajout du paramètre statutsEp dans GetDemandesFormations et GetDemandesFormationCount 3 years ago
jboinembalome b48c53aa28 Ajout des tests unitaires pour l'api DemandeFormationApi 3 years ago
jboinembalome dbd3888e27 Intégration du service DemandeFormationService dans DemandeFormationApi 3 years ago
jboinembalome bc43b2f2ff Mise à jour des tests unitaires en fonction du filtre sur les statuts de l'EP 3 years ago
jboinembalome 15e9a57e0b Ajout d'une méthode pour récupérer les demandes de formations rattachées à un Ep en cours ou créé 3 years ago
jboinembalome 308e6b6001 Ajout des tests unitaires pour le service DemandeFormationService 3 years ago
jboinembalome 3bfc264c12 Ajout du service DemandeFormationService 3 years ago
jboinembalome 72eb5ce675 DemandeFormationDTO: Remplacement de la propriété FormationDTO par FormationDetailsDTO 3 years ago
jboinembalome d7f93b4913 EpContext: Ajout d'une propriété masqué IdDemandeFormation pour la clé étrangère entre ParticipationFormation et DemandeFormation + Configuration de la relation entre DemandeFormation et OrigineDemande 3 years ago
jboinembalome 0f8e905098 OrigineDemande: Suppression de la propriété DemandeFormations 3 years ago
jboinembalome 80003b0c66 DemandeFormation: Remplacement de la propriété OrigineFormation par OrigineDemande 3 years ago
jboinembalome ce44d25807 Mise à jour du jeu de données pour la partie demande de formation 3 years ago
jboinembalome 0b63a775ff Ajout des méthodes de transformation DTO pour la partie demande de formation 3 years ago
jboinembalome b6dfd23cee Ajout d'une méthode pour récupérer des collaborateurs en fonction d'une demande de formation 3 years ago
Yanaël GRETTE 72153decaf Implémentation de la récupération d'une demande de délégation avec un EP 3 years ago
Yanaël GRETTE 2fbd2076cd Implémentation de la récupération des commentaires assistants (sans le nom et le prénom de l'assistant encore) 3 years ago
Yanaël GRETTE b48458e2d0 Implémentation de la récupération des participants à un EP 3 years ago
Yanaël GRETTE daab188c86 Récupération des engagements avec les détails EP 3 years ago
Yanaël GRETTE 8f3aed1f24 Implémentation de la récupération des détails d'un EP 3 years ago
Yanaël GRETTE fdda245aad Implémentation de la possibilité de ne récupérer que les EP obligatoires 3 years ago
Yanaël GRETTE f8ba6c6237 Modification sur les counts, résolution d'un bug sur la mise à jour d'une note et suppression des commentaires des autorisations des certains endpoints 3 years ago
Yanaël GRETTE a9edf6c89f Ajout des fonctions de transformations DTO pour les détails d'un EP 3 years ago
Yanaël GRETTE ee742082fe Ajout du service pour gérer les détails des EP 3 years ago
jboinembalome ed83ee261c Merge branch 'develop' into demande_formation 3 years ago
jboinembalome 838bc44b08 MAJ des tests unitaires: Ajout du service TransformDTO 3 years ago
jboinembalome b64e5c0a23 Remplacement des méthodes de mappage privés par l'injection du service TransformDTO 3 years ago
jboinembalome bdf7e343e7 Ajout des méthodes GetCollaborateurDTOsAsync 3 years ago
jboinembalome 96e7715a49 Injection du service TransformDTO dans le startup 3 years ago
jboinembalome be8cb5551b Création de la classe TransformDTO 3 years ago
jboinembalome 6e3f6287a2 Création de l'interface ITransformDTO 3 years ago
jboinembalome 021be18a03 Suppression du tri et de la pagination pour l'action GetDemandesFormationCount 3 years ago
jboinembalome 04171808f5 Création du service DemandeFormationService (non terminée) 3 years ago
jboinembalome 6633d5db52 Ajout des exceptions pour la partie demande de formation 3 years ago
jboinembalome 6a2e28378f Merge branch 'develop' of https://gitea.ci.apside-top.fr/ygrette/Digitalisation_EPA_Serveur into develop 3 years ago
jboinembalome 4e101f472c MAJ des tests unitaires pour le service et l'api engagement 3 years ago
jboinembalome 87f887be0c Remplacement du filtre par action d'engagement par un filtre par nom et prénom du collaborateur et suppression de la pagination et du tri pour le count 3 years ago
jboinembalome 670cf11891 Suppression du tri et de la pagination pour le count 3 years ago
jboinembalome fa805a1768 Modification des tests unitaires en fonction des données qui ont été modifié dans DataSeeder pour le service formation 3 years ago
jboinembalome 2d38013907 Gestion des objets null pour les mappages de model en dto dans le service formation 3 years ago
jboinembalome 67b9d60371 Mise à jour des logs dans l'api formation 3 years ago
jboinembalome 7de1183ad4 Fin des tests unitaires pour le service et l'api des participations aux formations 3 years ago
jboinembalome cc83dea6d0 Modification des tests unitaires en fonction des données qui ont été modifié dans DataSeeder 3 years ago
jboinembalome 9578543b99 Ajout de la propriété IdChamp dans la méthode AddChamps 3 years ago
jboinembalome 39083c619b Gestion des objets null pour les mappages de model en dto 3 years ago
jboinembalome b43dd25ff1 Renommage de la méthode GetParticipationByCollaborateurAsync 3 years ago
jboinembalome 76db2cb8de Renommage de la propriété EstCertifie 3 years ago
Yanaël GRETTE e46d08ecb0 Merge branch 'ep-affichage' into develop 3 years ago
Yanaël GRETTE 64a9b6a69d Légère modification du jeu de données 3 years ago
Yanaël GRETTE 10a306c888 Prise en compte des EP créé lors de la récupération d'un EP en cours 3 years ago
Yanaël GRETTE 480cefb528 Tests et implémentation de l'API pour la récupération des EP signés référents et collaborateurs et des EP en cours référents et collaborateurs 3 years ago
jboinembalome 9949eee8d2 Merge branch 'participation_formation' into develop 3 years ago
jboinembalome a78370d4d7 MAJ du jeu de données pour les participations aux formations (non terminée 3 years ago
jboinembalome fb89826622 Ajout du service ParticipationFormationService dans le Startup 3 years ago
jboinembalome 3146d7a9c5 Intégration du service ParticipationFormationService dans ParticipationFormationAPI 3 years ago
jboinembalome 6970bd3436 MAJ de la contrainte de clé étrangère entre les participations et les demandes de formation 3 years ago
jboinembalome 09b0483523 MAJ des DTO EvaluationDTO et SaisieDTO 3 years ago
jboinembalome 3bc3bb5d56 Début des tests unitaires pour le service ParticipationFormationService 3 years ago
jboinembalome 1373fea1ba Création du service ParticipationFormationService 3 years ago
jboinembalome fafe2d9d9b Ajout des exceptions pour les participations aux formations 3 years ago
Yanaël GRETTE 87bd06dd80 Merge branch 'develop' of https://gitea.ci.apside-top.fr/ygrette/Digitalisation_EPA_Serveur into develop 3 years ago
Yanaël GRETTE ad15e84d51 tests et implémentation de la récupération de la liste des EP signés d'un collaborateur et du prochain EP collaborateur 3 years ago
Yanaël GRETTE 586702001f Tests et implémentation de la récupération des EP en cours et signés d'un référent 3 years ago
Yanaël GRETTE 76b4a06b9d Mise à jour des méthodes de tri et des jeux de données 3 years ago
Yanaël GRETTE e362dc75df Implémenation de l'API des Ep pour la récupération des EP en cours et des EP signés 3 years ago
Yanaël GRETTE d48884349f Ajout des tests de l'API ep pour la récupération des EP en cours et des EP signés 3 years ago
Yanaël GRETTE 87f978bcf9 Mise à jour des tests du service EpInformation avec validation des tests 3 years ago
Yanaël GRETTE f70eb4bc3a Ajout d'une jeu de données 3 years ago
Yanaël GRETTE caec1c0390 Implémentatino du code pour récupérer les EP en cours et les EP signes 3 years ago
Yanaël GRETTE 213c6c851a Ajouts des tests unitaires pour la récupération des EP en cours et des EP signés 3 years ago
Yanaël GRETTE 9a0071a556 Mise à jour du nom de l'interface du service des affichages ep 3 years ago
Yanaël GRETTE 25bd7a4a69 Création du service EpInformationService sans implémentation 3 years ago
Yanaël GRETTE b70b255f2b Optimisation du code du service des demandes de délégation 3 years ago
Yanaël GRETTE db66711b77 Optimisation du code du service des notes et mise à jour et validation des tests unitaires 3 years ago
jboinembalome 8a4365547d Merge branch 'formation' into develop 3 years ago
jboinembalome 647ac6537f Ajout des tests unitaires pour le tri du nombre de participant à une formation 3 years ago
jboinembalome 5e3c971282 Ajout du tri pour le nombre de participant à une formation 3 years ago
Yanaël GRETTE f13fcc25b7 Mise à jour du jeu de données et utilisation du service collaborateur du serveur à la place du service collaborateur distant dans le service demande délégation 3 years ago
Yanaël GRETTE 95ed1e83ac Ajout de la récupération du référent de l'EP lié à la demande de délégation 3 years ago
Yanaël GRETTE 8a88b0de2b changement du nom de la table et ajout de l'injection de dépende du service demande de délégation dans le fichier startup 3 years ago
Yanaël GRETTE 59af0e29c8 Implémentation de l'API des demandes de délégations avec validation des tests 3 years ago
Yanaël GRETTE 8f964f255f Ajout des tests de l'API des demandes de délégation 3 years ago
Yanaël GRETTE d6e34b2369 Implémentation de la mise à jour d'une demande de délégation et validation des tests 3 years ago
Yanaël GRETTE f924d3e40f Implémentation de la récupération des demandes d'engagements d'un référent et validation des tests 3 years ago
Yanaël GRETTE e0b433ebca Ajout du jeu de données pour les demandes de délégation 3 years ago
Yanaël GRETTE 2ba2de0df3 merge conflicts 3 years ago
Yanaël GRETTE 7b571f75cb Création des tests unitaires pour l'implémentation du service demande délégation 3 years ago
Yanaël GRETTE 2f3440b27f Création des tests unitaires pour l'implémentation du service demande délégation 3 years ago
Yanaël GRETTE b96dedada8 Ajout des exceptions qui peuvent se présenter dans le service des Demandes de délégation 3 years ago
Yanaël GRETTE b1c494d811 mise à jour du context et du modèle pour les demandedelegation 3 years ago
Yanaël GRETTE f37ccf27e5 début de l'implémentation du service demandedelegation en y ajoutant les services proposés (non implementé) 3 years ago
Yanaël GRETTE 6336fa1340 Implémentation du fonctionnement du tri des notes 3 years ago
Yanaël GRETTE fffa45ef5f modification de l'id d'un referent dans les tests referentEP 3 years ago
jboinembalome 65afda1ab6 Suppression du Skip And Take pour la méthode Count 3 years ago
Yanaël GRETTE ea59807f4c Merge branch 'develop' of https://gitea.ci.apside-top.fr/ygrette/Digitalisation_EPA_Serveur into develop 3 years ago
Yanaël GRETTE abfab24cf5 Utilisation de la valeur par défaut max lors de la récupération des collaborateurs EP d'un référent pour le nombre d'élément à récupérer 3 years ago
jboinembalome ac7571dbfa Merge branch 'formation' into develop 3 years ago
jboinembalome f056c41133 Ajout des droits RH dans l'API formation 3 years ago
jboinembalome 3190add127 Merge branch 'engagement' into develop 3 years ago
jboinembalome 70808c2966 Création d'un attribut pour valider une collection qui est passée en 3 years ago
jboinembalome 74ca7f067b Création des tests unitaires pour la partie Engagement 3 years ago
jboinembalome a1ca683027 Mise à jour des méthodes du service 3 years ago
jboinembalome 170b806e40 Mise à jour des endpoints + Ajout des droits 3 years ago
jboinembalome 92a68a26cc Mise à jour des signatures de l'interface 3 years ago
jboinembalome 0fdb651fdd Configuration du package Microsoft.AspNetCore.Mvc.NewtonsoftJson 3 years ago
jboinembalome bcc0ddb5d9 Mise à jour du jeu de données fictif pour la partie Engagement 3 years ago
Yanaël GRETTE b41dbc443e Correction d'un bug qui faisait empêchait d'enregistrer le nouveau référentEP d'un collaborateur qui a déjà un référentEP 3 years ago
jboinembalome 6aae6cc0a4 MAJ de la description d'AttenteEntretien 3 years ago
jboinembalome d75ee2b391 Merge branch 'formation' into develop 3 years ago
jboinembalome e8d4bb2961 Tests effectués pour la partie ParticipationFormation 3 years ago
jboinembalome 28c4a95eb5 Merge branch 'develop' into formation 3 years ago
jboinembalome 71e8c9b538 Récupération des collaborateurs et des Ep pour les participations aux formations 3 years ago
jboinembalome 5e3870ec6e Ajout du service Collaborateur 3 years ago
jboinembalome 6747f231fe Nettoyage du code + Décommenter l'attribut Authorize 3 years ago
jboinembalome 17d7fc7778 Ajout des id dans la méthode AddFormation 3 years ago
Yanaël GRETTE 2c442d99d7 Ajout des tests pour la récupération des collaborateurs par Guid, de la récupération des collaborateurs par référent et du count 3 years ago
jboinembalome 1c56a12d0d Merge branch 'develop' into formation 3 years ago
jboinembalome 7b7546bc19 Ajout de la liste des participations sans les collaborateurs ni les EP 3 years ago
jboinembalome 695562391a Renommage de la propriété EstCertifie 3 years ago
jboinembalome d08a86bb9b Remplacement du DTO FormationDTO par FormationDetailsDTO 3 years ago
jboinembalome 29970bc54f Ajout de la liste des participations dans le model Formation 3 years ago
Yanaël GRETTE 442a799e76 Ajout d'une méthode pour récupérer une liste de collaborateurs DTO en fonction des guid passés en paramètre 3 years ago
Yanaël GRETTE a783047bb5 Mise à jour des guid utilisés par rapport aux guid des données du serveur collaborateur créé 3 years ago
Yanaël GRETTE ee2a5e422d Ajout des tests pour mettre à jour une liste de collaborateur pour un référent 3 years ago
Yanaël GRETTE 2523a0d9f7 Ajout des tests pour les méthodes de tri et implémentation du triattribut 3 years ago
jboinembalome ff98567d1e MAJ des tests unitaires 3 years ago
jboinembalome cf0c099bcd Ajout du jeu de données fictif pour les participations aux formations 3 years ago
Yanaël GRETTE 297af95517 Ajout des tests GetCollaborateurs par rôles unique et du count 4 years ago
Yanaël GRETTE c02b2b4126 Ajout des tests pour la récupération d'un collaborateur unique par son id ou son mail 4 years ago
Yanaël GRETTE 166bb4ac38 Modification des URLS pour récupérer les mails dans le code du serveur collaborateur 4 years ago
jboinembalome 5b8e5b043a Ajout du package Moq pour les tests unitaires 4 years ago
jboinembalome a8e8b85b0a MAJ du service formation 4 years ago
jboinembalome 8f4fb19e81 MAJ des paramètres nullable dans les signatures 4 years ago
jboinembalome bccb8846e6 MAJ des Try/catch afin de renvoyer un StatusCode composé d'un objet ErreurDTO 4 years ago
jboinembalome 23f8b69940 Ajout des TU pour l'api formation 4 years ago
jboinembalome db7eff40a8 MAJ du jeu de données pour la partie formation 4 years ago
jboinembalome bb67f315cd MAJ des TU suite aux modifications des exceptions dans le service formation 4 years ago
jboinembalome e97d88ccee MAJ de la description 4 years ago
Yanaël GRETTE ae2a8a4200 Ajout d'un de l'API ReferentEP pour la methode d'update d'un referent pour un collaborateur 4 years ago
Yanaël GRETTE 58376f8e96 Ajout des test unitaires pour la mise à jour du référent d'un collaborateur 4 years ago
Yanaël GRETTE 7da1e7f35e Ajout des tests pour l'API notes (sans tester la récupération des notes d'un auteur) 4 years ago
Yanaël GRETTE f2b9db54e8 Ajout des tests unitaires pour le UpdateNote et le SupprimerNote de NoteService 4 years ago
Yanaël GRETTE bcdd8faa83 Ajout des tests unitaires sur le GetNotById de NoteService 4 years ago
Yanaël GRETTE 67c115f0aa Ajout des tests unitaires pour ajouter des notes avec NoteService 4 years ago
Yanaël GRETTE d3aaf48312 Suppression des méthodes synchrones inutilisées pour la partie Note 4 years ago
Yanaël GRETTE 5392c3f50f Suppression des méthodes synchrones non utilisées pour la partie ReferentEP 4 years ago
Yanaël GRETTE 3aaa8e8ddb Suppression des méthodes synchrones non utilisées pour la partie collaborateur 4 years ago
Yanaël GRETTE 316a978e57 Merge branch 'formation' into develop 4 years ago
Yanaël GRETTE 12c55c7f95 Mise à jour de l'implémentation de la mise à jour d'une note 4 years ago
Yanaël GRETTE 7bbc7e2d4b Mise à jour de la récupération des notes en fonction de l'id de l'auteur 4 years ago
Yanaël GRETTE 8360570eea Mise à jour de la récupération d'une note par son id et passages des appels précédents en async 4 years ago
jboinembalome 8a92c3e58c Renommage de la propriété EstCertifiee dans FormationServiceTests 4 years ago
jboinembalome b72e5acaa3 Suppression du code du TU pour l'api formation 4 years ago
jboinembalome cfe019be07 Ajout de l'id agence pour les formations dans la classe DataSeeder 4 years ago
Yanaël GRETTE bf9058f516 Mise à jour de la suppresion d'une note 4 years ago
Yanaël GRETTE 39519bfc34 Mise à jour de l'ajout d'une note 4 years ago
Yanaël GRETTE 194e67135c Mise à jour de l'API collaborateur du serveur EP (partiellement testé) 4 years ago
Yanaël GRETTE ef948a59d8 Implémantation de l'API RéférentEP avec le code pour mettre à jour le référent EP de plusieurs collaborateurs ensemble non testé 4 years ago
Yanaël GRETTE ddd1d6d9b1 Résolution d'un problème dans le cas de la récupération de données non existantes 4 years ago
Yanaël GRETTE d2e57ab001 Ajout d'exceptions pour gérer les erreurs pour referentEP et mise à jour des constructeurs et commentaires de d'autres Exceptions 4 years ago
Yanaël GRETTE c0985a63b8 Résolution d'un conflit 4 years ago
Yanaël GRETTE 97b67e6530 Mise à jour des services avec suppresion de l'utilisation du service référent 4 years ago
Yanaël GRETTE 67bc0d5f20 Mise à jour des API sans code 4 years ago
Yanaël GRETTE fdbf2502b0 Mise à jour des DTO sans mettre à jour les services et controlleurs 4 years ago
jboinembalome 44a8edf119 Suppression de l'id agence dans l'api engagement 4 years ago
jboinembalome 2c81fe440e Ajout des clés primaires manquantes dans EpContext 4 years ago
jboinembalome 811d2aabd5 MAJ du service Engagement en fonction du modèle à jour 4 years ago
jboinembalome a6d33450de Ajout d'une description pour les propriétés qui sont des clés étrangères 4 years ago
jboinembalome 3aac3ed70a MAJ du modèle pour la partie Note 4 years ago
jboinembalome bb420fd978 MAJ du jeu de données dans la classe DataSeeder 4 years ago
jboinembalome 6438227068 MAJ du modèle pour la partie Formation 4 years ago
jboinembalome c10dfd5069 MAJ du modèle pour la partie SaisieChamp 4 years ago
jboinembalome 49ec9b8387 Suppression de la propiété Autorisation 4 years ago
jboinembalome 3ff19b51b7 MAJ du modèle pour la partie EP 4 years ago
jboinembalome eb61b11b23 Création du dossier Enum 4 years ago
Yanaël GRETTE c13baf22c6 Mise à jour du serveur collaborateur 4 years ago
jboinembalome 61f0effc51 Merge branch 'move_folder' into develop 4 years ago
jboinembalome efbfd193d7 Creation de la classe FormationApiTests 4 years ago
jboinembalome 71b2de4176 MAJ des exceptions 4 years ago
jboinembalome 03dd6302b2 MAJ des commentaires 4 years ago
jboinembalome 8f57dfcf12 Ajout de l'attribut TestFixture 4 years ago
jboinembalome a0feaefec0 Ajout du package coverlet.collector 4 years ago
jboinembalome c6ccba8bab Ajout du rapport de la couverture de code 4 years ago
jboinembalome b8072d67fa Ajout des régions Variables et Setup 4 years ago
jboinembalome b2bea37630 MAJ du service formation 4 years ago
jboinembalome b81852a4cb Renommage des membres 4 years ago
jboinembalome 04aac98989 Ajout d'une exception supplémentaire 4 years ago
jboinembalome cc984a6771 Classe contenant les jeux de données 4 years ago
jboinembalome 56c878e0f8 FormationService tests unitaires terminés 4 years ago
jboinembalome 02f9f66f35 Ajout d'une policy pour le détail d'un collaborateur 4 years ago
jboinembalome 568df4befd Ajout de l'optionBuilder pour l'epContext + utilisation de la classe DataSeeder 4 years ago
jboinembalome a07e54c6bc Commencement des TU pour le service formation 4 years ago
jboinembalome 1f43723b07 Création d'une classe pour l'ajout des données 4 years ago
jboinembalome 13bc6e6619 Ajout de la chaine de connexion SQL 4 years ago
jboinembalome 340c856b7d Création de la classe FormationServiceTests 4 years ago
jboinembalome 25051d03d0 Création du projet de tests 4 years ago
jboinembalome d19d74746c Résolution des conflits 4 years ago
jboinembalome b809486cd3 Gestion des autorisations avec JwtBearer 4 years ago
jboinembalome ebc246b31d Ajout de la pagination 4 years ago
Yanaël GRETTE d7a9e83a8e Merge branch 'develop' of https://gitea.ci.apside-top.fr/ygrette/Digitalisation_EPA_Serveur into develop 4 years ago
Yanaël GRETTE 7c889ca1c7 Ajout de la gestion du Cors Origin 4 years ago
jboinembalome 051b2fb731 Modification des exceptions 4 years ago
jboinembalome f97cce68b4 Modification de la méthode GET GetCollaborateursByReferent en async 4 years ago
jboinembalome 79828d46b1 Ajout des logs dans l'api engagement 4 years ago
jboinembalome c6d69a0d20 Ajout des tâches asynchrones dans le service engagement 4 years ago
jboinembalome 925e8268af Merge branch 'develop' into engagement 4 years ago
jboinembalome 9ed1697bf2 Ajout des logs dans l'api referent 4 years ago
jboinembalome 83c5a51137 Merge branch 'develop' into referent 4 years ago
jboinembalome 3ec0c7fdf4 Ajout des logs dans l'api formation 4 years ago
jboinembalome c6518a5f3a Merge branch 'formation' into develop 4 years ago
jboinembalome 13c4fb74fd Ajout des méthodes asynchrones et modification du DTO FormationDetailsDTO 4 years ago
jboinembalome 2f716d22dd Ajout des méthodes asynchrones 4 years ago
jboinembalome 7cdf09e341 merge branch 'develop' into engagement 4 years ago
jboinembalome 7ecb14ec59 Ajout des méthodes asynchrones dans le service collaborateurs, modification de l'api collaborateur en asynchrone, modification de epinformationDTO 4 years ago
jboinembalome 6b3e8ec32a Ajout d'un test async dans le service engagement et de l'api engagement 4 years ago
jboinembalome cd6439a643 Ajout du service engagement et de l'api engagement 4 years ago
Yanaël GRETTE 2f3e202450 Ajout des loggers, et try catch pour la partie collaborateurs 4 years ago
Yanaël GRETTE f9205b0a5e Ajouts d'exceptions et de try catch avec plusieurs loggers 4 years ago
Yanaël GRETTE 79df883367 Début d'ajout de logger pour les notes 4 years ago
Yanaël GRETTE 64b4394994 Ajout de commentaire pour le service des notes 4 years ago
Yanaël GRETTE 8768f63fac Ajout des commentaires du service collaborateur 4 years ago
jboinembalome 2144a10458 Modification des commentaires dans le service formation 4 years ago
jboinembalome 7221f86417 Modification des noms de variables dans le service referent et l'api referent 4 years ago
jboinembalome 52977a4520 Modification des noms de variables dans le service formation et l'api formation 4 years ago
jboinembalome 79e8a86071 Merge branch 'develop' into formation 4 years ago
Yanaël GRETTE d673d32cb3 Premiers affichages de log effectués 4 years ago
jboinembalome b0f6787f29 Modification des controles des listes nulles dans l'api formation 4 years ago
jboinembalome 991401d487 Création du service Referent + implémentation des méthodes 4 years ago
Yanaël GRETTE 81c5b3043f Merge et résolution des conflit avec la branche formation 4 years ago
jboinembalome f60c4ddb83 Ajout des try/catch dans la classe FormationService 4 years ago
Yanaël GRETTE 71a84d0e42 Modification de l'API du service collaborateur pour récupérer un référent par son id et le référent d'un collaborateur 4 years ago
jboinembalome 2f0b45406c Implémentation complète du service formation et de l'api formation 4 years ago
Yanaël GRETTE 19600f3950 Merge avec la branche collaborateurs et résolution des conflits 4 years ago
Yanaël GRETTE 4e7c474b0b Merge avec la branche notes et résolution des conflits 4 years ago
Yanaël GRETTE f11c134bc4 Changement de la majorité des id de int à long, changement des decimal et double en float et mise à jour de l'API 4 years ago
jboinembalome cda46536ee Implémentation du service formation et de l'api formation 4 years ago
Yanaël GRETTE a07a78af87 Implémentation de l'ajout, la modification et la suppression d'une note 4 years ago
Yanaël GRETTE 5443b49388 Transformation des List<Collaborateur> en IEnumerable dans le service Collaborateur 4 years ago
Yanaël GRETTE 4e78c28d10 Récupération des notes d'un auteur, par collaborateur et d'une note par id 4 years ago
Yanaël GRETTE f01fa3099f Changement du type des IdAuteur et Collaborateur et implémentation des méthodes NoteToDTO 4 years ago
Yanaël GRETTE e38ef1b7ce Ajout du squelette du service des notes 4 years ago
Yanaël GRETTE 1354101310 Ajout de notes dans la base de données 4 years ago
Yanaël GRETTE 18316d9f8a Implémentation complète du service collaborateur et de l'api collaborateurs 4 years ago
  1. 6
      .gitignore
  2. 864
      ApiCollaborateur/RfrentApi.cs
  3. 824
      Context/EpContext.cs
  4. 228
      Controllers/CollaborateursApi.cs
  5. 125
      Controllers/DemandesDelegationApi.cs
  6. 282
      Controllers/DemandesEPIApi.cs
  7. 249
      Controllers/DemandesFormationApi.cs
  8. 160
      Controllers/EngagementsApi.cs
  9. 444
      Controllers/EpApi.cs
  10. 414
      Controllers/FormationsApi.cs
  11. 247
      Controllers/NotesApi.cs
  12. 175
      Controllers/ParticipationsFormationsApi.cs
  13. 142
      Controllers/ReferentsApi.cs
  14. 148
      DTO/CreationDemandeDelegationDTO.cs
  15. 221
      DTO/FormationDTOParticipantsFormation.cs
  16. 193
      DTO/ReferentDTO.cs
  17. 150
      DTO/ThemeDTO.cs
  18. 4
      Dockerfile
  19. 98
      EPAServeur.Tests/Controllers/DemandeDelegationApiTests.cs
  20. 637
      EPAServeur.Tests/Controllers/DemandeFormationApiTests.cs
  21. 341
      EPAServeur.Tests/Controllers/EngagementsApiTests.cs
  22. 162
      EPAServeur.Tests/Controllers/EpInformationApiTests.cs
  23. 607
      EPAServeur.Tests/Controllers/FormationApiTests.cs
  24. 142
      EPAServeur.Tests/Controllers/NoteApiTests.cs
  25. 439
      EPAServeur.Tests/Controllers/ParticipationFormationApiTests.cs
  26. 98
      EPAServeur.Tests/Controllers/ReferentEPApiTests.cs
  27. 28
      EPAServeur.Tests/EPAServeur.Tests.csproj
  28. 7
      EPAServeur.Tests/Properties/launchSettings.json
  29. 454
      EPAServeur.Tests/Services/CollaborateurServiceTests.cs
  30. 228
      EPAServeur.Tests/Services/DemandeDelegationServiceTests.cs
  31. 1610
      EPAServeur.Tests/Services/DemandeFormationServiceTests.cs
  32. 639
      EPAServeur.Tests/Services/EngagementServiceTests.cs
  33. 296
      EPAServeur.Tests/Services/EpDetailsServiceTests.cs
  34. 603
      EPAServeur.Tests/Services/EpInformationTests.cs
  35. 983
      EPAServeur.Tests/Services/FormationServiceTests.cs
  36. 515
      EPAServeur.Tests/Services/NoteServiceTests.cs
  37. 763
      EPAServeur.Tests/Services/ParticipationFormationServiceTests.cs
  38. 256
      EPAServeur.Tests/Services/ReferentEPTests.cs
  39. 20
      EPAServeur.csproj
  40. 10
      EPAServeur.sln
  41. 0
      EPAServeur/.config/dotnet-tools.json
  42. 4
      EPAServeur/ApiCollaborateur/AdresseApi.cs
  43. 14
      EPAServeur/ApiCollaborateur/AgenceApi.cs
  44. 2
      EPAServeur/ApiCollaborateur/BusinessUnitApi.cs
  45. 1155
      EPAServeur/ApiCollaborateur/CollaborateurApi.cs
  46. 34
      EPAServeur/ApiCollaborateur/PeriodeDessaiApi.cs
  47. 2
      EPAServeur/ApiCollaborateur/ProjetApi.cs
  48. 19
      EPAServeur/Attributes/CannotBeEmptyAttribute.cs
  49. 0
      EPAServeur/Attributes/ValidateModelStateAttribute.cs
  50. 38
      EPAServeur/ClientCollaborateur/ApiClient.cs
  51. 2
      EPAServeur/ClientCollaborateur/ApiException.cs
  52. 2
      EPAServeur/ClientCollaborateur/ApiResponse.cs
  53. 8
      EPAServeur/ClientCollaborateur/Configuration.cs
  54. 2
      EPAServeur/ClientCollaborateur/ExceptionFactory.cs
  55. 2
      EPAServeur/ClientCollaborateur/GlobalConfiguration.cs
  56. 2
      EPAServeur/ClientCollaborateur/IApiAccessor.cs
  57. 2
      EPAServeur/ClientCollaborateur/IReadableConfiguration.cs
  58. 2
      EPAServeur/ClientCollaborateur/SwaggerDateConverter.cs
  59. 2
      EPAServeur/Commun/APIAccess.cs
  60. 4
      EPAServeur/Commun/BDaccess.cs
  61. 0
      EPAServeur/Commun/Function.cs
  62. 2
      EPAServeur/Commun/KeycloakAuthentificator.cs
  63. 2400
      EPAServeur/Context/DataSeeder.cs
  64. 236
      EPAServeur/Context/EpContext.cs
  65. 596
      EPAServeur/Controllers/CollaborateursApi.cs
  66. 223
      EPAServeur/Controllers/DemandesDelegationApi.cs
  67. 440
      EPAServeur/Controllers/DemandesEPIApi.cs
  68. 494
      EPAServeur/Controllers/DemandesFormationApi.cs
  69. 270
      EPAServeur/Controllers/EngagementsApi.cs
  70. 1322
      EPAServeur/Controllers/EpApi.cs
  71. 681
      EPAServeur/Controllers/FormationsApi.cs
  72. 566
      EPAServeur/Controllers/NotesApi.cs
  73. 276
      EPAServeur/Controllers/ParticipationsFormationsApi.cs
  74. 323
      EPAServeur/Controllers/ReferentsEPApi.cs
  75. 40
      EPAServeur/DTO/AffichageNoteDTO.cs
  76. 12
      EPAServeur/DTO/AgenceDTO.cs
  77. 36
      EPAServeur/DTO/AugmentationSalaireDTO.cs
  78. 13
      EPAServeur/DTO/BusinessUnitDTO.cs
  79. 28
      EPAServeur/DTO/ChampDTO.cs
  80. 35
      EPAServeur/DTO/CollaborateurDTO.cs
  81. 103
      EPAServeur/DTO/CommentaireAssistantDTO.cs
  82. 70
      EPAServeur/DTO/DemandeDelegationDTO.cs
  83. 90
      EPAServeur/DTO/DemandeEPIDTO.cs
  84. 96
      EPAServeur/DTO/DemandeFormationDTO.cs
  85. 27
      EPAServeur/DTO/DetailsNoteDTO.cs
  86. 29
      EPAServeur/DTO/DocumentDTO.cs
  87. 91
      EPAServeur/DTO/EngagementDTO.cs
  88. 288
      EPAServeur/DTO/EpDTO.cs
  89. 25
      EPAServeur/DTO/EpInformationDTO.cs
  90. 127
      EPAServeur/DTO/EpSaisieDTO.cs
  91. 12
      EPAServeur/DTO/ErreurDTO.cs
  92. 116
      EPAServeur/DTO/EvaluationDTO.cs
  93. 176
      EPAServeur/DTO/FormationDTO.cs
  94. 96
      EPAServeur/DTO/FormationDetailsDTO.cs
  95. 10
      EPAServeur/DTO/ModeFormationDTO.cs
  96. 12
      EPAServeur/DTO/ObjectifDTO.cs
  97. 36
      EPAServeur/DTO/ObjectifPrecedentDTO.cs
  98. 10
      EPAServeur/DTO/OrigineDemandeFormationDTO.cs
  99. 10
      EPAServeur/DTO/OrigineFormationDTO.cs
  100. 64
      EPAServeur/DTO/ParticipationEPDTO.cs
  101. Some files were not shown because too many files have changed in this diff Show More

6
.gitignore vendored

@ -3,6 +3,12 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# LOGS EPA SERVEUR
/EPAServeurLog
# RAPPORT COUVERTURE DE CODE TESTS UNITAIRES
EPAServeurCoverageReport/
# User-specific files
*.rsuser
*.suo

@ -1,864 +0,0 @@
/*
* Service Collaborateur API
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using RestSharp;
using IO.Swagger.ClientCollaborateur;
using IO.Swagger.ModelCollaborateur;
namespace IO.Swagger.ApiCollaborateur
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IRfrentApi : IApiAccessor
{
#region Synchronous Operations
/// <summary>
/// rechercher les référents
/// </summary>
/// <remarks>
/// rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son identifiant
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <returns>List&lt;Collaborateur&gt;</returns>
List<Collaborateur> ChercherRefCollabId (Guid? collabId);
/// <summary>
/// rechercher les référents
/// </summary>
/// <remarks>
/// rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son identifiant
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <returns>ApiResponse of List&lt;Collaborateur&gt;</returns>
ApiResponse<List<Collaborateur>> ChercherRefCollabIdWithHttpInfo (Guid? collabId);
/// <summary>
/// rechercher les référents
/// </summary>
/// <remarks>
/// rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son mail apside
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <returns>List&lt;Collaborateur&gt;</returns>
List<Collaborateur> ChercherRefCollabMail (string mailApside);
/// <summary>
/// rechercher les référents
/// </summary>
/// <remarks>
/// rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son mail apside
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <returns>ApiResponse of List&lt;Collaborateur&gt;</returns>
ApiResponse<List<Collaborateur>> ChercherRefCollabMailWithHttpInfo (string mailApside);
/// <summary>
/// rechercher le référent qui a le plus suivit
/// </summary>
/// <remarks>
/// rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son identifiant
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Collaborateur</returns>
Collaborateur ChercherRefSuiviParDateCollabId (Guid? collabId, string date);
/// <summary>
/// rechercher le référent qui a le plus suivit
/// </summary>
/// <remarks>
/// rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son identifiant
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>ApiResponse of Collaborateur</returns>
ApiResponse<Collaborateur> ChercherRefSuiviParDateCollabIdWithHttpInfo (Guid? collabId, string date);
/// <summary>
/// rechercher le référent qui a le plus suivit
/// </summary>
/// <remarks>
/// rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son mail apside
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Collaborateur</returns>
Collaborateur ChercherRefSuiviParDateCollabMail (string mailApside, string date);
/// <summary>
/// rechercher le référent qui a le plus suivit
/// </summary>
/// <remarks>
/// rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son mail apside
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>ApiResponse of Collaborateur</returns>
ApiResponse<Collaborateur> ChercherRefSuiviParDateCollabMailWithHttpInfo (string mailApside, string date);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
/// rechercher les référents
/// </summary>
/// <remarks>
/// rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son identifiant
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <returns>Task of List&lt;Collaborateur&gt;</returns>
System.Threading.Tasks.Task<List<Collaborateur>> ChercherRefCollabIdAsync (Guid? collabId);
/// <summary>
/// rechercher les référents
/// </summary>
/// <remarks>
/// rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son identifiant
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <returns>Task of ApiResponse (List&lt;Collaborateur&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<Collaborateur>>> ChercherRefCollabIdAsyncWithHttpInfo (Guid? collabId);
/// <summary>
/// rechercher les référents
/// </summary>
/// <remarks>
/// rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son mail apside
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <returns>Task of List&lt;Collaborateur&gt;</returns>
System.Threading.Tasks.Task<List<Collaborateur>> ChercherRefCollabMailAsync (string mailApside);
/// <summary>
/// rechercher les référents
/// </summary>
/// <remarks>
/// rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son mail apside
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <returns>Task of ApiResponse (List&lt;Collaborateur&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<Collaborateur>>> ChercherRefCollabMailAsyncWithHttpInfo (string mailApside);
/// <summary>
/// rechercher le référent qui a le plus suivit
/// </summary>
/// <remarks>
/// rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son identifiant
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Task of Collaborateur</returns>
System.Threading.Tasks.Task<Collaborateur> ChercherRefSuiviParDateCollabIdAsync (Guid? collabId, string date);
/// <summary>
/// rechercher le référent qui a le plus suivit
/// </summary>
/// <remarks>
/// rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son identifiant
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Task of ApiResponse (Collaborateur)</returns>
System.Threading.Tasks.Task<ApiResponse<Collaborateur>> ChercherRefSuiviParDateCollabIdAsyncWithHttpInfo (Guid? collabId, string date);
/// <summary>
/// rechercher le référent qui a le plus suivit
/// </summary>
/// <remarks>
/// rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son mail apside
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Task of Collaborateur</returns>
System.Threading.Tasks.Task<Collaborateur> ChercherRefSuiviParDateCollabMailAsync (string mailApside, string date);
/// <summary>
/// rechercher le référent qui a le plus suivit
/// </summary>
/// <remarks>
/// rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son mail apside
/// </remarks>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Task of ApiResponse (Collaborateur)</returns>
System.Threading.Tasks.Task<ApiResponse<Collaborateur>> ChercherRefSuiviParDateCollabMailAsyncWithHttpInfo (string mailApside, string date);
#endregion Asynchronous Operations
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class RfrentApi : IRfrentApi
{
private IO.Swagger.ClientCollaborateur.ExceptionFactory _exceptionFactory = (name, response) => null;
/// <summary>
/// Initializes a new instance of the <see cref="RfrentApi"/> class.
/// </summary>
/// <returns></returns>
public RfrentApi(String basePath)
{
this.Configuration = new IO.Swagger.ClientCollaborateur.Configuration { BasePath = basePath };
ExceptionFactory = IO.Swagger.ClientCollaborateur.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Initializes a new instance of the <see cref="RfrentApi"/> class
/// </summary>
/// <returns></returns>
public RfrentApi()
{
this.Configuration = IO.Swagger.ClientCollaborateur.Configuration.Default;
ExceptionFactory = IO.Swagger.ClientCollaborateur.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Initializes a new instance of the <see cref="RfrentApi"/> class
/// using Configuration object
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <returns></returns>
public RfrentApi(IO.Swagger.ClientCollaborateur.Configuration configuration = null)
{
if (configuration == null) // use the default one in Configuration
this.Configuration = IO.Swagger.ClientCollaborateur.Configuration.Default;
else
this.Configuration = configuration;
ExceptionFactory = IO.Swagger.ClientCollaborateur.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <value>The base path</value>
public String GetBasePath()
{
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <value>The base path</value>
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
public void SetBasePath(String basePath)
{
// do nothing
}
/// <summary>
/// Gets or sets the configuration object
/// </summary>
/// <value>An instance of the Configuration</value>
public IO.Swagger.ClientCollaborateur.Configuration Configuration {get; set;}
/// <summary>
/// Provides a factory method hook for the creation of exceptions.
/// </summary>
public IO.Swagger.ClientCollaborateur.ExceptionFactory ExceptionFactory
{
get
{
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
{
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
}
return _exceptionFactory;
}
set { _exceptionFactory = value; }
}
/// <summary>
/// Gets the default header.
/// </summary>
/// <returns>Dictionary of HTTP header</returns>
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
public IDictionary<String, String> DefaultHeader()
{
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
}
/// <summary>
/// Add default header.
/// </summary>
/// <param name="key">Header field name.</param>
/// <param name="value">Header field value.</param>
/// <returns></returns>
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
public void AddDefaultHeader(string key, string value)
{
this.Configuration.AddDefaultHeader(key, value);
}
/// <summary>
/// rechercher les référents rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son identifiant
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <returns>List&lt;Collaborateur&gt;</returns>
public List<Collaborateur> ChercherRefCollabId (Guid? collabId)
{
ApiResponse<List<Collaborateur>> localVarResponse = ChercherRefCollabIdWithHttpInfo(collabId);
return localVarResponse.Data;
}
/// <summary>
/// rechercher les référents rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son identifiant
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <returns>ApiResponse of List&lt;Collaborateur&gt;</returns>
public ApiResponse< List<Collaborateur> > ChercherRefCollabIdWithHttpInfo (Guid? collabId)
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling RfrentApi->ChercherRefCollabId");
var localVarPath = "/collaborateurs/{collabId}/referents";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (collabId != null) localVarPathParams.Add("collabId", this.Configuration.ApiClient.ParameterToString(collabId)); // path parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("ChercherRefCollabId", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<List<Collaborateur>>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(List<Collaborateur>) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List<Collaborateur>)));
}
/// <summary>
/// rechercher les référents rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son identifiant
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <returns>Task of List&lt;Collaborateur&gt;</returns>
public async System.Threading.Tasks.Task<List<Collaborateur>> ChercherRefCollabIdAsync (Guid? collabId)
{
ApiResponse<List<Collaborateur>> localVarResponse = await ChercherRefCollabIdAsyncWithHttpInfo(collabId);
return localVarResponse.Data;
}
/// <summary>
/// rechercher les référents rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son identifiant
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <returns>Task of ApiResponse (List&lt;Collaborateur&gt;)</returns>
public async System.Threading.Tasks.Task<ApiResponse<List<Collaborateur>>> ChercherRefCollabIdAsyncWithHttpInfo (Guid? collabId)
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling RfrentApi->ChercherRefCollabId");
var localVarPath = "/collaborateurs/{collabId}/referents";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (collabId != null) localVarPathParams.Add("collabId", this.Configuration.ApiClient.ParameterToString(collabId)); // path parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("ChercherRefCollabId", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<List<Collaborateur>>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(List<Collaborateur>) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List<Collaborateur>)));
}
/// <summary>
/// rechercher les référents rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son mail apside
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <returns>List&lt;Collaborateur&gt;</returns>
public List<Collaborateur> ChercherRefCollabMail (string mailApside)
{
ApiResponse<List<Collaborateur>> localVarResponse = ChercherRefCollabMailWithHttpInfo(mailApside);
return localVarResponse.Data;
}
/// <summary>
/// rechercher les référents rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son mail apside
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <returns>ApiResponse of List&lt;Collaborateur&gt;</returns>
public ApiResponse< List<Collaborateur> > ChercherRefCollabMailWithHttpInfo (string mailApside)
{
// verify the required parameter 'mailApside' is set
if (mailApside == null)
throw new ApiException(400, "Missing required parameter 'mailApside' when calling RfrentApi->ChercherRefCollabMail");
var localVarPath = "/collaborateurs/{mailApside}/referents";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (mailApside != null) localVarPathParams.Add("mailApside", this.Configuration.ApiClient.ParameterToString(mailApside)); // path parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("ChercherRefCollabMail", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<List<Collaborateur>>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(List<Collaborateur>) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List<Collaborateur>)));
}
/// <summary>
/// rechercher les référents rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son mail apside
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <returns>Task of List&lt;Collaborateur&gt;</returns>
public async System.Threading.Tasks.Task<List<Collaborateur>> ChercherRefCollabMailAsync (string mailApside)
{
ApiResponse<List<Collaborateur>> localVarResponse = await ChercherRefCollabMailAsyncWithHttpInfo(mailApside);
return localVarResponse.Data;
}
/// <summary>
/// rechercher les référents rechercher les référents d&#x27;un collaborateur à l&#x27;aide de son mail apside
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <returns>Task of ApiResponse (List&lt;Collaborateur&gt;)</returns>
public async System.Threading.Tasks.Task<ApiResponse<List<Collaborateur>>> ChercherRefCollabMailAsyncWithHttpInfo (string mailApside)
{
// verify the required parameter 'mailApside' is set
if (mailApside == null)
throw new ApiException(400, "Missing required parameter 'mailApside' when calling RfrentApi->ChercherRefCollabMail");
var localVarPath = "/collaborateurs/{mailApside}/referents";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (mailApside != null) localVarPathParams.Add("mailApside", this.Configuration.ApiClient.ParameterToString(mailApside)); // path parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("ChercherRefCollabMail", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<List<Collaborateur>>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(List<Collaborateur>) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List<Collaborateur>)));
}
/// <summary>
/// rechercher le référent qui a le plus suivit rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son identifiant
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Collaborateur</returns>
public Collaborateur ChercherRefSuiviParDateCollabId (Guid? collabId, string date)
{
ApiResponse<Collaborateur> localVarResponse = ChercherRefSuiviParDateCollabIdWithHttpInfo(collabId, date);
return localVarResponse.Data;
}
/// <summary>
/// rechercher le référent qui a le plus suivit rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son identifiant
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>ApiResponse of Collaborateur</returns>
public ApiResponse< Collaborateur > ChercherRefSuiviParDateCollabIdWithHttpInfo (Guid? collabId, string date)
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling RfrentApi->ChercherRefSuiviParDateCollabId");
// verify the required parameter 'date' is set
if (date == null)
throw new ApiException(400, "Missing required parameter 'date' when calling RfrentApi->ChercherRefSuiviParDateCollabId");
var localVarPath = "/collaborateurs/{collabId}/referent";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (collabId != null) localVarPathParams.Add("collabId", this.Configuration.ApiClient.ParameterToString(collabId)); // path parameter
if (date != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "date", date)); // query parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("ChercherRefSuiviParDateCollabId", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Collaborateur>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Collaborateur) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Collaborateur)));
}
/// <summary>
/// rechercher le référent qui a le plus suivit rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son identifiant
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Task of Collaborateur</returns>
public async System.Threading.Tasks.Task<Collaborateur> ChercherRefSuiviParDateCollabIdAsync (Guid? collabId, string date)
{
ApiResponse<Collaborateur> localVarResponse = await ChercherRefSuiviParDateCollabIdAsyncWithHttpInfo(collabId, date);
return localVarResponse.Data;
}
/// <summary>
/// rechercher le référent qui a le plus suivit rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son identifiant
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="collabId">Ce paramêtre permet de renseigner l&#x27;identifiant du collaborateur recherché</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Task of ApiResponse (Collaborateur)</returns>
public async System.Threading.Tasks.Task<ApiResponse<Collaborateur>> ChercherRefSuiviParDateCollabIdAsyncWithHttpInfo (Guid? collabId, string date)
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling RfrentApi->ChercherRefSuiviParDateCollabId");
// verify the required parameter 'date' is set
if (date == null)
throw new ApiException(400, "Missing required parameter 'date' when calling RfrentApi->ChercherRefSuiviParDateCollabId");
var localVarPath = "/collaborateurs/{collabId}/referent";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (collabId != null) localVarPathParams.Add("collabId", this.Configuration.ApiClient.ParameterToString(collabId)); // path parameter
if (date != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "date", date)); // query parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("ChercherRefSuiviParDateCollabId", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Collaborateur>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Collaborateur) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Collaborateur)));
}
/// <summary>
/// rechercher le référent qui a le plus suivit rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son mail apside
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Collaborateur</returns>
public Collaborateur ChercherRefSuiviParDateCollabMail (string mailApside, string date)
{
ApiResponse<Collaborateur> localVarResponse = ChercherRefSuiviParDateCollabMailWithHttpInfo(mailApside, date);
return localVarResponse.Data;
}
/// <summary>
/// rechercher le référent qui a le plus suivit rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son mail apside
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>ApiResponse of Collaborateur</returns>
public ApiResponse< Collaborateur > ChercherRefSuiviParDateCollabMailWithHttpInfo (string mailApside, string date)
{
// verify the required parameter 'mailApside' is set
if (mailApside == null)
throw new ApiException(400, "Missing required parameter 'mailApside' when calling RfrentApi->ChercherRefSuiviParDateCollabMail");
// verify the required parameter 'date' is set
if (date == null)
throw new ApiException(400, "Missing required parameter 'date' when calling RfrentApi->ChercherRefSuiviParDateCollabMail");
var localVarPath = "/collaborateurs/{mailApside}/referent";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (mailApside != null) localVarPathParams.Add("mailApside", this.Configuration.ApiClient.ParameterToString(mailApside)); // path parameter
if (date != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "date", date)); // query parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("ChercherRefSuiviParDateCollabMail", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Collaborateur>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Collaborateur) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Collaborateur)));
}
/// <summary>
/// rechercher le référent qui a le plus suivit rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son mail apside
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Task of Collaborateur</returns>
public async System.Threading.Tasks.Task<Collaborateur> ChercherRefSuiviParDateCollabMailAsync (string mailApside, string date)
{
ApiResponse<Collaborateur> localVarResponse = await ChercherRefSuiviParDateCollabMailAsyncWithHttpInfo(mailApside, date);
return localVarResponse.Data;
}
/// <summary>
/// rechercher le référent qui a le plus suivit rechercher le référent du collaborateur l’ayant le plus suivi depuis une date donnée à l&#x27;aide de son mail apside
/// </summary>
/// <exception cref="IO.Swagger.ClientCollaborateur.ApiException">Thrown when fails to make API call</exception>
/// <param name="mailApside">Ce paramêtre permet de renseigner le mail apside du collaborateur recherché /!\\ \&quot;@\&quot; doit être changé en \&quot;%40\&quot; /!\\</param>
/// <param name="date">Ce paramêtre permet de renseigner la date recherchée</param>
/// <returns>Task of ApiResponse (Collaborateur)</returns>
public async System.Threading.Tasks.Task<ApiResponse<Collaborateur>> ChercherRefSuiviParDateCollabMailAsyncWithHttpInfo (string mailApside, string date)
{
// verify the required parameter 'mailApside' is set
if (mailApside == null)
throw new ApiException(400, "Missing required parameter 'mailApside' when calling RfrentApi->ChercherRefSuiviParDateCollabMail");
// verify the required parameter 'date' is set
if (date == null)
throw new ApiException(400, "Missing required parameter 'date' when calling RfrentApi->ChercherRefSuiviParDateCollabMail");
var localVarPath = "/collaborateurs/{mailApside}/referent";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (mailApside != null) localVarPathParams.Add("mailApside", this.Configuration.ApiClient.ParameterToString(mailApside)); // path parameter
if (date != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "date", date)); // query parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("ChercherRefSuiviParDateCollabMail", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Collaborateur>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Collaborateur) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Collaborateur)));
}
}
}

@ -1,824 +0,0 @@
using EPAServeur.Models.EP;
using EPAServeur.Models.Formation;
using EPAServeur.Models.Notes;
using EPAServeur.Models.SaisieChamp;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EPAServeur.Context
{
public class EpContext : DbContext
{
//EP
public DbSet<AugmentationSalaire> AugmentationSalaire { get; set; }
public DbSet<Autorisation> Autorisation { get; set; }
public DbSet<ChoixTypeEntretien> ChoixTypeEntretien { get; set; }
public DbSet<Document> Document { get; set; }
public DbSet<Engagement> Engagement { get; set; }
public DbSet<Ep> Ep { get; set; }
public DbSet<Objectif> Objectif { get; set; }
public DbSet<ObjectifPrecedent> ObjectifPrecedent { get; set; }
public DbSet<RdvEntretien> RdvEntretien { get; set; }
public DbSet<TypeEntretien> TypeEntretien { get; set; }
//Formation
public DbSet<DemandeFormation> DemandeFormation { get; set; }
public DbSet<Formation> Formation { get; set; }
public DbSet<ModeFormation> ModeFormation { get; set; }
public DbSet<OrigineDemandeFormation> OrigineDemandeFormation { get; set; }
public DbSet<OrigineFormation> OrigineFormation { get; set; }
public DbSet<ParticipationFormation> ParticipationFormation { get; set; }
public DbSet<StatutFormation> StatutFormation { get; set; }
public DbSet<Theme> Theme { get; set; }
public DbSet<TypeFormation> TypeFormation { get; set; }
//Note
public DbSet<Note> Note { get; set; }
//SaisieChamp
public DbSet<Champ> Champ { get; set; }
public DbSet<Saisie> Saisie { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseMySQL("server=localhost;database=server_ep;user=root;password=root");//PENSER A METTRE DANS UN FICHIER DE CONFIG
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
//EP
modelBuilder.Entity<AugmentationSalaire>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Autorisation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Document>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Engagement>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Ep>(entity =>
{
entity.HasKey(e => e.Id);
entity.HasOne<AugmentationSalaire>(e => e.AugmentationSalaire).WithOne(a => a.Ep).HasForeignKey<AugmentationSalaire>(a => a.EpId);
entity.HasOne<Autorisation>(e => e.Autorisation).WithOne( a => a.Ep).HasForeignKey<Autorisation>(a => a.EpId);
entity.HasMany<ChoixTypeEntretien>(e => e.ChoixTypeEntretien).WithOne(c => c.Ep);
entity.HasOne<Delegation>(e => e.Delegation).WithOne(d => d.Ep).HasForeignKey<Delegation>(d => d.EpId);
entity.HasMany<DemandeFormation>(e => e.DemandesFormation).WithOne(d => d.Ep);
entity.HasMany<Document>(e => e.Documents).WithOne(d => d.Ep);
entity.HasMany<Engagement>(e => e.Engagements).WithOne(e => e.Ep);
entity.HasMany<Objectif>(e => e.Objectifs).WithOne(o => o.Ep);
entity.HasMany<ObjectifPrecedent>(e => e.ObjectifsPrecedents).WithOne(o => o.Ep);
entity.HasMany<ParticipantEP>(e => e.Participants).WithOne(p => p.Ep);
entity.HasOne<RdvEntretien>(e => e.RdvEntretien).WithOne(r => r.EpChoixFinal).HasForeignKey<RdvEntretien>(r => r.EpId);
entity.HasMany<RdvEntretien>(e => e.PropositionsRDV).WithOne(r => r.EpProposition);
});
modelBuilder.Entity<Objectif>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<ObjectifPrecedent>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<RdvEntretien>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<TypeEntretien>(entity =>
{
entity.HasKey(e => e.Id);
entity.HasIndex(e => e.Libelle).IsUnique();
});
//Formation
modelBuilder.Entity<DemandeFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Formation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<ModeFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<OrigineDemandeFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<OrigineFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<ParticipationFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<StatutFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<Theme>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<TypeFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
//Notes
modelBuilder.Entity<Note>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
//SaisieChamp
modelBuilder.Entity<Champ>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Saisie>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
}
public void AjoutTheme() //Les thèmes pourront être ajoutés et conservés
{
Theme management, securite, developpement, gestionprojet;
management = new Theme { Libelle = "Management" };
this.Theme.Add(management);
securite = new Theme { Libelle = "Sécurité" };
this.Theme.Add(securite);
developpement = new Theme { Libelle = "Développement" };
this.Theme.Add(developpement);
gestionprojet = new Theme { Libelle = "Gestion de projet" };
this.Theme.Add(gestionprojet);
this.SaveChanges();
}
/*Les informations ajoutées pourront être conservées
* */
public void AjoutInformationsDeBase()
{
//StatutFormation
StatutFormation statutPlanifie, statutReplanifie, statutRealise, statutAnnule;
statutPlanifie = new StatutFormation { Id = 1, Libelle = "Planifiée" };
this.StatutFormation.Add(statutPlanifie);
statutReplanifie = new StatutFormation { Id = 2, Libelle = "Replanifié" };
this.StatutFormation.Add(statutReplanifie);
statutRealise = new StatutFormation { Id = 3, Libelle = "Réalisée" };
this.StatutFormation.Add(statutRealise);
statutAnnule = new StatutFormation { Id = 4, Libelle = "Annulée" };
this.StatutFormation.Add(statutAnnule);
//ModeFormation
ModeFormation modeExterne, modeInterne, modePresentiel, modeELearning;
modeExterne = new ModeFormation { Libelle = "Externe" };
this.ModeFormation.Add(modeExterne);
modeInterne = new ModeFormation { Libelle = "Interne" };
this.ModeFormation.Add(modeInterne);
modePresentiel = new ModeFormation { Libelle = "Présentiel" };
this.ModeFormation.Add(modePresentiel);
modeELearning = new ModeFormation { Libelle = "E-learning" };
this.ModeFormation.Add(modeELearning);
//TypeFormation
TypeFormation typeExterne, typeInterne, typeELearning, typeAcademy;
typeExterne = new TypeFormation { Libelle = "Externe" };
this.TypeFormation.Add(typeExterne);
typeInterne = new TypeFormation { Libelle = "Interne" };
this.TypeFormation.Add(typeInterne);
typeELearning = new TypeFormation { Libelle = "E-learning" };
this.TypeFormation.Add(typeELearning);
typeAcademy = new TypeFormation { Libelle = "Academy by Apside" };
this.TypeFormation.Add(typeAcademy);
//OrigineFormation
OrigineFormation origineFormationCollaborateur, origineFormationClient, origineFormationApside, origineFormationReglementaire;
origineFormationCollaborateur = new OrigineFormation { Libelle = "Demande collaborateur" };
this.OrigineFormation.Add(origineFormationCollaborateur);
origineFormationClient = new OrigineFormation { Libelle = "Exigence client" };
this.OrigineFormation.Add(origineFormationClient);
origineFormationApside = new OrigineFormation { Libelle = "Exigence Apside" };
this.OrigineFormation.Add(origineFormationApside);
origineFormationReglementaire = new OrigineFormation { Libelle = "Formation réglementaire" };
this.OrigineFormation.Add(origineFormationReglementaire);
//OrigineDemandeFormation
OrigineDemandeFormation origineDemandeFormationCollaborateur, origineDemandeFormationEP,
origineDemandeFormationClient, origineDemandeFormationReglement, origineDemandeFormationApside;
origineDemandeFormationCollaborateur = new OrigineDemandeFormation { Libelle = "Demande collaborateur" };
this.OrigineDemandeFormation.Add(origineDemandeFormationCollaborateur);
origineDemandeFormationEP = new OrigineDemandeFormation { Libelle = "Demande EP" };
this.OrigineDemandeFormation.Add(origineDemandeFormationEP);
origineDemandeFormationClient = new OrigineDemandeFormation { Libelle = "Exigence Client" };
this.OrigineDemandeFormation.Add(origineDemandeFormationClient);
origineDemandeFormationReglement = new OrigineDemandeFormation { Libelle = "Formation réglementaire" };
this.OrigineDemandeFormation.Add(origineDemandeFormationReglement);
origineDemandeFormationApside = new OrigineDemandeFormation { Libelle = "Demande Apside" };
this.OrigineDemandeFormation.Add(origineDemandeFormationApside);
//TypeEntretien
TypeEntretien typeSite, typeClient, typeVisio, typeTelephone;
typeSite = new TypeEntretien { Libelle = "Sur site" };
this.TypeEntretien.Add(typeSite);
typeClient = new TypeEntretien { Libelle = "Chez le client" };
this.TypeEntretien.Add(typeClient);
typeVisio = new TypeEntretien { Libelle = "Visioconférence" };
this.TypeEntretien.Add(typeVisio);
typeTelephone = new TypeEntretien { Libelle = "Téléphonique" };
this.TypeEntretien.Add(typeTelephone);
//Formation
Formation f1, f2, f3;//Planifiées
Formation f4, f5; // Réalisées
Formation f6, f7, f8, f9;//Replanifiées
Formation f10, f11; //Annulées
//new DateTime(Année, Mois, Jour, Heure, Minute...)
List<Formation> formations = new List<Formation>();
f1 = new Formation
{
Intitule = "Formation1",
IdAgence = 1,
DateDebut = new DateTime(2020, 9, 16, 10, 0, 0),
DateFin = new DateTime(2020, 9, 16),
Heure = 2,
Jour = 1,
ModeFormation = modeELearning,
TypeFormation = typeELearning,
Organisme = "Organisme1",
Origine = origineFormationClient,
Statut = statutPlanifie,
EstCertifiee = false
};
this.Formation.Add(f1);
f2 = new Formation
{
Intitule = "Formation2",
IdAgence =1,
DateDebut = new DateTime(2020, 10, 5, 14, 0, 0),
DateFin = new DateTime(2020, 10, 9),
Heure = 10,
Jour = 5,
ModeFormation = modeExterne,
TypeFormation = typeExterne,
Organisme = "Organisme2",
Origine = origineFormationClient,
Statut = statutPlanifie,
EstCertifiee = false
};
this.Formation.Add(f2);
f3 = new Formation
{
Intitule = "Formation3",
IdAgence = 1,
DateDebut = new DateTime(2020, 9, 21, 14, 0, 0),
DateFin = new DateTime(2020, 9, 21),
Heure = 4,
Jour = 2,
ModeFormation = modeELearning,
TypeFormation = typeELearning,
Organisme = "Organisme2",
Origine = origineFormationApside,
Statut = statutPlanifie,
EstCertifiee = true
};
this.Formation.Add(f3);
f4 = new Formation
{
Intitule = "Formation4",
IdAgence = 1,
DateDebut = new DateTime(2020, 05, 11, 14, 0, 0),
DateFin = new DateTime(2020, 05, 11),
Heure = 3,
Jour = 1,
ModeFormation = modeELearning,
TypeFormation = typeAcademy,
Organisme = "Organisme2",
Origine = origineFormationCollaborateur,
Statut = statutRealise,
EstCertifiee = true
};
this.Formation.Add(f4);
f5 = new Formation
{
Intitule = "Formation5",
IdAgence = 1,
DateDebut = new DateTime(2020, 08, 1, 13, 0, 0),
DateFin = new DateTime(2020, 08, 3),
Heure = 6,
Jour = 2,
ModeFormation = modePresentiel,
TypeFormation = typeExterne,
Organisme = "Organisme3",
Origine = origineFormationClient,
Statut = statutRealise,
EstCertifiee = true
};
this.Formation.Add(f5);
f6 = new Formation
{
Intitule = "Formation6",
IdAgence = 1,
DateDebut = new DateTime(2020, 9, 30, 9, 0, 0),
DateFin = new DateTime(2020, 10, 1),
Heure = 4,
Jour = 2,
ModeFormation = modePresentiel,
TypeFormation = typeInterne,
Organisme = "Organisme4",
Origine = origineFormationClient,
Statut = statutReplanifie,
EstCertifiee = false
};
this.Formation.Add(f6);
f7 = new Formation
{
Intitule = "Formation7",
IdAgence = 1,
DateDebut = new DateTime(2020, 10, 5, 10, 0, 0),
DateFin = new DateTime(2020, 10, 8),
Heure = 6,
Jour = 5,
ModeFormation = modePresentiel,
TypeFormation = typeInterne,
Organisme = "Organisme2",
Origine = origineFormationClient,
Statut = statutReplanifie,
EstCertifiee = false
};
this.Formation.Add(f7);
f8 = new Formation
{
Intitule = "Formation2",
IdAgence = 1,
DateDebut = new DateTime(2020, 11, 18, 10, 0, 0),
DateFin = new DateTime(2020, 11, 20),
Heure = 6,
Jour = 3,
ModeFormation = modeELearning,
TypeFormation = typeAcademy,
Organisme = "Organisme4",
Origine = origineFormationClient,
Statut = statutReplanifie,
EstCertifiee = true
};
this.Formation.Add(f8);
f9 = new Formation
{
Intitule = "Formation9",
IdAgence = 1,
DateDebut = new DateTime(2020, 11, 15, 9, 0, 0),
DateFin = new DateTime(2020, 11, 15),
Heure = 3,
Jour = 1,
ModeFormation = modePresentiel,
TypeFormation = typeInterne,
Organisme = "Organisme3",
Origine = origineFormationClient,
Statut = statutReplanifie,
EstCertifiee = true
};
this.Formation.Add(f9);
f10 = new Formation
{
Intitule = "Formation10",
IdAgence = 1,
DateDebut = new DateTime(2020, 8, 3, 14, 0, 0),
DateFin = new DateTime(2020, 8, 3),
Heure = 2,
Jour = 1,
ModeFormation = modePresentiel,
TypeFormation = typeInterne,
Organisme = "Organisme4",
Origine = origineFormationClient,
Statut = statutAnnule,
EstCertifiee = false
};
this.Formation.Add(f10);
f11 = new Formation
{
Intitule = "Formation11",
IdAgence = 1,
DateDebut = new DateTime(2020, 04, 6, 9, 0, 0),
DateFin = new DateTime(2020, 04, 11),
Heure = 15,
Jour = 5,
ModeFormation = modePresentiel,
TypeFormation = typeInterne,
Organisme = "Organisme1",
Origine = origineFormationClient,
Statut = statutAnnule,
EstCertifiee = false
};
this.Formation.Add(f11);
/*
formations.Add(f1);
formations.Add(f2);
formations.Add(f3);
formations.Add(f4);
formations.Add(f5);
formations.Add(f6);
formations.Add(f7);
formations.Add(f8);
formations.Add(f9);
formations.Add(f10);
formations.Add(f11);
int[] npParticipants = { };
*/
//Créer des EP qui ont déjà été effectué (pas grave si il y a des informations qui sont incohérentes)
//C1 ---> C5 Collaborateurs
//C5 --> C10 CP+Tech Lead
//RH --> RH
//AS --> Assistant
//COM --> Commercial
//DEL --> Delivery
// 10 EP
/*
Ep ep;
DemandeFormation df;
ParticipationFormation pf;
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "COM1",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
df = new DemandeFormation
{
Description = "Description formation",
DemandeRH = false,
DateDemande = new DateTime(2018, 7, 8),
};
Ep.Add(ep);
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "C6",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
Ep.Add(ep);
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "C6",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
Ep.Add(ep);
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "C6",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
Ep.Add(ep);
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "C6",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
Ep.Add(ep);
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "C6",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
Ep.Add(ep);
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "C6",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
Ep.Add(ep);
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "C6",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
Ep.Add(ep);
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "C6",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
Ep.Add(ep);
ep = new Ep
{
IdCollaborateur = "C1",
IdReferent = "C6",
IdAgence = 1,
IdBu = 2,
Fonction = "Dev",
TypeEP = TypeChamp.EPA,
NumeroEp = 1,
DateCreation = new DateTime(2017, 7, 7),
DatePrevisionnelle = new DateTime(2018, 7, 8),
Obligatoire = false,
Statut = StatutEP.Signe,
CV = "CV.pdf",
DateSaisie = new DateTime(2018, 6, 20)
};
Ep.Add(ep);
*/
//AVoir un tableau pour dire combien de demande de formations seront faites pour chaque EP
//Avoir un tableau pour dire combien de demande de Participation seront faites et accepter (max : 11)
//La formation associée sera choisie de manière aléatoire parmi celles créées (pas grave si la cohérence niveau date est foireuse....)
//Pour chaque demande de formation... essayer d'avoir une fois la même personne dans une formation ?... lool
this.SaveChanges();
}
public void AjoutChamps()
{
Champ c;
//CHAMPS EPS
c = new Champ { Section="Mission/Projet", Ordre = 0, Texte="Impressions générales", TypeChamp=TypeChamp.EPS, TypeSaisie=TypeSaisie.Commentaire};
this.Champ.Add(c);
c = new Champ { Section="Mission/Projet", Ordre = 1, Texte="Faits marquants", TypeChamp=TypeChamp.EPS, TypeSaisie = TypeSaisie.Commentaire };
this.Champ.Add(c);
c = new Champ { Section="Mission/Projet", Ordre = 2, Texte="Succès", TypeChamp=TypeChamp.EPS};
this.Champ.Add(c);
c = new Champ { Section="Mission/Projet", Ordre = 3, Texte="Retours Client/Chef de projet", TypeChamp=TypeChamp.EPS, TypeSaisie = TypeSaisie.Commentaire };
this.Champ.Add(c);
c = new Champ { Section = "Mission/Projet", Ordre = 4, Texte = "Difficultés", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Mission/Projet", Ordre = 5, Texte = "Relation Client/Chef de projet", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Mission/Projet", Ordre = 6, Texte = "Ambiance de travail", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Mission/Projet", Ordre = 7, Texte = "Intérêt technique", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Mission/Projet", Ordre = 8, Texte = "Site géographique", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 0, Texte = "Motivation", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 1, Texte = "Adaptabilité", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 2, Texte = "Force de proposition", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 3, Texte = "Leadership", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 4, Texte = "Ecoute", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 5, Texte = "Prise de recul", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 6, Texte = "Sens du service", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 7, Texte = "Communication", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 8, Texte = "Rigueur", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Générales", Ordre = 9, Texte = "Organisation", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Compétences", SousSection = "Compétences Techniques", Ordre = 0, Texte = "Nouvelle compétence", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Competence };
this.Champ.Add(c);
c = new Champ { Section = "Apside", Ordre = 0, Texte = "Relation avec la structure", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation};
this.Champ.Add(c);
c = new Champ { Section = "Apside", Ordre = 1, Texte = "Sentiment d'écoute", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation};
this.Champ.Add(c);
c = new Champ { Section = "Apside", Ordre = 2, Texte = "Perception de la stratégie de développement", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation};
this.Champ.Add(c);
c = new Champ { Section = "Apside", Ordre = 3, Texte = "Esprit d'entreprise", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation};
this.Champ.Add(c);
c = new Champ { Section = "Apside", Ordre = 4, Texte = "Transparence de l'information", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation};
this.Champ.Add(c);
c = new Champ { Section = "Apside", Ordre = 5, Texte = "Politique de formation", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation};
this.Champ.Add(c);
c = new Champ { Section = "Apside", Ordre = 6, Texte = "Satisfaction Apside", TypeChamp = TypeChamp.EPS, TypeSaisie = TypeSaisie.Notation};
this.Champ.Add(c);
//CHAMPS EPA
c = new Champ { Section = "Formation", Ordre = 0, Texte = "Formations effectuées", TypeChamp = TypeChamp.EPA, TypeSaisie = TypeSaisie.Aucun };
this.Champ.Add(c);
c = new Champ { Section = "Evolution Professionnelle et Salarial", Ordre = 0, Texte = "Evolution de l'emploie", TypeChamp = TypeChamp.EPA, TypeSaisie = TypeSaisie.Aucun };
this.Champ.Add(c);
c = new Champ { Section = "Projet professionnel/Souhait d’évolution ", Ordre = 0, Texte = "A court terme", TypeChamp = TypeChamp.EPA, TypeSaisie = TypeSaisie.Commentaire };
this.Champ.Add(c);
c = new Champ { Section = "Projet professionnel/Souhait d’évolution ", Ordre = 1, Texte = "A long terme", TypeChamp = TypeChamp.EPA, TypeSaisie = TypeSaisie.Commentaire };
this.Champ.Add(c);
c = new Champ { Section = "Projet professionnel/Souhait d’évolution ", Ordre = 2, Texte = "Atouts/Freins pour ce projet", TypeChamp = TypeChamp.EPA, TypeSaisie = TypeSaisie.Commentaire };
this.Champ.Add(c);
c = new Champ { Section = "Projet professionnel/Souhait d’évolution ", Ordre = 3, Texte = "Commentaire référent", TypeChamp = TypeChamp.EPA, TypeSaisie = TypeSaisie.Commentaire};
this.Champ.Add(c);
//CHAMPS EPASIX
c = new Champ { Section = "Evolution", Ordre = 1, Texte = "Evolution du salaire", TypeChamp = TypeChamp.EPASIXANS, TypeSaisie = TypeSaisie.Aucun };
this.Champ.Add(c);
/*c = new Champ { Section = "", SousSection = "", Ordre = 0, Texte = "", TypeChamp = TypeChamp.EPASIXANS };
this.Champ.Add(c);
c = new Champ { Section = "", SousSection = "", Ordre = 0, Texte = "", TypeChamp = TypeChamp.EPASIXANS };
this.Champ.Add(c);
c = new Champ { Section = "", SousSection = "", Ordre = 0, Texte = "", TypeChamp = TypeChamp.EPASIXANS };
this.Champ.Add(c);*/
//CHAMPS EVALUATION
c = new Champ { Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
c = new Champ { Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamp.Evaluation, TypeSaisie = TypeSaisie.Notation };
this.Champ.Add(c);
this.SaveChanges();
}
}
}

@ -1,228 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using EPAServeur.IServices;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class CollaborateursApiController : ControllerBase
{
private readonly ICollaborateurService collaborateurService;
public CollaborateursApiController(ICollaborateurService _collaborateurService)
{
collaborateurService = _collaborateurService;
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer un collaboratuer par son id</remarks>
/// <param name="idCollaborateur">id collaborateur</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/collaborateurs/{idCollaborateur}")]
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateurById")]
[SwaggerResponse(statusCode: 200, type: typeof(CollaborateurDTO), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetCollaborateurById([FromRoute][Required]Guid? idCollaborateur)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(CollaborateurDTO));
CollaborateurDTO collaborateurDTO = collaborateurService.GetCollaborateurById(idCollaborateur);
if( collaborateurDTO == null)
{
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = "404",
Message = "Le collaborateur n'existe pas",
};
return NotFound(erreurDTO);
}
return Ok(collaborateurDTO);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
/*string exampleJson = null;
exampleJson = "{\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<CollaborateurDTO>(exampleJson)
: default(CollaborateurDTO); //TODO: Change the data returned
return new ObjectResult(example);*/
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer un collaborateur par son mail</remarks>
/// <param name="mail">mail de l&#x27;utilisateur connecté (mail obtenu via le token Keycloak)</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/collaborateurs/mail/{mail}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateurByMail")]
[SwaggerResponse(statusCode: 200, type: typeof(CollaborateurDTO), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetCollaborateurByMail([FromRoute][Required]string mail)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(CollaborateurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<CollaborateurDTO>(exampleJson)
: default(CollaborateurDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des collaborateurs</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="fonctions">Liste des fonctions des collaborateurs que l&#x27;on veut récupérer</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="idBU">id de la business unit à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/collaborateurs")]
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateurs")]
[SwaggerResponse(statusCode: 200, type: typeof(List<CollaborateurDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetCollaborateurs([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]List<string> fonctions, [FromQuery]int? idAgence, [FromQuery]int? idBU, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
return StatusCode(200, collaborateurService.GetCollaborateurs());
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
/*string exampleJson = null;
exampleJson = "[ {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n}, {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<CollaborateurDTO>>(exampleJson)
: default(List<CollaborateurDTO>); //TODO: Change the data returned
return new ObjectResult(example);*/
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des collaborateurs dont le référent à la charge</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="idReferent">id referent</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/collaborateurs/referent/{idReferent}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateursByReferent")]
[SwaggerResponse(statusCode: 200, type: typeof(List<CollaborateurDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetCollaborateursByReferent([FromQuery][Required()]bool? asc, [FromRoute][Required]Guid? idReferent, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<CollaborateurDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n}, {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<CollaborateurDTO>>(exampleJson)
: default(List<CollaborateurDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer un profil collaborateur par mail</remarks>
/// <param name="mail">mail de l&#x27;utilisateur connecté (mail obtenu via le token Keycloak)</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/collaborateurs/profil/{mail}/")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetProfilCollaborateurByMail")]
[SwaggerResponse(statusCode: 200, type: typeof(ProfilDTO), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetProfilCollaborateurByMail([FromRoute][Required]string mail)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(ProfilDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<ProfilDTO>(exampleJson)
: default(ProfilDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
}
}

@ -1,125 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class DemandesDelegationApiController : ControllerBase
{
/// <summary>
///
/// </summary>
/// <remarks>Faire une demande de délégation à une autre personne</remarks>
/// <param name="idCollaborateur">id collaborateur</param>
/// <param name="idEP">id EP</param>
/// <response code="200">Demande de délégation envoyée avec succès</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/demandesdelegation/ep/{idEP}/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("FaireDemandeDelegation")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult FaireDemandeDelegation([FromRoute][Required]Guid? idCollaborateur, [FromRoute][Required]int? idEP)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Récupération de la liste des demandes de délégation</remarks>
/// <param name="idCollaborateur">id collaborateur</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/demandesdelegation/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandesDelegation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeDelegationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetDemandesDelegation([FromRoute][Required]Guid? idCollaborateur)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<DemandeDelegationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"reponse\" : true,\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 1,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}, {\n \"reponse\" : true,\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 1,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<DemandeDelegationDTO>>(exampleJson)
: default(List<DemandeDelegationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Faire une demande de délégation à une autre personne</remarks>
/// <param name="body"></param>
/// <param name="idDemandeDelegation">id demande delegation</param>
/// <response code="200">Réponse demande de délagation envoyée avec succès</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpPut]
[Route("/api/demandesdelegation/{idDemandeDelegation}/repondre")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("RepondreDemandeDelegation")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult RepondreDemandeDelegation([FromBody]CreationDemandeDelegationDTO body, [FromRoute][Required]int? idDemandeDelegation)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
throw new NotImplementedException();
}
}
}

@ -1,282 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class DemandesEPIApiController : ControllerBase
{
/// <summary>
///
/// </summary>
/// <remarks>Annuler la demande d&#x27;EPI</remarks>
/// <param name="idDemandeEPI">id demande EPI</param>
/// <response code="200">demande d&#x27;EPI annulée</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/demandesepi/{idDemandeEPI}/annuler")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("AnnulerDemandeEPI")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult AnnulerDemandeEPI([FromRoute][Required]int? idDemandeEPI)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Lancer la procedure pour un entretien professionnel intermediaire, une demande d&#x27;EPI validée est créé par la même occasion</remarks>
/// <param name="idCollaborateur">id collaborateur</param>
/// <param name="idReferent">id referent</param>
/// <response code="200">Demande d&#x27;EPI créée avec l&#x27;EPI correspondant</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/demandesepi/referent/{idReferent}/demande/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("CreateEPI")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult CreateEPI([FromRoute][Required]Guid? idCollaborateur, [FromRoute][Required]Guid? idReferent)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Demande d&#x27;EPI par un collaborateur</remarks>
/// <param name="idCollaborateur">id collaborateur</param>
/// <response code="200">demande d&#x27;EPI effectuée</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/demandesepi/collaborateur/{idCollaborateur}/demande")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("DemandeEPI")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult DemandeEPI([FromRoute][Required]Guid? idCollaborateur)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Demande d&#x27;EPI et par l&#x27;assistant et création automatique de l&#x27;EPI</remarks>
/// <param name="idCollaborateur">id collaborateur</param>
/// <response code="200">Demande d&#x27;EPI créée avec l&#x27;EPI correspondant</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/demandesepi/demandeassistante/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("DemandeEPIAssistante")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult DemandeEPIAssistante([FromRoute][Required]Guid? idCollaborateur)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Récupération de la liste des précédents EPI d&#x27;un collaborateur</remarks>
/// <param name="idCollaborateur">id collaborateur</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/demandesepi/collaborateur/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetEPICollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeEPIDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetEPICollaborateur([FromRoute][Required]Guid? idCollaborateur)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<DemandeEPIDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"reponse\" : true,\n \"idReferent\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\",\n \"etat\" : 6\n}, {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"reponse\" : true,\n \"idReferent\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\",\n \"etat\" : 6\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<DemandeEPIDTO>>(exampleJson)
: default(List<DemandeEPIDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupération de l&#x27;EPI en cours d&#x27;un collaborateur</remarks>
/// <param name="idCollaborateur">id collaborateur</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/demandesepi/collaborateur/{idCollaborateur}/enCours")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetEPIEnCours")]
[SwaggerResponse(statusCode: 200, type: typeof(DemandeEPIDTO), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetEPIEnCours([FromRoute][Required]Guid? idCollaborateur)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(DemandeEPIDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"reponse\" : true,\n \"idReferent\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\",\n \"etat\" : 6\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<DemandeEPIDTO>(exampleJson)
: default(DemandeEPIDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupération de la liste des précédents EPI d&#x27;un referent</remarks>
/// <param name="idReferent">id referent</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/demandesepi/referent/{idReferent}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetEPIReferent")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeEPIDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetEPIReferent([FromRoute][Required]Guid? idReferent)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<DemandeEPIDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"reponse\" : true,\n \"idReferent\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\",\n \"etat\" : 6\n}, {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"reponse\" : true,\n \"idReferent\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\",\n \"etat\" : 6\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<DemandeEPIDTO>>(exampleJson)
: default(List<DemandeEPIDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Répondre à une demande EPI en attente</remarks>
/// <param name="body"></param>
/// <param name="idDemandeEPI">id demande EPI</param>
/// <response code="200">Réponse à la demande d&#x27;EPI envoyée</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpPut]
[Route("/api/demandesepi/{idDemandeEPI}/repondre")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("RepondreDemandeEPI")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult RepondreDemandeEPI([FromBody]DemandeEPIDTO body, [FromRoute][Required]int? idDemandeEPI)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
throw new NotImplementedException();
}
}
}

@ -1,249 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.2
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class DemandesFormationApiController : ControllerBase
{
/// <summary>
///
/// </summary>
/// <remarks>Créer une demande de formation pour un collaborateur</remarks>
/// <param name="body"></param>
/// <response code="201">Demande formation créée</response>
/// <response code="403">Acces interdit</response>
[HttpPost]
[Route("/api/demandeformation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("CreerDemandeFormation")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult CreerDemandeFormation([FromBody]CreationDemandeFormationDTO body)
{
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des demandes de formations</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="theme">Thème des demandes de formation à récupérer</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/demandeformation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetDemandesFormation([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]string texte, [FromQuery]int? theme, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<DemandeFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"reponse\" : true,\n \"commentaireRefus\" : \"commentaireRefus\",\n \"libelle\" : \"libelle\",\n \"description\" : \"description\",\n \"dateDerniereReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"theme\" : {\n \"id\" : 9,\n \"demandesFormation\" : [ null, null ],\n \"nom\" : \"nom\"\n },\n \"id\" : 7,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"referent\" : {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\",\n \"collaborateurs\" : [ null, null ]\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"demandeRH\" : false,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}, {\n \"reponse\" : true,\n \"commentaireRefus\" : \"commentaireRefus\",\n \"libelle\" : \"libelle\",\n \"description\" : \"description\",\n \"dateDerniereReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"theme\" : {\n \"id\" : 9,\n \"demandesFormation\" : [ null, null ],\n \"nom\" : \"nom\"\n },\n \"id\" : 7,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"referent\" : {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\",\n \"collaborateurs\" : [ null, null ]\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"demandeRH\" : false,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<DemandeFormationDTO>>(exampleJson)
: default(List<DemandeFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des demandes de formations en attente d&#x27;une réponse</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="theme">Thème des demandes de formation à récupérer</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/demandeformation/enattente")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandesFormationEnAttente")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetDemandesFormationEnAttente([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]string texte, [FromQuery]int? theme, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<DemandeFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"reponse\" : true,\n \"commentaireRefus\" : \"commentaireRefus\",\n \"libelle\" : \"libelle\",\n \"description\" : \"description\",\n \"dateDerniereReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"theme\" : {\n \"id\" : 9,\n \"demandesFormation\" : [ null, null ],\n \"nom\" : \"nom\"\n },\n \"id\" : 7,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"referent\" : {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\",\n \"collaborateurs\" : [ null, null ]\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"demandeRH\" : false,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}, {\n \"reponse\" : true,\n \"commentaireRefus\" : \"commentaireRefus\",\n \"libelle\" : \"libelle\",\n \"description\" : \"description\",\n \"dateDerniereReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"theme\" : {\n \"id\" : 9,\n \"demandesFormation\" : [ null, null ],\n \"nom\" : \"nom\"\n },\n \"id\" : 7,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"referent\" : {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\",\n \"collaborateurs\" : [ null, null ]\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"demandeRH\" : false,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<DemandeFormationDTO>>(exampleJson)
: default(List<DemandeFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des demandes de formations ayant reçu une réponse</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="theme">Thème des demandes de formation à récupérer</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/demandeformation/repondus")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandesFormationRepondues")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetDemandesFormationRepondues([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]string texte, [FromQuery]int? theme, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<DemandeFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"reponse\" : true,\n \"commentaireRefus\" : \"commentaireRefus\",\n \"libelle\" : \"libelle\",\n \"description\" : \"description\",\n \"dateDerniereReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"theme\" : {\n \"id\" : 9,\n \"demandesFormation\" : [ null, null ],\n \"nom\" : \"nom\"\n },\n \"id\" : 7,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"referent\" : {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\",\n \"collaborateurs\" : [ null, null ]\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"demandeRH\" : false,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}, {\n \"reponse\" : true,\n \"commentaireRefus\" : \"commentaireRefus\",\n \"libelle\" : \"libelle\",\n \"description\" : \"description\",\n \"dateDerniereReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"theme\" : {\n \"id\" : 9,\n \"demandesFormation\" : [ null, null ],\n \"nom\" : \"nom\"\n },\n \"id\" : 7,\n \"ep\" : {\n \"obligatoire\" : true,\n \"dateDisponibilite\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0.8008281904610115,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : 6,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"referent\" : {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\",\n \"collaborateurs\" : [ null, null ]\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n },\n \"statut\" : 1.4658129805029452\n },\n \"demandeRH\" : false,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<DemandeFormationDTO>>(exampleJson)
: default(List<DemandeFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des origines des demandes de formation</remarks>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/originesdemandesformation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetOriginesDemandesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineDemandeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetOriginesDemandesFormation()
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<OrigineDemandeFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"libelle\" : \"libelle\",\n \"id\" : 0\n}, {\n \"libelle\" : \"libelle\",\n \"id\" : 0\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<OrigineDemandeFormationDTO>>(exampleJson)
: default(List<OrigineDemandeFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des thèmes des demandes de formation</remarks>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/themes")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetThemes")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ThemeDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetThemes()
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<ThemeDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"id\" : 9,\n \"demandesFormation\" : [ null, null ],\n \"nom\" : \"nom\"\n}, {\n \"id\" : 9,\n \"demandesFormation\" : [ null, null ],\n \"nom\" : \"nom\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<ThemeDTO>>(exampleJson)
: default(List<ThemeDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Répondre a une demande de formation et la mettre à jour</remarks>
/// <param name="body"></param>
/// <param name="idDemandeFormation">id demande formation</param>
/// <response code="200">demande formation mise à jour</response>
/// <response code="201">Demande formation créée</response>
/// <response code="403">Acces interdit</response>
[HttpPut]
[Route("/api/demandeformation/{idDemandeFormation}/repondre")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("RepondreDemandeFormation")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult RepondreDemandeFormation([FromBody]DemandeFormationDTO body, [FromRoute][Required]int? idDemandeFormation)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
throw new NotImplementedException();
}
}
}

@ -1,160 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.2
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class EngagementsApiController : ControllerBase
{
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des engagements</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/engagements")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetEngagements")]
[SwaggerResponse(statusCode: 200, type: typeof(List<EngagementDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetEngagements([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<EngagementDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"realisable\" : true,\n \"realise\" : true,\n \"action\" : \"action\",\n \"id\" : 2.027123023002322,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"dispositif\" : \"dispositif\",\n \"modalite\" : \"modalite\",\n \"raisonNonRealisable\" : \"raisonNonRealisable\"\n}, {\n \"realisable\" : true,\n \"realise\" : true,\n \"action\" : \"action\",\n \"id\" : 2.027123023002322,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"dispositif\" : \"dispositif\",\n \"modalite\" : \"modalite\",\n \"raisonNonRealisable\" : \"raisonNonRealisable\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<EngagementDTO>>(exampleJson)
: default(List<EngagementDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des engagements en attente</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/engagements/enattente")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetEngagementsEnAttente")]
[SwaggerResponse(statusCode: 200, type: typeof(List<EngagementDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetEngagementsEnAttente([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<EngagementDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"realisable\" : true,\n \"realise\" : true,\n \"action\" : \"action\",\n \"id\" : 2.027123023002322,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"dispositif\" : \"dispositif\",\n \"modalite\" : \"modalite\",\n \"raisonNonRealisable\" : \"raisonNonRealisable\"\n}, {\n \"realisable\" : true,\n \"realise\" : true,\n \"action\" : \"action\",\n \"id\" : 2.027123023002322,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"dispositif\" : \"dispositif\",\n \"modalite\" : \"modalite\",\n \"raisonNonRealisable\" : \"raisonNonRealisable\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<EngagementDTO>>(exampleJson)
: default(List<EngagementDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des engagements ayant reçu une réponse</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/engagements/repondus")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetEngagementsRepondus")]
[SwaggerResponse(statusCode: 200, type: typeof(List<EngagementDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetEngagementsRepondus([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<EngagementDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"realisable\" : true,\n \"realise\" : true,\n \"action\" : \"action\",\n \"id\" : 2.027123023002322,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"dispositif\" : \"dispositif\",\n \"modalite\" : \"modalite\",\n \"raisonNonRealisable\" : \"raisonNonRealisable\"\n}, {\n \"realisable\" : true,\n \"realise\" : true,\n \"action\" : \"action\",\n \"id\" : 2.027123023002322,\n \"datePrevisionnelle\" : \"2000-01-23T04:56:07.000+00:00\",\n \"dispositif\" : \"dispositif\",\n \"modalite\" : \"modalite\",\n \"raisonNonRealisable\" : \"raisonNonRealisable\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<EngagementDTO>>(exampleJson)
: default(List<EngagementDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Donnez une réponse à un engagement</remarks>
/// <param name="body"></param>
/// <param name="idEngagement">id engagement</param>
/// <response code="200">Engagement mise à jour</response>
/// <response code="403">Acces interdit</response>
[HttpPut]
[Route("/api/engagements/{idEngagement}/repondre")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("RepondreEngagement")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult RepondreEngagement([FromBody]EngagementDTO body, [FromRoute][Required]int? idEngagement)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
throw new NotImplementedException();
}
}
}

File diff suppressed because one or more lines are too long

@ -1,414 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.2
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class FormationsApiController : ControllerBase
{
/// <summary>
///
/// </summary>
/// <remarks>Ajouter une nouvelle formation</remarks>
/// <param name="body"></param>
/// <response code="201">Formation créée avec succès</response>
/// <response code="403">Acces interdit</response>
[HttpPost]
[Route("/api/formations")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("AjouterFormation")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult AjouterFormation([FromBody]FormationDTO body)
{
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Supprimer une formation</remarks>
/// <param name="idFormation">id formation</param>
/// <response code="204">Formation supprimée avec succès</response>
/// <response code="403">Acces interdit</response>
[HttpDelete]
[Route("/api/formations/{idFormation}/supprimer")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("DeleteFormation")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult DeleteFormation([FromRoute][Required]decimal? idFormation)
{
//TODO: Uncomment the next line to return response 204 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(204);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer les formations annulées</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/formations/annulees")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetFormationAnnulees")]
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetFormationAnnulees([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<FormationDetailsDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n}, {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<FormationDetailsDTO>>(exampleJson)
: default(List<FormationDetailsDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer une formation par son id</remarks>
/// <param name="idFormation">id formation</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/formations/{idFormation}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetFormationById")]
[SwaggerResponse(statusCode: 200, type: typeof(FormationDTO), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetFormationById([FromRoute][Required]decimal? idFormation)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(FormationDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"heure\" : 1.4658129805029452,\n \"participantsFormation\" : [ {\n \"date\" : \"2000-01-23T04:56:07.000+00:00\",\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"estEvaluee\" : true,\n \"dateCreation\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 5,\n \"formation\" : \"formation\",\n \"collaborateur\" : \"collaborateur\",\n \"statut\" : \"statut\"\n }, {\n \"date\" : \"2000-01-23T04:56:07.000+00:00\",\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"estEvaluee\" : true,\n \"dateCreation\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 5,\n \"formation\" : \"formation\",\n \"collaborateur\" : \"collaborateur\",\n \"statut\" : \"statut\"\n } ],\n \"organisme\" : \"organisme\",\n \"origine\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"jour\" : 5.962133916683182,\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n }\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<FormationDTO>(exampleJson)
: default(FormationDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer les formations réalisées</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/formations/realisees")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetFormationRealisee")]
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetFormationRealisee([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<FormationDetailsDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n}, {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<FormationDetailsDTO>>(exampleJson)
: default(List<FormationDetailsDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des formations</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="statutFormation">Statut de la formation</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/formations")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetFormations")]
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetFormations([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]int? statutFormation, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<FormationDetailsDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n}, {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<FormationDetailsDTO>>(exampleJson)
: default(List<FormationDetailsDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer les modes de formation</remarks>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/modesFormation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetModesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ModeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetModesFormation()
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<ModeFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n}, {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<ModeFormationDTO>>(exampleJson)
: default(List<ModeFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer les origines de formation</remarks>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/originesFormation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetOriginesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetOriginesFormation()
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<OrigineFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n}, {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<OrigineFormationDTO>>(exampleJson)
: default(List<OrigineFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer les formations plannifié et replannifié</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/formations/prochaines")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetProchainesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetProchainesFormation([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]int? idAgence, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<FormationDetailsDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n}, {\n \"mode\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"dateDebut\" : \"2000-01-23T04:56:07.000+00:00\",\n \"estCertifie\" : true,\n \"id\" : 0,\n \"dateFin\" : \"2000-01-23T04:56:07.000+00:00\",\n \"type\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n },\n \"intitule\" : \"intitule\",\n \"statut\" : {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n },\n \"nbPartitipants\" : 1\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<FormationDetailsDTO>>(exampleJson)
: default(List<FormationDetailsDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer les statuts de formation</remarks>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/statutsFormation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetStatutsFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<StatutFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetStatutsFormation()
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<StatutFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n}, {\n \"libelle\" : \"libelle\",\n \"id\" : 6\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<StatutFormationDTO>>(exampleJson)
: default(List<StatutFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer les types de formation</remarks>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/typesFormation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetTypesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<TypeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetTypesFormation()
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<TypeFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n}, {\n \"libelle\" : \"libelle\",\n \"id\" : 5\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<TypeFormationDTO>>(exampleJson)
: default(List<TypeFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Mettre à jour une formation</remarks>
/// <param name="body"></param>
/// <param name="idFormation">id formation</param>
/// <response code="200">formation mise à jour</response>
/// <response code="201">Formation créée avec succès</response>
/// <response code="403">Acces interdit</response>
[HttpPut]
[Route("/api/formations/{idFormation}/update")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("UpdateFormation")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult UpdateFormation([FromBody]FormationDTO body, [FromRoute][Required]decimal? idFormation)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
throw new NotImplementedException();
}
}
}

@ -1,247 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.2
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class NotesApiController : ControllerBase
{
/// <summary>
///
/// </summary>
/// <remarks>Supprimer une note</remarks>
/// <param name="idNote">id note</param>
/// <response code="204">Note supprimée</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpDelete]
[Route("/api/notes/{idNote}/supprimer")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("DeleteNote")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult DeleteNote([FromRoute][Required]int? idNote)
{
//TODO: Uncomment the next line to return response 204 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(204);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer une note par son id</remarks>
/// <param name="idNote">id note</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/notes/{idNote}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetNoteById")]
[SwaggerResponse(statusCode: 200, type: typeof(DetailsNoteDTO), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetNoteById([FromRoute][Required]int? idNote)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(DetailsNoteDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"idAuteur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateCreation\" : \"2000-01-23T04:56:07.000+00:00\",\n \"dateMiseAjour\" : \"2000-01-23T04:56:07.000+00:00\",\n \"titre\" : \"titre\",\n \"texte\" : \"texte\",\n \"id\" : 0,\n \"collaborateur\" : {\n \"businessUnit\" : {\n \"agence\" : {\n \"bu\" : [ null, null ],\n \"id\" : 6.027456183070403,\n \"nom\" : \"nom\"\n },\n \"id\" : 0.8008281904610115,\n \"nom\" : \"nom\"\n },\n \"referent\" : {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\",\n \"collaborateurs\" : [ null, null ]\n },\n \"mailApside\" : \"\",\n \"dateArrivee\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateDepart\" : \"2000-01-23T04:56:07.000+00:00\",\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n }\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<DetailsNoteDTO>(exampleJson)
: default(DetailsNoteDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer toutes les notes</remarks>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/notes/")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetNotes")]
[SwaggerResponse(statusCode: 200, type: typeof(List<AffichageNoteDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetNotes()
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<AffichageNoteDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateMiseAjour\" : \"2000-01-23T04:56:07.000+00:00\",\n \"titre\" : \"titre\",\n \"id\" : 0,\n \"collaborateur\" : \"collaborateur\"\n}, {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateMiseAjour\" : \"2000-01-23T04:56:07.000+00:00\",\n \"titre\" : \"titre\",\n \"id\" : 0,\n \"collaborateur\" : \"collaborateur\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<AffichageNoteDTO>>(exampleJson)
: default(List<AffichageNoteDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer les notes d&#x27;une personne a écrite</remarks>
/// <param name="idReferent">id referent</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/notes/auteur/{idReferent}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetNotesByAuteur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<AffichageNoteDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetNotesByAuteur([FromRoute][Required]Guid? idReferent)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<AffichageNoteDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateMiseAjour\" : \"2000-01-23T04:56:07.000+00:00\",\n \"titre\" : \"titre\",\n \"id\" : 0,\n \"collaborateur\" : \"collaborateur\"\n}, {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateMiseAjour\" : \"2000-01-23T04:56:07.000+00:00\",\n \"titre\" : \"titre\",\n \"id\" : 0,\n \"collaborateur\" : \"collaborateur\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<AffichageNoteDTO>>(exampleJson)
: default(List<AffichageNoteDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer une note par son id</remarks>
/// <param name="idCollaborateur">id collaborateur</param>
/// <param name="idReferent">id referent</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/notes/auteur/{idReferent}/collaborateur/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetNotesByCollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<AffichageNoteDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetNotesByCollaborateur([FromRoute][Required]Guid? idCollaborateur, [FromRoute][Required]Guid? idReferent)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<AffichageNoteDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateMiseAjour\" : \"2000-01-23T04:56:07.000+00:00\",\n \"titre\" : \"titre\",\n \"id\" : 0,\n \"collaborateur\" : \"collaborateur\"\n}, {\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"dateMiseAjour\" : \"2000-01-23T04:56:07.000+00:00\",\n \"titre\" : \"titre\",\n \"id\" : 0,\n \"collaborateur\" : \"collaborateur\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<AffichageNoteDTO>>(exampleJson)
: default(List<AffichageNoteDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Ajouter une nouvelle note</remarks>
/// <param name="body"></param>
/// <response code="201">Note créée avec succès</response>
/// <response code="403">Acces interdit</response>
[HttpPost]
[Route("/api/notes/nouvellenote")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("NouvelleNote")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult NouvelleNote([FromBody]DetailsNoteDTO body)
{
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Mettre à jour une note</remarks>
/// <param name="body"></param>
/// <param name="idNote">id note</param>
/// <response code="200">Note mise à jour avec succès</response>
/// <response code="201">Note créée avec succès</response>
/// <response code="403">Acces interdit</response>
[HttpPut]
[Route("/api/notes/{idNote}/updateNote")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("UpdateNote")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult UpdateNote([FromBody]DetailsNoteDTO body, [FromRoute][Required]int? idNote)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
throw new NotImplementedException();
}
}
}

@ -1,175 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class ParticipationsFormationsApiController : ControllerBase
{
/// <summary>
///
/// </summary>
/// <remarks>Consulter une évaluation d&#x27;une formation</remarks>
/// <param name="idParticipationFormation">id participation formation</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/evaluations/participationformation/{idParticipationFormation}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("ConsulterEvaluation")]
[SwaggerResponse(statusCode: 200, type: typeof(EvaluationDTO), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult ConsulterEvaluation([FromRoute][Required]decimal? idParticipationFormation)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(EvaluationDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"idParticipation\" : 0,\n \"saisies\" : [ {\n \"note\" : 7,\n \"texte2\" : \"texte2\",\n \"texte\" : \"texte\",\n \"id\" : \"id\",\n \"champ\" : {\n \"typeChamp\" : \"typeChamp\",\n \"ordre\" : 5.025004791520295,\n \"texte\" : \"texte\",\n \"section\" : \"section\",\n \"soussection\" : \"soussection\",\n \"id\" : 4,\n \"typeSaisie\" : \"typeSaisie\"\n },\n \"typeSaisie\" : 6,\n \"niveau\" : 1\n }, {\n \"note\" : 7,\n \"texte2\" : \"texte2\",\n \"texte\" : \"texte\",\n \"id\" : \"id\",\n \"champ\" : {\n \"typeChamp\" : \"typeChamp\",\n \"ordre\" : 5.025004791520295,\n \"texte\" : \"texte\",\n \"section\" : \"section\",\n \"soussection\" : \"soussection\",\n \"id\" : 4,\n \"typeSaisie\" : \"typeSaisie\"\n },\n \"typeSaisie\" : 6,\n \"niveau\" : 1\n } ]\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<EvaluationDTO>(exampleJson)
: default(EvaluationDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Evaluer une formation</remarks>
/// <param name="body"></param>
/// <param name="idParticipationFormation">id participation formation</param>
/// <response code="200">Evaluation envoyée avec succès</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpPut]
[Route("/api/evaluations/participationformation/{idParticipationFormation}/evaluer")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("EvaluerFormation")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult EvaluerFormation([FromBody]EvaluationDTO body, [FromRoute][Required]decimal? idParticipationFormation)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200);
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des formations auxquelles est inscrit le collaborateur</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="idCollaborateur">id collaborateur</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/participationsformation/collaborateur/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetParticipationByCollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ParticipationFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetParticipationByCollaborateur([FromQuery][Required()]bool? asc, [FromRoute][Required]Guid? idCollaborateur, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<ParticipationFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"date\" : \"2000-01-23T04:56:07.000+00:00\",\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"estEvaluee\" : true,\n \"dateCreation\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0,\n \"formation\" : \"formation\",\n \"collaborateur\" : \"collaborateur\",\n \"statut\" : \"statut\"\n}, {\n \"date\" : \"2000-01-23T04:56:07.000+00:00\",\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"estEvaluee\" : true,\n \"dateCreation\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0,\n \"formation\" : \"formation\",\n \"collaborateur\" : \"collaborateur\",\n \"statut\" : \"statut\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<ParticipationFormationDTO>>(exampleJson)
: default(List<ParticipationFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des participants d&#x27;une formation</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="idFormation">id formation</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/participationsformation/formation/{idFormation}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetParticipationByFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ParticipationFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetParticipationByFormation([FromQuery][Required()]bool? asc, [FromRoute][Required]decimal? idFormation, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<ParticipationFormationDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"date\" : \"2000-01-23T04:56:07.000+00:00\",\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"estEvaluee\" : true,\n \"dateCreation\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0,\n \"formation\" : \"formation\",\n \"collaborateur\" : \"collaborateur\",\n \"statut\" : \"statut\"\n}, {\n \"date\" : \"2000-01-23T04:56:07.000+00:00\",\n \"idCollaborateur\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"estEvaluee\" : true,\n \"dateCreation\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 0,\n \"formation\" : \"formation\",\n \"collaborateur\" : \"collaborateur\",\n \"statut\" : \"statut\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<ParticipationFormationDTO>>(exampleJson)
: default(List<ParticipationFormationDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
}
}

@ -1,142 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class ReferentsApiController : ControllerBase
{
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des référents d&#x27;un collaborateur</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="idCollaborateur">id collaborateur</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/referents/collaborateur/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetReferentByCollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ReferentDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetReferentByCollaborateur([FromQuery][Required()]bool? asc, [FromRoute][Required]Guid? idCollaborateur, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<ReferentDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"collaborateur\" : [ null, null ],\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n}, {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"collaborateur\" : [ null, null ],\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<ReferentDTO>>(exampleJson)
: default(List<ReferentDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer un referent par son id</remarks>
/// <param name="idReferent">id referent</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
/// <response code="404">Ressource n&#x27;a pas été trouvée</response>
[HttpGet]
[Route("/api/referents/{idReferent}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetReferentById")]
[SwaggerResponse(statusCode: 200, type: typeof(ReferentDTO), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "Ressource n&#x27;a pas été trouvée")]
public virtual IActionResult GetReferentById([FromRoute][Required]Guid? idReferent)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(ReferentDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"collaborateur\" : [ null, null ],\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<ReferentDTO>(exampleJson)
: default(ReferentDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste de tous les referents</remarks>
/// <param name="asc">Préciser si les données sont dans l&#x27;ordre (true) ou dans l&#x27;ordre inverse (false)</param>
/// <param name="numPage">Numéro de la page du tableau qui affiche les données</param>
/// <param name="parPAge">Nombre d&#x27;éléments affiché sur chaque page du tableau</param>
/// <param name="fonctions">Liste des fonctions des collaborateurs que l&#x27;on veut récupérer</param>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="idBU">id de la business unit à laquelle sont rattachées les données à récupérer</param>
/// <param name="texte">Texte permettant d&#x27;identifier l&#x27;objet rechercher</param>
/// <param name="tri">Colonne du tableau sur lequel le tri s&#x27;effectue</param>
/// <response code="200">OK</response>
/// <response code="403">Acces interdit</response>
[HttpGet]
[Route("/api/referents")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetReferents")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ReferentDTO>), description: "OK")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "Acces interdit")]
public virtual IActionResult GetReferents([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]List<string> fonctions, [FromQuery]int? idAgence, [FromQuery]int? idBU, [FromQuery]string texte, [FromQuery]string tri)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<ReferentDTO>));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"collaborateur\" : [ null, null ],\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n}, {\n \"mailApside\" : \"\",\n \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\",\n \"collaborateur\" : [ null, null ],\n \"nom\" : \"nom\",\n \"prenom\" : \"prenom\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<ReferentDTO>>(exampleJson)
: default(List<ReferentDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
}
}

@ -1,148 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Objet à envoyer lorsqu&#x27;un référent fait une demande de délégation
/// </summary>
[DataContract]
public partial class CreationDemandeDelegationDTO : IEquatable<CreationDemandeDelegationDTO>
{
/// <summary>
/// Gets or Sets IdEp
/// </summary>
[DataMember(Name="idEp")]
public int? IdEp { get; set; }
/// <summary>
/// Gets or Sets IdReferent
/// </summary>
[DataMember(Name="idReferent")]
public CollaborateurDTO IdReferent { get; set; }
/// <summary>
/// Gets or Sets RaisonDemande
/// </summary>
[Required]
[DataMember(Name="raisonDemande")]
public string RaisonDemande { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class CreationDemandeDelegationDTO {\n");
sb.Append(" IdEp: ").Append(IdEp).Append("\n");
sb.Append(" IdReferent: ").Append(IdReferent).Append("\n");
sb.Append(" RaisonDemande: ").Append(RaisonDemande).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((CreationDemandeDelegationDTO)obj);
}
/// <summary>
/// Returns true if CreationDemandeDelegationDTO instances are equal
/// </summary>
/// <param name="other">Instance of CreationDemandeDelegationDTO to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(CreationDemandeDelegationDTO other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return
(
IdEp == other.IdEp ||
IdEp != null &&
IdEp.Equals(other.IdEp)
) &&
(
IdReferent == other.IdReferent ||
IdReferent != null &&
IdReferent.Equals(other.IdReferent)
) &&
(
RaisonDemande == other.RaisonDemande ||
RaisonDemande != null &&
RaisonDemande.Equals(other.RaisonDemande)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
var hashCode = 41;
// Suitable nullity checks etc, of course :)
if (IdEp != null)
hashCode = hashCode * 59 + IdEp.GetHashCode();
if (IdReferent != null)
hashCode = hashCode * 59 + IdReferent.GetHashCode();
if (RaisonDemande != null)
hashCode = hashCode * 59 + RaisonDemande.GetHashCode();
return hashCode;
}
}
#region Operators
#pragma warning disable 1591
public static bool operator ==(CreationDemandeDelegationDTO left, CreationDemandeDelegationDTO right)
{
return Equals(left, right);
}
public static bool operator !=(CreationDemandeDelegationDTO left, CreationDemandeDelegationDTO right)
{
return !Equals(left, right);
}
#pragma warning restore 1591
#endregion Operators
}
}

@ -1,221 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
///
/// </summary>
[DataContract]
public partial class FormationDTOParticipantsFormation : IEquatable<FormationDTOParticipantsFormation>
{
/// <summary>
/// Gets or Sets Id
/// </summary>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
/// <summary>
/// Gets or Sets DateCreation
/// </summary>
[Required]
[DataMember(Name="dateCreation")]
public DateTime? DateCreation { get; set; }
/// <summary>
/// Gets or Sets Formation
/// </summary>
[Required]
[DataMember(Name="formation")]
public string Formation { get; set; }
/// <summary>
/// Gets or Sets Date
/// </summary>
[DataMember(Name="date")]
public DateTime? Date { get; set; }
/// <summary>
/// Gets or Sets Statut
/// </summary>
[DataMember(Name="statut")]
public string Statut { get; set; }
/// <summary>
/// Gets or Sets IdCollaborateur
/// </summary>
[DataMember(Name="idCollaborateur")]
public Guid? IdCollaborateur { get; set; }
/// <summary>
/// Gets or Sets Collaborateur
/// </summary>
[DataMember(Name="collaborateur")]
public string Collaborateur { get; set; }
/// <summary>
/// Gets or Sets EstEvaluee
/// </summary>
[Required]
[DataMember(Name="estEvaluee")]
public bool? EstEvaluee { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class FormationDTOParticipantsFormation {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" DateCreation: ").Append(DateCreation).Append("\n");
sb.Append(" Formation: ").Append(Formation).Append("\n");
sb.Append(" Date: ").Append(Date).Append("\n");
sb.Append(" Statut: ").Append(Statut).Append("\n");
sb.Append(" IdCollaborateur: ").Append(IdCollaborateur).Append("\n");
sb.Append(" Collaborateur: ").Append(Collaborateur).Append("\n");
sb.Append(" EstEvaluee: ").Append(EstEvaluee).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((FormationDTOParticipantsFormation)obj);
}
/// <summary>
/// Returns true if FormationDTOParticipantsFormation instances are equal
/// </summary>
/// <param name="other">Instance of FormationDTOParticipantsFormation to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(FormationDTOParticipantsFormation other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return
(
Id == other.Id ||
Id != null &&
Id.Equals(other.Id)
) &&
(
DateCreation == other.DateCreation ||
DateCreation != null &&
DateCreation.Equals(other.DateCreation)
) &&
(
Formation == other.Formation ||
Formation != null &&
Formation.Equals(other.Formation)
) &&
(
Date == other.Date ||
Date != null &&
Date.Equals(other.Date)
) &&
(
Statut == other.Statut ||
Statut != null &&
Statut.Equals(other.Statut)
) &&
(
IdCollaborateur == other.IdCollaborateur ||
IdCollaborateur != null &&
IdCollaborateur.Equals(other.IdCollaborateur)
) &&
(
Collaborateur == other.Collaborateur ||
Collaborateur != null &&
Collaborateur.Equals(other.Collaborateur)
) &&
(
EstEvaluee == other.EstEvaluee ||
EstEvaluee != null &&
EstEvaluee.Equals(other.EstEvaluee)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
var hashCode = 41;
// Suitable nullity checks etc, of course :)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (DateCreation != null)
hashCode = hashCode * 59 + DateCreation.GetHashCode();
if (Formation != null)
hashCode = hashCode * 59 + Formation.GetHashCode();
if (Date != null)
hashCode = hashCode * 59 + Date.GetHashCode();
if (Statut != null)
hashCode = hashCode * 59 + Statut.GetHashCode();
if (IdCollaborateur != null)
hashCode = hashCode * 59 + IdCollaborateur.GetHashCode();
if (Collaborateur != null)
hashCode = hashCode * 59 + Collaborateur.GetHashCode();
if (EstEvaluee != null)
hashCode = hashCode * 59 + EstEvaluee.GetHashCode();
return hashCode;
}
}
#region Operators
#pragma warning disable 1591
public static bool operator ==(FormationDTOParticipantsFormation left, FormationDTOParticipantsFormation right)
{
return Equals(left, right);
}
public static bool operator !=(FormationDTOParticipantsFormation left, FormationDTOParticipantsFormation right)
{
return !Equals(left, right);
}
#pragma warning restore 1591
#endregion Operators
}
}

@ -1,193 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les informations d&#x27;un collaborateur
/// </summary>
[DataContract]
public partial class ReferentDTO : IEquatable<ReferentDTO>
{
/// <summary>
/// Gets or Sets Id
/// </summary>
[Required]
[DataMember(Name="id")]
public Guid? Id { get; set; }
/// <summary>
/// Gets or Sets Nom
/// </summary>
[Required]
[DataMember(Name="nom")]
public string Nom { get; set; }
/// <summary>
/// Gets or Sets Prenom
/// </summary>
[Required]
[DataMember(Name="prenom")]
public string Prenom { get; set; }
/// <summary>
/// Gets or Sets MailApside
/// </summary>
[Required]
[DataMember(Name="mailApside")]
public string MailApside { get; set; }
/// <summary>
/// Gets or Sets BusinessUnit
/// </summary>
[DataMember(Name="businessUnit")]
public BusinessUnitDTO BusinessUnit { get; set; }
/// <summary>
/// Gets or Sets Collaborateur
/// </summary>
[DataMember(Name="collaborateurs")]
public List<CollaborateurDTO> Collaborateurs { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class ReferentDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Nom: ").Append(Nom).Append("\n");
sb.Append(" Prenom: ").Append(Prenom).Append("\n");
sb.Append(" MailApside: ").Append(MailApside).Append("\n");
sb.Append(" BusinessUnit: ").Append(BusinessUnit).Append("\n");
sb.Append(" Collaborateur: ").Append(Collaborateurs).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((ReferentDTO)obj);
}
/// <summary>
/// Returns true if ReferentDTO instances are equal
/// </summary>
/// <param name="other">Instance of ReferentDTO to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ReferentDTO other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return
(
Id == other.Id ||
Id != null &&
Id.Equals(other.Id)
) &&
(
Nom == other.Nom ||
Nom != null &&
Nom.Equals(other.Nom)
) &&
(
Prenom == other.Prenom ||
Prenom != null &&
Prenom.Equals(other.Prenom)
) &&
(
MailApside == other.MailApside ||
MailApside != null &&
MailApside.Equals(other.MailApside)
) &&
(
BusinessUnit == other.BusinessUnit ||
BusinessUnit != null &&
BusinessUnit.Equals(other.BusinessUnit)
) &&
(
Collaborateurs == other.Collaborateurs ||
Collaborateurs != null &&
Collaborateurs.SequenceEqual(other.Collaborateurs)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
var hashCode = 41;
// Suitable nullity checks etc, of course :)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (Nom != null)
hashCode = hashCode * 59 + Nom.GetHashCode();
if (Prenom != null)
hashCode = hashCode * 59 + Prenom.GetHashCode();
if (MailApside != null)
hashCode = hashCode * 59 + MailApside.GetHashCode();
if (BusinessUnit != null)
hashCode = hashCode * 59 + BusinessUnit.GetHashCode();
if (Collaborateurs != null)
hashCode = hashCode * 59 + Collaborateurs.GetHashCode();
return hashCode;
}
}
#region Operators
#pragma warning disable 1591
public static bool operator ==(ReferentDTO left, ReferentDTO right)
{
return Equals(left, right);
}
public static bool operator !=(ReferentDTO left, ReferentDTO right)
{
return !Equals(left, right);
}
#pragma warning restore 1591
#endregion Operators
}
}

@ -1,150 +0,0 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Thème d&#x27;une demande de formation
/// </summary>
[DataContract]
public partial class ThemeDTO : IEquatable<ThemeDTO>
{
/// <summary>
/// Gets or Sets Id
/// </summary>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
/// <summary>
/// Gets or Sets Nom
/// </summary>
[Required]
[DataMember(Name="nom")]
public string Nom { get; set; }
/// <summary>
/// Gets or Sets DemandesFormation
/// </summary>
[Required]
[DataMember(Name="demandesFormation")]
public List<DemandeFormationDTO> DemandesFormation { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class ThemeDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Nom: ").Append(Nom).Append("\n");
sb.Append(" DemandesFormation: ").Append(DemandesFormation).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((ThemeDTO)obj);
}
/// <summary>
/// Returns true if ThemeDTO instances are equal
/// </summary>
/// <param name="other">Instance of ThemeDTO to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ThemeDTO other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return
(
Id == other.Id ||
Id != null &&
Id.Equals(other.Id)
) &&
(
Nom == other.Nom ||
Nom != null &&
Nom.Equals(other.Nom)
) &&
(
DemandesFormation == other.DemandesFormation ||
DemandesFormation != null &&
DemandesFormation.SequenceEqual(other.DemandesFormation)
);
}
/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
var hashCode = 41;
// Suitable nullity checks etc, of course :)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (Nom != null)
hashCode = hashCode * 59 + Nom.GetHashCode();
if (DemandesFormation != null)
hashCode = hashCode * 59 + DemandesFormation.GetHashCode();
return hashCode;
}
}
#region Operators
#pragma warning disable 1591
public static bool operator ==(ThemeDTO left, ThemeDTO right)
{
return Equals(left, right);
}
public static bool operator !=(ThemeDTO left, ThemeDTO right)
{
return !Equals(left, right);
}
#pragma warning restore 1591
#endregion Operators
}
}

@ -0,0 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0
COPY EPAServeur/bin/Release/net6.0/publish/ App/
WORKDIR /App
ENTRYPOINT ["dotnet", "EPAServeur.dll"]

@ -0,0 +1,98 @@
using EPAServeur.Context;
using EPAServeur.IServices;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.Controllers;
using IO.Swagger.DTO;
using IO.Swagger.Enum;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Controllers
{
[TestFixture]
public class DemandeDelegationApiTests
{
#region Variables
private EpContext context;
private ILogger<DemandesDelegationApiController> logger;
IDemandeDelegationService demandeDelegationService;
private ICollaborateurApi collaborateurApi;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
DataSeeder.AddDemandeDelegationEP(context);
// Ajout du jeu de données pour les tests
//TO DO
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
collaborateurApi = new CollaborateurApi();
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
demandeDelegationService = new DemandeDelegationService(collaborateurService, context, transformDTO);
}
#endregion
#region Tests Api
[Test]
public void GetDemandesDelegationReferent()
{
DemandesDelegationApiController demandesDelegationApiController = new DemandesDelegationApiController(demandeDelegationService, logger);
Task<IActionResult> task = demandesDelegationApiController.GetDemandesDelegationReferent(new Guid("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d"));
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<IEnumerable<DemandeDelegationDTO>>(result.Value);
}
[Test]
public void UpdateDemandeDelegation()
{
DemandesDelegationApiController demandesDelegationApiController = new DemandesDelegationApiController(demandeDelegationService, logger);
DemandeDelegationDTO demandeDTO = new DemandeDelegationDTO()
{
Id = 1,
DateDemande = new DateTime(),
RaisonDemande = "Raison demande",
EtatDemande = EtatDemande.Rejetee,
RaisonRefus = "exemple raison refus"
};
Task<IActionResult> task = demandesDelegationApiController.UpdateDemandeDelegation(demandeDTO, demandeDTO.Id) ;
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<DemandeDelegationDTO>(result.Value);
}
#endregion
}
}

@ -0,0 +1,637 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.Models.Formation;
using EPAServeur.Services;
using IO.Swagger.Controllers;
using IO.Swagger.DTO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using EPAServeur.IServices;
using Moq;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.Enum;
namespace EPAServeur.Tests.Controllers
{
[TestFixture]
public class DemandeFormationApiTests
{
#region Variables
private IDemandeFormationService demandeFormationService;
private Mock<IWebHostEnvironment> mockEnvironment;
private EpContext epContext;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Création d'une collection de services pour l'injection de dépendance
var services = new ServiceCollection();
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
services.AddDbContext<EpContext>(b => b.UseInMemoryDatabase("server_ep_test"));
epContext = new EpContext(optionBuider);
epContext.Database.EnsureDeleted();
epContext.Database.EnsureCreated();
epContext.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddFormations(epContext);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in epContext.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
services.AddScoped<ITransformDTO, TransformDTO>();
services.AddScoped<ICollaborateurApi, CollaborateurApi>();
services.AddScoped<ICollaborateurService, CollaborateurService>();
services.AddScoped<IDemandeFormationService, DemandeFormationService>();
// Récupère le service qui sera utilsé pour tester le contrôleur
var serviceProvider = services.BuildServiceProvider();
demandeFormationService = serviceProvider.GetService<IDemandeFormationService>();
// Simule l'interface IWebHostEnvironment avec Moq
mockEnvironment = new Mock<IWebHostEnvironment>();
mockEnvironment
.Setup(m => m.EnvironmentName)
.Returns("Development");
}
#endregion
#region Tests GetDemandesFormation
[Test]
public void GetDemandesFormation_PasseDesParamsPresentsDansLaBDD_RetourneUnObjetOkResult()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
// Act
var okResult = DemandesFormationApiController.GetDemandesFormation(null, null, null, null, null, null, null, null, null, null);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetDemandesFormation_PasseDesParamsPresentsDansLaBDD_RetourneLesCinqPremieresDemandesDeFormations()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
int nbDemandeFormation = 5;
int idFirstDemandeFormation = 1;
int idLastDemandeFormation = 3;
// Act
var okResult = DemandesFormationApiController.GetDemandesFormation(null, null, null, null, 1, 5, null, null, null, null).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<IEnumerable<DemandeFormationDTO>>(okResult.Value);
Assert.AreEqual(nbDemandeFormation, (okResult.Value as IEnumerable<DemandeFormationDTO>).Count());
Assert.AreEqual(idFirstDemandeFormation, (okResult.Value as IEnumerable<DemandeFormationDTO>).First().Id);
Assert.AreEqual(idLastDemandeFormation, (okResult.Value as IEnumerable<DemandeFormationDTO>).Last().Id);
}
#endregion
#region Tests GetDemandesFormationCount
[Test]
public void GetDemandesFormationCount_PasseDesParamsPresentsDansLaBDD_RetourneUnObjetOkResult()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
// Act
var okResult = DemandesFormationApiController.GetDemandesFormationCount(null, null, null, null, null, null);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetDemandesFormationCount_PasseDesParamsPresentsDansLaBDD_RetourneLeBonNombreDeDemandeDeFormation()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
int nbDemandeFormation = 12;
// Act
var okResult = DemandesFormationApiController.GetDemandesFormationCount(null, null, null, null, null, null).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<long>(okResult.Value);
Assert.AreEqual(nbDemandeFormation, (long)okResult.Value);
}
#endregion
#region Tests GetOriginesDemandeFormation
[Test]
public void GetOriginesDemandeFormation_RetourneUnObjetOkResult()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
// Act
var okResult = DemandesFormationApiController.GetOriginesDemandeFormation();
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetOriginesDemandeFormation_RetourneToutesLesOriginesDeDemande()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
int nbOrigineDemande = 5;
// Act
var okResult = DemandesFormationApiController.GetOriginesDemandeFormation().Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<IEnumerable<OrigineDemandeFormationDTO>>(okResult.Value);
Assert.AreEqual(nbOrigineDemande, (okResult.Value as IEnumerable<OrigineDemandeFormationDTO>).Count());
}
#endregion
#region Tests AddDemandeFormation
[Test]
public void AddDemandeFormation_AjouteUneDemandeDeFormationAvecUnCollaborateurNull_RetourneUnObjetObjectResult()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
OrigineDemandeFormationDTO origineDemandeFormationApside = new OrigineDemandeFormationDTO { Id = 5, Libelle = "Demande Apside" };
List<BusinessUnitDTO> Bus = new List<BusinessUnitDTO>() {
new BusinessUnitDTO { Id = 1, Nom = "Tours" },
new BusinessUnitDTO { Id = 2, Nom = "Orléans" },
};
CollaborateurDTO collaborateur = null;
DemandeFormationDTO demandeFormation = new DemandeFormationDTO
{
Libelle = "Formation React",
Description = "Demande de formation React avec Redux",
DemandeRH = true,
DateDemande = DateTime.Now,
EtatDemande = EtatDemande.EnAttente,
Origine = origineDemandeFormationApside,
Collaborateur = collaborateur,
};
// Act
var objectResult = DemandesFormationApiController.AddDemandeFormation(demandeFormation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public void AddDemandeFormation_AjouteUneDemandeDeFormationValide_RetourneUnObjetCreatedResult()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
OrigineDemandeFormationDTO origineDemandeFormationApside = new OrigineDemandeFormationDTO { Id = 5, Libelle = "Demande Apside" };
List<BusinessUnitDTO> Bus = new List<BusinessUnitDTO>() {
new BusinessUnitDTO { Id = 1, Nom = "Tours" },
new BusinessUnitDTO { Id = 2, Nom = "Orléans" },
};
CollaborateurDTO collaborateur = new CollaborateurDTO
{
Id = Guid.Parse("842650db-a548-4472-a3af-4c5fff3c1ab8"),
BusinessUnit = new BusinessUnitDTO { Id = 2, Nom = "Orléans", Agence = new AgenceDTO { Id = 1, Nom = "TOP", Bu = Bus } },
Nom = "Lemoine",
Prenom = "Coty",
MailApside = "coty.lemoine@apside-groupe.com",
DateArrivee = new DateTime(2017, 2, 10, 20, 37, 58, 741),
DateDepart = null,
};
DemandeFormationDTO demandeFormation = new DemandeFormationDTO
{
Libelle = "Formation React",
Description = "Demande de formation React avec Redux",
DemandeRH = true,
DateDemande = DateTime.Now,
EtatDemande = EtatDemande.EnAttente,
Origine = origineDemandeFormationApside,
Collaborateur = collaborateur,
};
// Act
var createdResult = DemandesFormationApiController.AddDemandeFormation(demandeFormation);
// Assert
Assert.IsInstanceOf<CreatedResult>(createdResult.Result);
}
[Test]
public void AddDemandeFormation_AjouteUneDemandeDeFormationValide_RetourneLaDemandeDeFormationCreee()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
OrigineDemandeFormationDTO origineDemandeFormationApside = new OrigineDemandeFormationDTO { Id = 5, Libelle = "Demande Apside" };
List<BusinessUnitDTO> Bus = new List<BusinessUnitDTO>() {
new BusinessUnitDTO { Id = 1, Nom = "Tours" },
new BusinessUnitDTO { Id = 2, Nom = "Orléans" },
};
CollaborateurDTO collaborateur = new CollaborateurDTO
{
Id = Guid.Parse("842650db-a548-4472-a3af-4c5fff3c1ab8"),
BusinessUnit = new BusinessUnitDTO { Id = 2, Nom = "Orléans", Agence = new AgenceDTO { Id = 1, Nom = "TOP", Bu = Bus } },
Nom = "Lemoine",
Prenom = "Coty",
MailApside = "coty.lemoine@apside-groupe.com",
DateArrivee = new DateTime(2017, 2, 10, 20, 37, 58, 741),
DateDepart = null,
};
DemandeFormationDTO demandeFormation = new DemandeFormationDTO
{
Libelle = "Formation React",
Description = "Demande de formation React avec Redux",
DemandeRH = true,
DateDemande = DateTime.Now,
EtatDemande = EtatDemande.EnAttente,
Origine = origineDemandeFormationApside,
Collaborateur = collaborateur,
};
// Act
var createdResult = DemandesFormationApiController.AddDemandeFormation(demandeFormation).Result as CreatedResult;
// Assert
Assert.IsInstanceOf<DemandeFormationDTO>(createdResult.Value);
Assert.AreEqual("Formation React", (createdResult.Value as DemandeFormationDTO).Libelle);
}
#endregion
#region Tests UpdateDemandeFormation
[Test]
public async Task UpdateDemandeFormation_AccepteUneDemandeAvecUneFormationNull_RetourneUnObjetObjectResultDansCatchDemandeFormationInvalidException()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
long idDemandeFormation = 3;
OrigineDemandeFormationDTO origineDemandeFormationClient = new OrigineDemandeFormationDTO { Id = 3, Libelle = "Exigence Client" };
List<BusinessUnitDTO> Bus = new List<BusinessUnitDTO>() {
new BusinessUnitDTO { Id = 1, Nom = "Tours" },
new BusinessUnitDTO { Id = 2, Nom = "Orléans" },
};
CollaborateurDTO collaborateur = new CollaborateurDTO
{
Id = Guid.Parse("a0f40e2a-cc03-4032-a627-5389e1281c64"),
BusinessUnit = new BusinessUnitDTO { Id = 2, Nom = "Orléans", Agence = new AgenceDTO { Id = 1, Nom = "TOP", Bu = Bus } },
Nom = "Vasseur",
Prenom = "Florencio",
MailApside = "florencio.vasseur@apside-groupe.com",
DateArrivee = new DateTime(2016, 1, 15, 10, 22, 30, 778),
DateDepart = null,
};
FormationDetailsDTO formation = null;
DemandeFormationDTO demandeFormation = new DemandeFormationDTO
{
Id = idDemandeFormation,
Libelle = "Formation C#",
Description = "Demande de formation C# avec WPF",
DemandeRH = false,
DateDemande = new DateTime(2020, 3, 22, 9, 0, 0),
EtatDemande = EtatDemande.Validee,
Origine = origineDemandeFormationClient,
Collaborateur = collaborateur,
Formation = formation,
};
// Act
var objectResult = DemandesFormationApiController.UpdateDemandeFormation(demandeFormation, idDemandeFormation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public async Task UpdateDemandeFormation_AccepteUneDemandeAvecUnIdDemandeFormationNull_RetourneUnObjetObjectResultDansCatchDemandeFormationIncompatibleIdException()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
long idDemandeFormation = 1;
long? idDemandeFormationIncorrecte = null;
int nbParticipant = 1;
OrigineDemandeFormationDTO origineDemandeFormationClient = new OrigineDemandeFormationDTO { Id = 3, Libelle = "Exigence Client" };
List<BusinessUnitDTO> Bus = new List<BusinessUnitDTO>() {
new BusinessUnitDTO { Id = 1, Nom = "Tours" },
new BusinessUnitDTO { Id = 2, Nom = "Orléans" },
};
CollaborateurDTO collaborateur = new CollaborateurDTO
{
Id = Guid.Parse("a0f40e2a-cc03-4032-a627-5389e1281c64"),
BusinessUnit = new BusinessUnitDTO { Id = 2, Nom = "Orléans", Agence = new AgenceDTO { Id = 1, Nom = "TOP", Bu = Bus } },
Nom = "Vasseur",
Prenom = "Florencio",
MailApside = "florencio.vasseur@apside-groupe.com",
DateArrivee = new DateTime(2016, 1, 15, 10, 22, 30, 778),
DateDepart = null,
};
FormationDetailsDTO formation = new FormationDetailsDTO
{
Id = 3,
Intitule = "Apprendre C# et le développement de logiciels avec WPF",
DateDebut = new DateTime(2020, 5, 25, 14, 0, 0),
DateFin = new DateTime(2020, 5, 27),
Organisme = "Organisme2",
Origine = new OrigineFormationDTO { Id = 3, Libelle = "Exigence Apside" },
Statut = new StatutFormationDTO { Id = 1, Libelle = "Planifiée" },
EstCertifiee = true,
NbParticipations = nbParticipant
};
DemandeFormationDTO demandeFormation = new DemandeFormationDTO
{
Id = idDemandeFormationIncorrecte,
Libelle = "Formation C#",
Description = "Demande de formation C# avec WPF",
DemandeRH = false,
DateDemande = new DateTime(2020, 3, 22, 9, 0, 0),
EtatDemande = EtatDemande.Validee,
Origine = origineDemandeFormationClient,
Collaborateur = collaborateur,
Formation = formation,
};
// Act
var objectResult = DemandesFormationApiController.UpdateDemandeFormation(demandeFormation, idDemandeFormation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public async Task UpdateDemandeFormation_AccepteUneDemandeInexistante_RetourneUnObjetObjectResultDansCatchDemandeFormationNotFoundExceptionn()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
long idDemandeFormation = 0;
int nbParticipant = 1;
OrigineDemandeFormationDTO origineDemandeFormationClient = new OrigineDemandeFormationDTO { Id = 3, Libelle = "Exigence Client" };
List<BusinessUnitDTO> Bus = new List<BusinessUnitDTO>() {
new BusinessUnitDTO { Id = 1, Nom = "Tours" },
new BusinessUnitDTO { Id = 2, Nom = "Orléans" },
};
CollaborateurDTO collaborateur = new CollaborateurDTO
{
Id = Guid.Parse("a0f40e2a-cc03-4032-a627-5389e1281c64"),
BusinessUnit = new BusinessUnitDTO { Id = 2, Nom = "Orléans", Agence = new AgenceDTO { Id = 1, Nom = "TOP", Bu = Bus } },
Nom = "Vasseur",
Prenom = "Florencio",
MailApside = "florencio.vasseur@apside-groupe.com",
DateArrivee = new DateTime(2016, 1, 15, 10, 22, 30, 778),
DateDepart = null,
};
FormationDetailsDTO formation = new FormationDetailsDTO
{
Id = 3,
Intitule = "Apprendre C# et le développement de logiciels avec WPF",
DateDebut = new DateTime(2020, 5, 25, 14, 0, 0),
DateFin = new DateTime(2020, 5, 27),
Organisme = "Organisme2",
Origine = new OrigineFormationDTO { Id = 3, Libelle = "Exigence Apside" },
Statut = new StatutFormationDTO { Id = 1, Libelle = "Planifiée" },
EstCertifiee = true,
NbParticipations = nbParticipant
};
DemandeFormationDTO demandeFormation = new DemandeFormationDTO
{
Id = idDemandeFormation,
Libelle = "Formation C#",
Description = "Demande de formation C# avec WPF",
DemandeRH = false,
DateDemande = new DateTime(2020, 3, 22, 9, 0, 0),
EtatDemande = EtatDemande.Validee,
Origine = origineDemandeFormationClient,
Collaborateur = collaborateur,
Formation = formation,
};
// Act
var objectResult = DemandesFormationApiController.UpdateDemandeFormation(demandeFormation, idDemandeFormation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public async Task UpdateDemandeFormation_AccepteUneDemandeDeDemandeFormation_RetourneUnObjetOkObjectResult()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
long idDemandeFormation = 1;
int nbParticipant = 0;
OrigineDemandeFormationDTO origineDemandeFormationApside = new OrigineDemandeFormationDTO { Id = 5, Libelle = "Demande Apside" };
List<BusinessUnitDTO> Bus = new List<BusinessUnitDTO>() {
new BusinessUnitDTO { Id = 1, Nom = "Tours" },
new BusinessUnitDTO { Id = 2, Nom = "Orléans" },
};
CollaborateurDTO collaborateur = new CollaborateurDTO
{
Id = Guid.Parse("842650db-a548-4472-a3af-4c5fff3c1ab8"),
BusinessUnit = new BusinessUnitDTO { Id = 2, Nom = "Orléans", Agence = new AgenceDTO { Id = 1, Nom = "TOP", Bu = Bus } },
Nom = "Lemoine",
Prenom = "Coty",
MailApside = "coty.lemoine@apside-groupe.com",
DateArrivee = new DateTime(2017, 2, 10, 20, 37, 58, 741),
DateDepart = null,
};
FormationDetailsDTO formation = new FormationDetailsDTO
{
Id = 1,
Intitule = "Formation Mainframe Complète",
DateDebut = new DateTime(2020, 1, 25, 10, 0, 0),
DateFin = new DateTime(2020, 1, 27),
Organisme = "Organisme1",
Origine = new OrigineFormationDTO { Id = 2, Libelle = "Exigence client" },
Statut = new StatutFormationDTO { Id = 1, Libelle = "Planifiée" },
EstCertifiee = false,
NbParticipations = nbParticipant
};
DemandeFormationDTO demandeFormation = new DemandeFormationDTO
{
Id = idDemandeFormation,
Libelle = "Formation Cobol",
Description = "Demande de formation Cobol avec Mainframe",
DemandeRH = false,
DateDemande = new DateTime(2020, 1, 22, 9, 0, 0),
EtatDemande = EtatDemande.Validee,
Origine = origineDemandeFormationApside,
Collaborateur = collaborateur,
Formation = formation,
};
// Act
var okObjectResult = DemandesFormationApiController.UpdateDemandeFormation(demandeFormation, idDemandeFormation);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okObjectResult.Result);
}
[Test]
public async Task UpdateDemandeFormation_AccepteUneDemandeDeDemandeFormation_RetourneLaDemandeDeFormationAcceptee()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
long idDemandeFormation = 1;
int nbParticipant = 0;
OrigineDemandeFormationDTO origineDemandeFormationApside = new OrigineDemandeFormationDTO { Id = 5, Libelle = "Demande Apside" };
List<BusinessUnitDTO> Bus = new List<BusinessUnitDTO>() {
new BusinessUnitDTO { Id = 1, Nom = "Tours" },
new BusinessUnitDTO { Id = 2, Nom = "Orléans" },
};
CollaborateurDTO collaborateur = new CollaborateurDTO
{
Id = Guid.Parse("842650db-a548-4472-a3af-4c5fff3c1ab8"),
BusinessUnit = new BusinessUnitDTO { Id = 2, Nom = "Orléans", Agence = new AgenceDTO { Id = 1, Nom = "TOP", Bu = Bus } },
Nom = "Lemoine",
Prenom = "Coty",
MailApside = "coty.lemoine@apside-groupe.com",
DateArrivee = new DateTime(2017, 2, 10, 20, 37, 58, 741),
DateDepart = null,
};
FormationDetailsDTO formation = new FormationDetailsDTO
{
Id = 1,
Intitule = "Formation Mainframe Complète",
DateDebut = new DateTime(2020, 1, 25, 10, 0, 0),
DateFin = new DateTime(2020, 1, 27),
Organisme = "Organisme1",
Origine = new OrigineFormationDTO { Id = 2, Libelle = "Exigence client" },
Statut = new StatutFormationDTO { Id = 1, Libelle = "Planifiée" },
EstCertifiee = false,
NbParticipations = nbParticipant
};
DemandeFormationDTO demandeFormation = new DemandeFormationDTO
{
Id = idDemandeFormation,
Libelle = "Formation Cobol",
Description = "Demande de formation Cobol avec Mainframe",
DemandeRH = false,
DateDemande = new DateTime(2020, 1, 22, 9, 0, 0),
EtatDemande = EtatDemande.Validee,
Origine = origineDemandeFormationApside,
Collaborateur = collaborateur,
Formation = formation,
};
// Act
var okObjectResult = DemandesFormationApiController.UpdateDemandeFormation(demandeFormation, idDemandeFormation).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<DemandeFormationDTO>(okObjectResult.Value);
Assert.AreEqual("Formation Cobol", (okObjectResult.Value as DemandeFormationDTO).Libelle);
}
#endregion
#region Tests DeleteDemandeFormation
[Test]
public void DeleteDemandeFormation_SupprimeUneDemandeDeFormationInexistante_RetourneUnObjetNotFoundObjectResult()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
long idDemandeFormation = 0;
// Act
var notFoundObjectResult = DemandesFormationApiController.DeleteDemandeFormation(idDemandeFormation);
// Assert
Assert.IsInstanceOf<NotFoundObjectResult>(notFoundObjectResult.Result);
}
[Test]
public void DeleteDemandeFormation_SupprimeUneDemandeDeFormationConcernantUnEpSigne_RetourneUnObjetObjectResultDansCatchDemandeFormationInvalidException()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
long idDemandeFormation = 2;
// Act
var objectResult = DemandesFormationApiController.DeleteDemandeFormation(idDemandeFormation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public void DeleteDemandeFormation_SupprimeUneDemandeDeFormation_RetourneUnObjetNoContentResult()
{
// Arrange
DemandesFormationApiController DemandesFormationApiController = new DemandesFormationApiController(demandeFormationService, new NullLogger<DemandesFormationApiController>(), mockEnvironment.Object);
long idDemandeFormation = 5;
// Act
var noContentResult = DemandesFormationApiController.DeleteDemandeFormation(idDemandeFormation);
// Assert
Assert.IsInstanceOf<NoContentResult>(noContentResult.Result);
}
#endregion
}
}

@ -0,0 +1,341 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.Models.Formation;
using EPAServeur.Services;
using IO.Swagger.Controllers;
using IO.Swagger.DTO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using EPAServeur.IServices;
using Moq;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.Enum;
namespace EPAServeur.Tests.Controllers
{
[TestFixture]
public class EngagementsApiTests
{
#region Variables
private IEngagementService engagementService;
private Mock<IWebHostEnvironment> mockEnvironment;
private EpContext epContext;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Création d'une collection de services pour l'injection de dépendance
var services = new ServiceCollection();
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
services.AddDbContext<EpContext>(b => b.UseInMemoryDatabase("server_ep_test"));
epContext = new EpContext(optionBuider);
epContext.Database.EnsureDeleted();
epContext.Database.EnsureCreated();
epContext.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddEngagements(epContext);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in epContext.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
services.AddScoped<ITransformDTO, TransformDTO>();
services.AddScoped<ICollaborateurApi, CollaborateurApi>();
services.AddScoped<ICollaborateurService, CollaborateurService>();
services.AddScoped<IEngagementService, EngagementService>();
// Récupère le service qui sera utilsé pour tester le contrôleur
var serviceProvider = services.BuildServiceProvider();
engagementService = serviceProvider.GetService<IEngagementService>();
// Simule l'interface IWebHostEnvironment avec Moq
mockEnvironment = new Mock<IWebHostEnvironment>();
mockEnvironment
.Setup(m => m.EnvironmentName)
.Returns("Development");
}
#endregion
#region Tests GetEngagements
[Test]
public void GetEngagements_PasseDesParamsPresentsDansLaBDD_RetourneUnObjetOkResult()
{
// Arrange
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
List<long> idBUs = new List<long> { 1, 2 };
// Act
var okResult = engagementsApiController.GetEngagements(idBUs, null, true, 1, 5, null, null);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetEngagements_PasseDesParamsPresentsDansLaBDD_RetourneLesCinqPremiersEngagements()
{
// Arrange
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
List<long> idBUs = new List<long> { 1, 2 };
int nbEngagement = 5;
int idFirstEngagement = 8;
int idLastEngagement = 4;
// Act
var okResult = engagementsApiController.GetEngagements(idBUs, null, true, 1, 5, null, null).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<IEnumerable<EngagementDTO>>(okResult.Value);
Assert.AreEqual(nbEngagement, (okResult.Value as IEnumerable<EngagementDTO>).Count());
Assert.AreEqual(idFirstEngagement, (okResult.Value as IEnumerable<EngagementDTO>).First().Id);
Assert.AreEqual(idLastEngagement, (okResult.Value as IEnumerable<EngagementDTO>).Last().Id);
}
#endregion
#region Tests GetEngagementsCount
[Test]
public void GetEngagementsCount_PasseDesParamsPresentsDansLaBDD_RetourneUnObjetOkResult()
{
// Arrange
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
List<long> idBUs = new List<long> { 1, 2 };
// Act
var okResult = engagementsApiController.GetEngagementsCount(idBUs, null, null);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetEngagementsCount_PasseDesParamsPresentsDansLaBDD_RetourneLeBonNombreDEngagement()
{
// Arrange
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
List<long> idBUs = new List<long> { 1, 2 };
int nbEngagement = 12;
// Act
var okResult = engagementsApiController.GetEngagementsCount(idBUs, null, null).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<long>(okResult.Value);
Assert.AreEqual(nbEngagement, (long)okResult.Value);
}
#endregion
#region Tests UpdateEngagement
[Test]
public void UpdateEngagement_ModifieUnEngagementAvecUnEPInvalide_RetourneUnObjetObjectResultDansCatchEngagementInvalidException()
{
// Arrange
long idEngagement = 1;
EtatEngagement reponse = EtatEngagement.Respecte;
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
EpInformationDTO epInformationDTO = null;
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagement,
Action = "Je m'engage à trouver une formation sur l'Asp.Net Core.",
Dispositif = "Demande de formation RH.",
Modalite = "Sur temps de travail",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = reponse,
Ep = epInformationDTO
};
// Act
var objectResult = engagementsApiController.UpdateEngagement(engagementDTO, idEngagement);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public void UpdateEngagement_ModifieUnEngagementAvecUnIdEngagementInvalide_RetourneUnObjetObjectResultDansCatchEngagementIncompatibleIdException()
{
// Arrange
long idEngagement = 1;
long idEngagementIncorrecte = 2;
long idEp = 9;
EtatEngagement reponse = EtatEngagement.Respecte;
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
EpInformationDTO epInformationDTO = epContext.Ep.Where(ep => ep.IdEP == idEp)
.Select(ep => new EpInformationDTO
{
Id = ep.IdEP,
Type = ep.TypeEP,
Statut = ep.Statut,
DateDisponibilite = ep.DateDisponibilite,
DatePrevisionnelle = ep.DatePrevisionnelle,
Obligatoire = ep.Obligatoire
}).FirstOrDefault();
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagementIncorrecte,
Action = "Je m'engage à trouver une formation sur l'Asp.Net Core.",
Dispositif = "Demande de formation RH.",
Modalite = "Sur temps de travail",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = reponse,
Ep = epInformationDTO
};
// Act
var objectResult = engagementsApiController.UpdateEngagement(engagementDTO, idEngagement);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public void UpdateEngagement_ModifieUnEngagementInexistant_RetourneUnObjetObjectResultDansCatchEngagementNotFoundExceptionn()
{
// Arrange
long idEngagementInexistant = 999;
long idEp = 9;
EtatEngagement reponse = EtatEngagement.Respecte;
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
EpInformationDTO epInformationDTO = epContext.Ep.Where(ep => ep.IdEP == idEp)
.Select(ep => new EpInformationDTO
{
Id = ep.IdEP,
Type = ep.TypeEP,
Statut = ep.Statut,
DateDisponibilite = ep.DateDisponibilite,
DatePrevisionnelle = ep.DatePrevisionnelle,
Obligatoire = ep.Obligatoire
}).FirstOrDefault();
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagementInexistant,
Action = "Toto.",
Dispositif = "Tata.",
Modalite = "Titi",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = reponse,
Ep = epInformationDTO
};
// Act
var objectResult = engagementsApiController.UpdateEngagement(engagementDTO, idEngagementInexistant);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public void UpdateEngagement_ModifieUnEngagementValide_RetourneUnObjetOkObjectResult()
{
// Arrange
long idEngagement = 1;
long idEp = 9;
EtatEngagement reponse = EtatEngagement.Respecte;
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
EpInformationDTO epInformationDTO = epContext.Ep.Where(ep => ep.IdEP == idEp)
.Select(ep => new EpInformationDTO
{
Id = ep.IdEP,
Type = ep.TypeEP,
Statut = ep.Statut,
DateDisponibilite = ep.DateDisponibilite,
DatePrevisionnelle = ep.DatePrevisionnelle,
Obligatoire = ep.Obligatoire
}).FirstOrDefault();
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagement,
Action = "Je m'engage à trouver une formation sur l'Asp.Net Core.",
Dispositif = "Demande de formation RH.",
Modalite = "Sur temps de travail",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = reponse,
Ep = epInformationDTO
};
// Act
var okObjectResult = engagementsApiController.UpdateEngagement(engagementDTO, idEngagement);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okObjectResult.Result);
}
[Test]
public void UpdateEngagement_ModifieUnEngagementValide_RetourneLEngagementModifie()
{
// Arrange
long idEngagement = 1;
long idEp = 9;
EtatEngagement reponse = EtatEngagement.Respecte;
EngagementsApiController engagementsApiController = new EngagementsApiController(engagementService, new NullLogger<EngagementsApiController>(), mockEnvironment.Object);
EpInformationDTO epInformationDTO = epContext.Ep.Where(ep => ep.IdEP == idEp)
.Select(ep => new EpInformationDTO
{
Id = ep.IdEP,
Type = ep.TypeEP,
Statut = ep.Statut,
DateDisponibilite = ep.DateDisponibilite,
DatePrevisionnelle = ep.DatePrevisionnelle,
Obligatoire = ep.Obligatoire
}).FirstOrDefault();
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagement,
Action = "Je m'engage à trouver une formation sur l'Asp.Net Core.",
Dispositif = "Demande de formation RH.",
Modalite = "Sur temps de travail",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = reponse,
Ep = epInformationDTO
};
// Act
var okObjectResult = engagementsApiController.UpdateEngagement(engagementDTO, idEngagement).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<EngagementDTO>(okObjectResult.Value);
Assert.AreEqual(reponse, (okObjectResult.Value as EngagementDTO).EtatEngagement);
}
#endregion
}
}

@ -0,0 +1,162 @@
using EPAServeur.Context;
using EPAServeur.IServices;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.Controllers;
using IO.Swagger.DTO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Controllers
{
[TestFixture]
public class EpInformationApiTests
{
#region
private EpContext context;
private ICollaborateurService collaborateurService;
private IEpInformationService epInformationService;
private ILogger<EpApiController> logger;
private ITransformDTO transformDTO;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddEp(context);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(new CollaborateurApi(), context, transformDTO);
epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
}
#endregion
[Test]
public async Task GetEpEnCours()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetEPEnCours(new List<long?>() { 1, 2 }, true, 1, 15, "", true, "", null, null);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<IEnumerable<EpInformationDTO>>(result.Value);
}
[Test]
public async Task GetEpEnCoursCount()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetEPEnCoursCount(new List<long?>() { 1, 2 }, "", true, null, null);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<int>(result.Value);
}
[Test]
public async Task GetEpEnSignes()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetEPSignes(new List<long?>() { 1, 2 }, true, 1, 15, "", "", null, null);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<IEnumerable<EpInformationDTO>>(result.Value);
}
[Test]
public async Task GetEpEnSignesCount()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetEPSignesCount(new List<long?>() { 1, 2 }, "", null, null);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<int>(result.Value);
}
[Test]
public async Task GetEPSignesCollaborateur()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetEPSignesCollaborateur(new Guid("a0f40e2a-cc03-4032-a627-5389e1281c64"));
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<IEnumerable<EpInformationDTO>>(result.Value);
}
[Test]
public async Task GetProchainEPCollaborateur()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetProchainEPCollaborateur(new Guid("a0f40e2a-cc03-4032-a627-5389e1281c64"));
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<EpInformationDTO>(result.Value);
}
[Test]
public async Task GetEPSignesReferent()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetEPSignesReferent(new Guid("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d"), true, 1, 15, "", "", null, null);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<IEnumerable<EpInformationDTO>>(result.Value);
}
[Test]
public async Task GetEPSignesReferentCount()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetEPSignesReferentCount(new Guid("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d"), "", null, null);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<int>(result.Value);
}
[Test]
public async Task GetEPEnCoursReferent()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetEPEnCoursReferent(new Guid("eb8b0f33-f529-4985-861e-1207f3312bb5"), true, 1, 15, "", "", null, null);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<IEnumerable<EpInformationDTO>>(result.Value);
}
[Test]
public async Task GetEPEnCoursReferentCount()
{
EpApiController epApiController = new EpApiController(epInformationService, logger, null);
Task<IActionResult> task = epApiController.GetEPEnCoursReferentCount(new Guid("eb8b0f33-f529-4985-861e-1207f3312bb5"), "", null, null);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<int>(result.Value);
}
}
}

@ -0,0 +1,607 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.Models.Formation;
using EPAServeur.Services;
using IO.Swagger.Controllers;
using IO.Swagger.DTO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using EPAServeur.IServices;
using Moq;
using IO.Swagger.ApiCollaborateur;
namespace EPAServeur.Tests.Controllers
{
[TestFixture]
public class FormationApiTests
{
#region Variables
private IFormationService formationService;
private Mock<IWebHostEnvironment> mockEnvironment;
private EpContext epContext;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Création d'une collection de services pour l'injection de dépendance
var services = new ServiceCollection();
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
services.AddDbContext<EpContext>(b => b.UseInMemoryDatabase("server_ep_test"));
epContext = new EpContext(optionBuider);
epContext.Database.EnsureDeleted();
epContext.Database.EnsureCreated();
epContext.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddFormations(epContext);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in epContext.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
services.AddScoped<ITransformDTO, TransformDTO>();
services.AddScoped<ICollaborateurApi, CollaborateurApi>();
services.AddScoped<ICollaborateurService, CollaborateurService>();
services.AddScoped<IFormationService, FormationService>();
// Récupère le service qui sera utilsé pour tester le contrôleur
var serviceProvider = services.BuildServiceProvider();
formationService = serviceProvider.GetService<IFormationService>();
// Simule l'interface IWebHostEnvironment avec Moq
mockEnvironment = new Mock<IWebHostEnvironment>();
mockEnvironment
.Setup(m => m.EnvironmentName)
.Returns("Development");
}
#endregion
#region Tests GetFormationById
[Test]
public void GetById_PasseEnParamUnIdInconnu_RetourneUnObjetNotFoundResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
// Act
var notFoundResult = formationsApiController.GetFormationById(99999);
// Assert
Assert.IsInstanceOf<NotFoundObjectResult>(notFoundResult.Result);
}
[Test]
public void GetFormationById_PasseEnParamUnIdConnu_RetourneUnObjetOkResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
// Act
var okResult = formationsApiController.GetFormationById(1);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetFormationById_PasseEnParamUnIdConnu_RetourneLaBonneFormation()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
long idFormation = 1;
// Act
var okResult = formationsApiController.GetFormationById(idFormation).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<FormationDTO>(okResult.Value);
Assert.AreEqual(idFormation, (okResult.Value as FormationDTO).Id);
}
#endregion
#region Tests GetFormations
[Test]
public void GetFormations_PasseDesParamsPresentsDansLaBDD_RetourneUnObjetOkResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
List<int?> idStatuts = new List<int?> { 1, 2, 3 };
// Act
var okResult = formationsApiController.GetFormations(1, idStatuts, true, 1, 5, "formation", null, null, null);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetFormations_PasseDesParamsPresentsDansLaBDD_RetourneLesCinqPremieresFormations()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
List<int?> idStatuts = new List<int?> { 1, 2, 3 };
int nbFormation = 5;
int idFirstFormation = 5;
int idLastFormation = 1;
// Act
var okResult = formationsApiController.GetFormations(1, idStatuts, true, 1, 5, "formation", null, null, null).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<IEnumerable<FormationDetailsDTO>>(okResult.Value);
Assert.AreEqual(nbFormation, (okResult.Value as IEnumerable<FormationDetailsDTO>).Count());
Assert.AreEqual(idFirstFormation, (okResult.Value as IEnumerable<FormationDetailsDTO>).First().Id);
Assert.AreEqual(idLastFormation, (okResult.Value as IEnumerable<FormationDetailsDTO>).Last().Id);
}
#endregion
#region Tests GetFormationsCount
[Test]
public void GetFormationsCount_PasseDesParamsPresentsDansLaBDD_RetourneUnObjetOkResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
List<int?> idStatuts = new List<int?> { 1, 2, 3 };
// Act
var okResult = formationsApiController.GetFormationsCount(1, idStatuts, "formation", null, null);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetFormationsCount_PasseDesParamsPresentsDansLaBDD_RetourneLeBonNombreDeFormation()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
List<int?> idStatuts = new List<int?> { 1, 2, 3 };
int nbFormation = 8;
// Act
var okResult = formationsApiController.GetFormationsCount(1, idStatuts, "formation", null, null).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<long>(okResult.Value);
Assert.AreEqual(nbFormation, (long)okResult.Value);
}
#endregion
#region Tests GetModesFormation
[Test]
public void GetModesFormation_RetourneUnObjetOkResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
// Act
var okResult = formationsApiController.GetModesFormation();
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetModesFormation_RetourneTousLesModes()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
int nbModeFormation = 4;
// Act
var okResult = formationsApiController.GetModesFormation().Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<IEnumerable<ModeFormationDTO>>(okResult.Value);
Assert.AreEqual(nbModeFormation, (okResult.Value as IEnumerable<ModeFormationDTO>).Count());
}
#endregion
#region Tests GetOriginesFormation
[Test]
public void GetOriginesFormation_RetourneUnObjetOkResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
// Act
var okResult = formationsApiController.GetOriginesFormation();
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetOriginesFormation_RetourneToutesLesOrigines()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
int nbOrigineFormation = 4;
// Act
var okResult = formationsApiController.GetOriginesFormation().Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<IEnumerable<OrigineFormationDTO>>(okResult.Value);
Assert.AreEqual(nbOrigineFormation, (okResult.Value as IEnumerable<OrigineFormationDTO>).Count());
}
#endregion
#region Tests GetStatutsFormation
[Test]
public void GetStatusFormation_RetourneUnObjetOkResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
// Act
var okResult = formationsApiController.GetStatutsFormation();
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetStatutsFormation_RetourneTousLesStatuts()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
int nbStatutFormation = 4;
// Act
var okResult = formationsApiController.GetStatutsFormation().Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<IEnumerable<StatutFormationDTO>>(okResult.Value);
Assert.AreEqual(nbStatutFormation, (okResult.Value as IEnumerable<StatutFormationDTO>).Count());
}
#endregion
#region Tests GetTypesFormation
[Test]
public void GetTypesFormation_RetourneUnObjetOkResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
// Act
var okResult = formationsApiController.GetTypesFormation();
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetTypesFormation_RetourneTousLesTypes()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
int nbTypeFormation = 4;
// Act
var okResult = formationsApiController.GetTypesFormation().Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<IEnumerable<TypeFormationDTO>>(okResult.Value);
Assert.AreEqual(nbTypeFormation, (okResult.Value as IEnumerable<TypeFormationDTO>).Count());
}
#endregion
#region Tests AddFormation
[Test]
public void AddFormation_AjouteUneFormationAvecDesObjetsEnfantsInvalides_RetourneUnObjetObjectResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
ModeFormationDTO modeExterne = new ModeFormationDTO { Id = 0, Libelle = "Externe" };
StatutFormationDTO statutPlanifie = new StatutFormationDTO { Id = 1, Libelle = "Planifiée" };
TypeFormationDTO typeELearning = new TypeFormationDTO { Id = 3, Libelle = "E-learning" };
OrigineFormationDTO origineFormationCollaborateur = new OrigineFormationDTO { Id = 1, Libelle = "Demande collaborateur" };
FormationDTO formation = new FormationDTO
{
Intitule = "Test Formation",
IdAgence = 1,
DateDebut = new DateTime(2020, 10, 31),
DateFin = new DateTime(2020, 11, 02),
Heure = 2,
Jour = 1,
Mode = modeExterne,
Type = typeELearning,
Organisme = "Apside",
Origine = origineFormationCollaborateur,
Statut = statutPlanifie,
EstCertifiee = false
};
// Act
var objectResult = formationsApiController.AddFormation(formation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public void AddFormation_AjouteUneFormationValide_RetourneUnObjetCreatedResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
ModeFormationDTO modeExterne = new ModeFormationDTO { Id = 1, Libelle = "Externe" };
StatutFormationDTO statutPlanifie = new StatutFormationDTO { Id = 1, Libelle = "Planifiée" };
TypeFormationDTO typeELearning = new TypeFormationDTO { Id = 3, Libelle = "E-learning" };
OrigineFormationDTO origineFormationCollaborateur = new OrigineFormationDTO { Id = 1, Libelle = "Demande collaborateur" };
FormationDTO formation = new FormationDTO
{
Intitule = "Test Formation",
IdAgence = 1,
DateDebut = new DateTime(2020, 10, 31),
DateFin = new DateTime(2020, 11, 02),
Heure = 2,
Jour = 1,
Mode = modeExterne,
Type = typeELearning,
Organisme = "Apside",
Origine = origineFormationCollaborateur,
Statut = statutPlanifie,
EstCertifiee = false
};
// Act
var createdResult = formationsApiController.AddFormation(formation);
// Assert
Assert.IsInstanceOf<CreatedResult>(createdResult.Result);
}
[Test]
public void AddFormation_AjouteUneFormationValide_RetourneLaFormationCreee()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
ModeFormationDTO modeExterne = new ModeFormationDTO { Id = 1, Libelle = "Externe" };
StatutFormationDTO statutPlanifie = new StatutFormationDTO { Id = 1, Libelle = "Planifiée" };
TypeFormationDTO typeELearning = new TypeFormationDTO { Id = 3, Libelle = "E-learning" };
OrigineFormationDTO origineFormationCollaborateur = new OrigineFormationDTO { Id = 1, Libelle = "Demande collaborateur" };
FormationDTO formation = new FormationDTO
{
Intitule = "Test Formation",
IdAgence = 1,
DateDebut = new DateTime(2020, 10, 31),
DateFin = new DateTime(2020, 11, 02),
Heure = 2,
Jour = 1,
Mode = modeExterne,
Type = typeELearning,
Organisme = "Apside",
Origine = origineFormationCollaborateur,
Statut = statutPlanifie,
EstCertifiee = false
};
// Act
var createdResult = formationsApiController.AddFormation(formation).Result as CreatedResult;
// Assert
Assert.IsInstanceOf<FormationDTO>(createdResult.Value);
Assert.AreEqual("Test Formation", (createdResult.Value as FormationDTO).Intitule);
}
#endregion
#region Tests UpdateFormation
[Test]
public async Task UpdateFormation_ModifieUneFormationAvecDesObjetsEnfantsInvalides_RetourneUnObjetObjectResultDansCatchFormationInvalidException()
{
// Arrange
long idFormation = 1;
string nouvelleIntitule = "Formation modifiée";
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation);
formation.Intitule = nouvelleIntitule;
formation.Mode.Id = 0;
formation.Statut.Id = 0;
// Act
var objectResult = formationsApiController.UpdateFormation(formation, idFormation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public async Task UpdateFormation_ModifieUneFormationAvecDesObjetsEnfantsInvalides_RetourneUnObjetObjectResultDansCatchFormationIncompatibleIdException()
{
// Arrange
long idFormation = 1;
string nouvelleIntitule = "Formation modifiée";
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation);
idFormation = 2;
formation.Intitule = nouvelleIntitule;
// Act
var objectResult = formationsApiController.UpdateFormation(formation, idFormation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public async Task UpdateFormation_ModifieUneFormatioInexistante_RetourneUnObjetObjectResultDansCatchFormationNotFoundExceptionn()
{
// Arrange
long idFormationExistant = 1;
long idFormationInexistant = 999;
string nouvelleIntitule = "Formation modifiée";
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormationExistant);
formation.Id = idFormationInexistant;
formation.Intitule = nouvelleIntitule;
// Act
var objectResult = formationsApiController.UpdateFormation(formation, idFormationInexistant);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public async Task UpdateFormation_ModifieUneFormationValide_RetourneUnObjetOkObjectResult()
{
// Arrange
long idFormation = 1;
string nouvelleIntitule = "Formation modifiée";
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object); ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == 2)
.Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == 2)
.Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == 1)
.Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == 1)
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation);
formation.Intitule = nouvelleIntitule;
formation.Mode = modeExterne;
formation.Type = typeELearning;
formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie;
// Act
var okObjectResult = formationsApiController.UpdateFormation(formation, idFormation);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okObjectResult.Result);
}
[Test]
public async Task UpdateFormation_ModifieUneFormationValide_RetourneLaFormationModifiee()
{
// Arrange
long idFormation = 1;
string nouvelleIntitule = "Formation modifiée";
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == 2)
.Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == 2)
.Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == 1)
.Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == 1)
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation);
formation.Intitule = nouvelleIntitule;
formation.Mode = modeExterne;
formation.Type = typeELearning;
formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie;
// Act
var okObjectResult = formationsApiController.UpdateFormation(formation, idFormation).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<FormationDTO>(okObjectResult.Value);
Assert.AreEqual(nouvelleIntitule, (okObjectResult.Value as FormationDTO).Intitule);
}
#endregion
#region Tests DeleteFormationById
[Test]
public void DeleteFormation_PasseEnParamUnIdFormationInexistant_RetourneUnObjetNotFoundObjectResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
int idFormation = 999;
// Act
var notFoundObjectResult = formationsApiController.DeleteFormation(idFormation);
// Assert
Assert.IsInstanceOf<NotFoundObjectResult>(notFoundObjectResult.Result);
}
[Test]
public void DeleteFormation_PasseEnParamUnIdFormationExistant_RetourneUnObjetNoContentResult()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
int idFormation = 1;
// Act
var noContentResult = formationsApiController.DeleteFormation(idFormation);
// Assert
Assert.IsInstanceOf<NoContentResult>(noContentResult.Result);
}
[Test]
public async Task DeleteFormation_PasseEnParamUnIdFormationExistant_SupprimeBienUneFormation()
{
// Arrange
FormationsApiController formationsApiController = new FormationsApiController(formationService, new NullLogger<FormationsApiController>(), mockEnvironment.Object);
int idFormation = 1;
long nbFormationAvantSuppression = await formationService.GetFormationsCountAsync(null, null, null, null, null);
// Act
var noContentResult = formationsApiController.DeleteFormation(idFormation).Result as NoContentResult;
// Assert
long nbFormationApresSuppression = await formationService.GetFormationsCountAsync(null, null, null, null, null);
Assert.AreEqual(nbFormationAvantSuppression -1, nbFormationApresSuppression);
}
#endregion
}
}

@ -0,0 +1,142 @@
using EPAServeur.Context;
using EPAServeur.IServices;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.Controllers;
using IO.Swagger.DTO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Controllers
{
[TestFixture]
public class NoteApiTests
{
#region Variables
private EpContext context;
private ICollaborateurApi collaborateurApi;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
private INoteService noteService;
private ILogger<NotesApiController> logger;
private Guid? auteur1, collaborateur1;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddNotes(context);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
collaborateurApi = new CollaborateurApi();
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
logger = new NullLogger<NotesApiController>();
auteur1 = new Guid("aa36f34c-9041-42f5-9db3-6536fe7f1696");
collaborateur1 = new Guid("842650db-a548-4472-a3af-4c5fff3c1ab8");
}
#endregion
#region Tests
//AddNote
[Test]
public async Task AddNote()
{
NotesApiController notesApiController = new NotesApiController(noteService, logger);
CollaborateurDTO collaborateurDTO = await collaborateurService.GetCollaborateurByIdAsync(collaborateur1);
DateTime date = DateTime.Now;
DetailsNoteDTO nouvelleNote = new DetailsNoteDTO()
{
Collaborateur = collaborateurDTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = auteur1,
Texte = "Texte nouvelle note",
Titre = "Titre nouvelle note"
};
Task<IActionResult> task = notesApiController.AddNote(nouvelleNote);
CreatedResult result = task.Result as CreatedResult;
Assert.AreEqual(201, result.StatusCode);
Assert.IsInstanceOf<DetailsNoteDTO>(result.Value);
}
//DeleteNote
[Test]
public void SupprimerNote()
{
NotesApiController notesApiController = new NotesApiController(noteService, logger);
Task<IActionResult> task = notesApiController.DeleteNote(1);
NoContentResult result = task.Result as NoContentResult;
Assert.AreEqual(204, result.StatusCode);
}
//GetNoteById
[Test]
public void GetNoteById()
{
NotesApiController notesApiController = new NotesApiController(noteService, logger);
Task<IActionResult> task = notesApiController.GetNoteById(1);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200 ,result.StatusCode);
Assert.IsInstanceOf<DetailsNoteDTO>(result.Value);
}
//GetNotesAuteur
//GetNotesAuteurCount
//UpdateNote
[Test]
public async Task UpdateNote()
{
NotesApiController notesApiController = new NotesApiController(noteService, logger);
DetailsNoteDTO updatedNote = await noteService.GetNoteByIdAsync(2);
updatedNote.Texte = "Texte mise à jour";
updatedNote.Titre = "Titre mise à jour";
Task<IActionResult> task = notesApiController.UpdateNote(updatedNote, 2);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<DetailsNoteDTO>(result.Value);
}
#endregion
}
}

@ -0,0 +1,439 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.Models.Formation;
using EPAServeur.Services;
using IO.Swagger.Controllers;
using IO.Swagger.DTO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using EPAServeur.IServices;
using Moq;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.Enum;
namespace EPAServeur.Tests.Controllers
{
[TestFixture]
public class ParticipationFormationApiTests
{
#region Variables
private IParticipationFormationService participationFormationService;
private Mock<IWebHostEnvironment> mockEnvironment;
private EpContext epContext;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Création d'une collection de services pour l'injection de dépendance
var services = new ServiceCollection();
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
services.AddDbContext<EpContext>(b => b.UseInMemoryDatabase("server_ep_test"));
epContext = new EpContext(optionBuider);
epContext.Database.EnsureDeleted();
epContext.Database.EnsureCreated();
epContext.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddFormations(epContext);
DataSeeder.AddChamps(epContext);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in epContext.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
services.AddScoped<ITransformDTO, TransformDTO>();
services.AddScoped<ICollaborateurApi, CollaborateurApi>();
services.AddScoped<ICollaborateurService, CollaborateurService>();
services.AddScoped<IParticipationFormationService, ParticipationFormationService>();
// Récupère le service qui sera utilsé pour tester le contrôleur
var serviceProvider = services.BuildServiceProvider();
participationFormationService = serviceProvider.GetService<IParticipationFormationService>();
// Simule l'interface IWebHostEnvironment avec Moq
mockEnvironment = new Mock<IWebHostEnvironment>();
mockEnvironment
.Setup(m => m.EnvironmentName)
.Returns("Development");
}
#endregion
#region Tests GetEvaluationCollaborateur
[Test]
public void GetEvaluationCollaborateur_PasseEnParamUnIdInconnu_RetourneUnObjetNotFoundResult()
{
// Arrange
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
long idParticipationFormation = 99999;
// Act
var notFoundResult = ParticipationsFormationsApiController.GetEvaluationCollaborateur(idParticipationFormation);
// Assert
Assert.IsInstanceOf<NotFoundObjectResult>(notFoundResult.Result);
}
[Test]
public void GetEvaluationCollaborateur_PasseEnParamUnIdConnu_RetourneUnObjetOkResult()
{
// Arrange
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
long idParticipationFormation = 5;
// Act
var okResult = ParticipationsFormationsApiController.GetEvaluationCollaborateur(idParticipationFormation);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetEvaluationCollaborateur_PasseEnParamUnIdConnu_RetourneLaBonneEvaluation()
{
// Arrange
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
long idParticipationFormation = 5;
// Act
var okResult = ParticipationsFormationsApiController.GetEvaluationCollaborateur(idParticipationFormation).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<EvaluationDTO>(okResult.Value);
Assert.AreEqual(idParticipationFormation, (okResult.Value as EvaluationDTO).Id);
}
#endregion
#region Tests GetParticipationsByCollaborateur
[Test]
public void GetParticipationByCollaborateur_PasseDesParamsPresentsDansLaBDD_RetourneUnObjetOkResult()
{
// Arrange
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
Guid idCollaborateur = Guid.Parse("842650db-a548-4472-a3af-4c5fff3c1ab8");
// Act
var okResult = ParticipationsFormationsApiController.GetParticipationsByCollaborateur(idCollaborateur);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okResult.Result);
}
[Test]
public void GetParticipationByCollaborateur_PasseDesParamsPresentsDansLaBDD_RetourneLesParticipationsDUnCollaborateur()
{
// Arrange
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
Guid idCollaborateur = Guid.Parse("842650db-a548-4472-a3af-4c5fff3c1ab8");
int nbFormation = 1;
int idFirstParticipationFormation = 5;
// Act
var okResult = ParticipationsFormationsApiController.GetParticipationsByCollaborateur(idCollaborateur).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<IEnumerable<ParticipationFormationDTO>>(okResult.Value);
Assert.AreEqual(nbFormation, (okResult.Value as IEnumerable<ParticipationFormationDTO>).Count());
Assert.AreEqual(idFirstParticipationFormation, (okResult.Value as IEnumerable<ParticipationFormationDTO>).First().Id);
}
#endregion
#region Tests EvaluerFormation
[Test]
public async Task EvaluerFormation_EvaluerUneFormationAvecDesObjetsEnfantsInvalides_RetourneUnObjetObjectResultDansCatchParticipationFormationInvalidException()
{
// Arrange
long idParticipationFormation = 5;
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
// Act
var objectResult = ParticipationsFormationsApiController.EvaluerFormation(evaluationDTO, idParticipationFormation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public async Task EvaluerFormation_EvaluerUneFormationAvecDesObjetsEnfantsInvalides_RetourneUnObjetObjectResultDansCatchParticipationFormationIncompatibleIdException()
{
// Arrange
long idParticipationFormation = 5;
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
idParticipationFormation = 1;
// Act
var objectResult = ParticipationsFormationsApiController.EvaluerFormation(evaluationDTO, idParticipationFormation);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public async Task EvaluerFormation_EvaluerUneFormationInexistante_RetourneUnObjetObjectResultDansCatchParticipationFormationNotFoundExceptionn()
{
// Arrange
long idParticipationFormation = 5;
long idParticipationFormationInexistant = 999;
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
evaluationDTO.Id = idParticipationFormationInexistant;
// Act
var objectResult = ParticipationsFormationsApiController.EvaluerFormation(evaluationDTO, idParticipationFormationInexistant);
// Assert
Assert.IsInstanceOf<ObjectResult>(objectResult.Result);
}
[Test]
public async Task EvaluerFormation_EvaluerUneFormationValide_RetourneUnObjetOkObjectResult()
{
// Arrange
long idParticipationFormation = 5;
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
// Act
var okObjectResult = ParticipationsFormationsApiController.EvaluerFormation(evaluationDTO, idParticipationFormation);
// Assert
Assert.IsInstanceOf<OkObjectResult>(okObjectResult.Result);
}
[Test]
public async Task EvaluerFormation_EvaluerUneFormationValide_RetourneLEvaluationEvaluee()
{
// Arrange
long idParticipationFormation = 5;
ParticipationsFormationsApiController ParticipationsFormationsApiController = new ParticipationsFormationsApiController(participationFormationService, new NullLogger<ParticipationsFormationsApiController>(), mockEnvironment.Object);
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
// Act
var okObjectResult = ParticipationsFormationsApiController.EvaluerFormation(evaluationDTO, idParticipationFormation).Result as OkObjectResult;
// Assert
Assert.IsInstanceOf<EvaluationDTO>(okObjectResult.Value);
Assert.AreEqual(idParticipationFormation, (okObjectResult.Value as EvaluationDTO).Id);
}
#endregion
}
}

@ -0,0 +1,98 @@
using EPAServeur.Context;
using EPAServeur.IServices;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.Controllers;
using IO.Swagger.DTO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging.Abstractions;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Controllers
{
[TestFixture]
public class ReferentEPApiTests
{
#region Variables
private EpContext context;
private ICollaborateurApi collaborateurApi;
private ITransformDTO transformDTO;
private IReferentEPService referentEPService;
private Guid? referent, collaborateur1, collaborateur2, collaborateur3;
#endregion
#region SetUp
[SetUp]
public void SetUp()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
collaborateurApi = new CollaborateurApi();
referentEPService = new ReferentEPService(context, collaborateurApi);
referent = new Guid("aa36f34c-9041-42f5-9db3-6536fe7f1696");
collaborateur1 = new Guid("301ba7f3-095e-4912-8998-a7c942dc5f23");
collaborateur2 = new Guid("a43b6f4f-f199-4dd0-93b6-a1cb2c0a0d14");
collaborateur3 = new Guid("b5254c6c-7caa-435f-a4bb-e0cf92559832");
}
#endregion
#region Tests
[Test]
public void UpdateReferentCollaborateur()
{
ReferentsEPApiController referentsEPApi = new ReferentsEPApiController(referentEPService, new NullLogger<ReferentsEPApiController>());
ReferentEPDTO referentEPDTO = new ReferentEPDTO()
{
IdReferent = referent,
IdsCollaborateur = new List<Guid?>()
};
referentEPDTO.IdsCollaborateur.Add(collaborateur1);
Task<IActionResult> task = referentsEPApi.UpdateReferentCollaborateur(referentEPDTO, collaborateur1);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<ReferentEPDTO>(result.Value);
}
public void UpdateCollaborateursReferent()
{
ReferentsEPApiController referentsEPApi = new ReferentsEPApiController(referentEPService, new NullLogger<ReferentsEPApiController>());
ReferentEPDTO referentEPDTO = new ReferentEPDTO()
{
IdReferent = referent,
IdsCollaborateur = new List<Guid?>()
};
referentEPDTO.IdsCollaborateur.Add(collaborateur1);
referentEPDTO.IdsCollaborateur.Add(collaborateur2);
referentEPDTO.IdsCollaborateur.Add(collaborateur3);
Task<IActionResult> task = referentsEPApi.UpdateCollaborateursReferent(referentEPDTO, referent);
OkObjectResult result = task.Result as OkObjectResult;
Assert.AreEqual(200, result.StatusCode);
Assert.IsInstanceOf<ReferentEPDTO>(result.Value);
}
#endregion
}
}

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="nunit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EPAServeur\EPAServeur.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="TestResults\" />
</ItemGroup>
</Project>

@ -0,0 +1,7 @@
{
"profiles": {
"EPAServeur.Tests": {
"commandName": "Project"
}
}
}

@ -0,0 +1,454 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.IServices;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.DTO;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Services
{
[TestFixture]
public class CollaborateurServiceTests
{
#region
private EpContext context;
private ICollaborateurApi collaborateurApi;
private ITransformDTO transformDTO;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddRereferentEP(context);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
transformDTO = new TransformDTO();
collaborateurApi = new CollaborateurApi();
}
#endregion
#region Tests getCollaborateur
[TestCase("842650db-a548-4472-a3af-4c5fff3c1ab8")]
[TestCase("301ba7f3-095e-4912-8998-a7c942dc5f23")]
[TestCase("4f3fcd23-a1e4-4c9e-afa2-d06ca9216491")]
public async Task GetCollaborateurById_Ok(Guid? id)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
CollaborateurDTO collaborateurDTO = await collaborateurService.GetCollaborateurByIdAsync(id);
Assert.IsNotNull(collaborateurDTO);
Assert.AreEqual(collaborateurDTO.Id, id);
}
[TestCase("creola.nicolas@apside-groupe.com")]
[TestCase("lamar.rousseau@apside-groupe.com")]
[TestCase("coty.lemoine@apside-groupe.com")]
public async Task GetCollaborateurByMail_Ok(string mail)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
CollaborateurDTO collaborateurDTO = await collaborateurService.GetCollaborateurByMailAsync(mail);
Assert.IsNotNull(collaborateurDTO);
Assert.AreEqual(collaborateurDTO.MailApside, mail);
}
[TestCase("006226f6-51b2-4a02-a302-7447f7fccc04")]
[TestCase("e5d36da4-df16-4d19-8a11-1ba2f6efc80c")]
[TestCase("92b29b9c-40a4-4aa0-9412-bc97a379e52f")]
public void GetCollaborateurById_CollaborateurNotFound(Guid? id)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
AsyncTestDelegate exception = () => collaborateurService.GetCollaborateurByIdAsync(id);
Assert.ThrowsAsync(typeof(CollaborateurNotFoundException), exception);
}
[TestCase("nicolas@apside.fr")]
[TestCase("rousseau@apside.fr")]
[TestCase("lemoine@apside.fr")]
public void GetCollaborateurByMail_CollaborateurNotFound(string mail)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
AsyncTestDelegate exception = () => collaborateurService.GetCollaborateurByMailAsync(mail);
Assert.ThrowsAsync(typeof(CollaborateurNotFoundException), exception);
}
#endregion
#region Tests GetCollaborateurs Roles
[TestCase("RH")]
[TestCase("Collaborateur")]
[TestCase("Assistant")]
[TestCase("Manager")]
[TestCase("RA")]
public async Task GetCollaborateurs_UnRole(string role)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
List<string> roles = new List<string>();
roles.Add(role);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(roles, null, true, 1, 50, "", "", null, null);
int count = await collaborateurService.GetCollaborateursCountAsync(roles, null, "", null, null);
Assert.AreEqual(count, collaborateurs.Count());
switch (role)
{
case "RH":
Assert.AreEqual(count, 9);
break;
case "Collaborateur":
Assert.AreEqual(count, 7);
break;
case "Assistant":
Assert.AreEqual(count, 6);
break;
case "Manager":
Assert.AreEqual(count, 10);
break;
case "RA":
Assert.AreEqual(count, 5);
break;
}
}
[Test]
public async Task GetCollaborateurs_RoleRH_RoleAssistant()
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
List<string> roles = new List<string>();
roles.Add("Assistant");
roles.Add("RH");
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(roles, null, true, 1, 50, "", "", null, null);
int count = await collaborateurService.GetCollaborateursCountAsync(roles, null, "", null, null);
Assert.AreEqual(count, 15); Assert.AreEqual(count, collaborateurs.Count());
}
[Test]
public async Task GetCollaborateurs_RoleRA_RoleManager()
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
List<string> roles = new List<string>();
roles.Add("Manager");
roles.Add("RA");
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(roles, null, true, 1, 50, "", "", null, null);
int count = await collaborateurService.GetCollaborateursCountAsync(roles, null, "", null, null);
Assert.AreEqual(count, collaborateurs.Count());
Assert.AreEqual(count, 15);
}
#endregion
#region Test GetCollaborateurs Tri et Pagination
[Test]
public async Task GetCollaborateurs_Asc_Desc()
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
IEnumerable<CollaborateurDTO> collaborateursAsc = await collaborateurService.GetCollaborateursAsync(null, null, true, 1, 50, "", "", null, null);
IEnumerable<CollaborateurDTO> collaborateursDesc = await collaborateurService.GetCollaborateursAsync(null, null, false, 1, 50, "", "", null, null);
CollaborateurDTO collaborateurDTOFirstAsc = collaborateursAsc.First();
CollaborateurDTO collaborateurDTLastAsc = collaborateursAsc.Last();
CollaborateurDTO collaborateurDTOFirstDesc = collaborateursDesc.First();
CollaborateurDTO collaborateurDTLastDesc = collaborateursDesc.Last();
Assert.AreEqual(collaborateurDTOFirstAsc.Id, collaborateurDTLastDesc.Id);
Assert.AreEqual(collaborateurDTLastAsc.Id, collaborateurDTOFirstDesc.Id);
}
[TestCase("ma")]
[TestCase("z")]
[TestCase("em")]
[TestCase("")]
public async Task GetCollaborateurs_Texte(string texte)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, 1, 50, texte, "", null, null);
string nomprenom, prenomnom;
foreach(CollaborateurDTO collaborateur in collaborateurs)
{
nomprenom = collaborateur.Nom.ToLower() + " " + collaborateur.Prenom.ToLower();
prenomnom = collaborateur.Prenom.ToLower() + " " + collaborateur.Nom.ToLower();
Assert.IsTrue(nomprenom.Contains(texte) || prenomnom.Contains(texte));
}
}
[TestCase(2015,1,1)]
[TestCase(2016,1,1)]
[TestCase(2017,1,1)]
[TestCase(2018,1,1)]
public async Task GetCollaborateurs_DateDebut(int annee, int mois, int jour)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
DateTime dateDebut = new DateTime(annee, mois, jour);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, 1, 50, "", "", dateDebut, null);
foreach(CollaborateurDTO collaborateur in collaborateurs)
{
Assert.IsTrue(collaborateur.DateArrivee >= dateDebut);
}
}
[TestCase(2020, 12, 31)]
[TestCase(2019, 12, 31)]
[TestCase(2018, 12, 31)]
[TestCase(2017, 12, 31)]
public async Task GetCollaborateurs_DateFin(int annee, int mois, int jour)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
DateTime dateFin = new DateTime(annee, mois, jour);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, 1, 50, "", "", null, dateFin);
foreach (CollaborateurDTO collaborateur in collaborateurs)
{
Assert.IsTrue(collaborateur.DateArrivee < dateFin);
}
}
[TestCase(2016,1,1,2018,12,31)]
[TestCase(2017,6,1,2017,6,30)]
[TestCase(2019,1,1,2019,12,31)]
public async Task GetCollaborateurs_DateDebutDateFin(int anneeDeb, int moisDeb, int jourDeb, int anneeFin, int moisFin, int jourFin)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
DateTime dateDebut = new DateTime(anneeDeb, moisDeb, jourDeb);
DateTime dateFin = new DateTime(anneeFin, moisFin, jourFin);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, 1, 50, "", "", dateDebut, dateFin);
foreach (CollaborateurDTO collaborateur in collaborateurs)
{
Assert.IsTrue(collaborateur.DateArrivee >= dateDebut && collaborateur.DateArrivee < dateFin);
}
}
[TestCase(1,15)]
[TestCase(4,5)]
[TestCase(2,15)]
[TestCase(1,20)]
[TestCase(1,37)]
public async Task GetCollaborateur_Paginaion(int numPage, int parPage)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, numPage, parPage, "", "", null, null);
Assert.AreEqual(collaborateurs.Count(), parPage);
}
[TestCase(2, 37, 0)]
[TestCase(3, 15, 7)]
[TestCase(8, 5, 2)]
public async Task GetCollaborateur_Paginaion_2(int numPage, int parPage, int res)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, numPage, parPage, "", "", null, null);
Assert.AreEqual(collaborateurs.Count(), res);
}
[TestCase(0, 4)]
[TestCase(-1, 0)]
[TestCase(-10, -10)]
[TestCase(-10, 20)]
[TestCase(-1, 37)]
public async Task GetCollaborateur_PaginaionValeursParDefaut(int numPage, int parPage)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, numPage, parPage, "", "", null, null);
if(parPage < 5)
Assert.AreEqual(collaborateurs.Count(), 15);
else
Assert.AreEqual(collaborateurs.Count(), parPage);
}
[Test]
public async Task GetCollaborateur_OrderByDateArrive()
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, 1, 30, "", "datearrivee", null, null);
DateTime d1, d2;
for(int i = 0; i < collaborateurs.Count() -1; ++i)
{
d1 = collaborateurs.ElementAt(i).DateArrivee.Value;
d2 = collaborateurs.ElementAt(i+1).DateArrivee.Value;
Assert.AreEqual(DateTime.Compare(d1, d2),-1);
}
}
[Test]
public async Task GetCollaborateur_OrderByBU()
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, 1, 30, "", "businessunit", null, null);
string bu1, bu2;
for (int i = 0; i < collaborateurs.Count() - 1; ++i)
{
bu1 = collaborateurs.ElementAt(i).BusinessUnit.Nom;
bu2 = collaborateurs.ElementAt(i + 1).BusinessUnit.Nom;
Console.WriteLine(bu1 + " " + bu2);
Assert.IsTrue(string.Compare(bu1, bu2) <= 0);
}
}
[Test]
public async Task GetCollaborateur_OrderByNom()
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursAsync(null, null, true, 1, 30, "", "collaborateur", null, null);
string nom1, nom2;
for (int i = 0; i < collaborateurs.Count() - 1; ++i)
{
nom1 = collaborateurs.ElementAt(i).Nom;
nom2 = collaborateurs.ElementAt(i+1).Nom;
Assert.IsTrue(string.Compare(nom1, nom2) <= 0);
}
}
#endregion
#region GetCollaborateurs par referent
[TestCase("aa36f34c-9041-42f5-9db3-6536fe7f1696")]
[TestCase("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d")]
[TestCase("e7820f92-eab1-42f5-ae96-5c16e71ff1e6")]
[TestCase("de98a866-736f-4295-a669-92a8694e2ee3")]
[TestCase("642bc07f-051a-4088-8a73-425b44998673")]
public async Task GetCollaborateurByReferentPlusCount(Guid idReferent)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursByReferentAsync(idReferent, true, 1, 15, "", "");
int count = await collaborateurService.GetCollaborateursCountByReferentAsync(idReferent, "");
Assert.AreEqual(count, collaborateurs.Count());
}
[TestCase("8a68e248-65f8-11eb-ae93-0242ac130002")]
[TestCase("c43a975f-2b83-423b-96e5-ff98c6bd5bd3")]
[TestCase("e6b66b62-9ddb-423e-8f58-0a647514ecfe")]
[TestCase("ca1f480a-9918-4cea-819c-62e5c7f2b332")]
public void GetCollaborateurByReferent_ReferentNotFound(Guid idReferent)
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
AsyncTestDelegate exception = () => collaborateurService.GetCollaborateursByReferentAsync(idReferent, true, 1, 15, "", "");
Assert.ThrowsAsync(typeof(ReferentNotFoundException), exception);
}
#endregion
#region GetCollaborateurs by guids
[Test]
public async Task GetCollaborateurByGuids()
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
List<Guid?> guids = new List<Guid?>();
guids.Add(new Guid("ebd911ef-a6a8-4047-afdc-9a9066aa1a07"));
guids.Add(new Guid("71d33f6d-695a-4dc6-ae1a-b1605fd2073d"));
guids.Add(new Guid("56e3d82d-4be4-4449-a1f7-b4004b6bd186"));
guids.Add(new Guid("a43b6f4f-f199-4dd0-93b6-a1cb2c0a0d14"));
guids.Add(new Guid("a0f40e2a-cc03-4032-a627-5389e1281c64"));
guids.Add(new Guid("a29d707c-5d82-4c48-bed1-a6d1c1710047"));
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateurDTOsAsync(guids);
foreach(CollaborateurDTO c in collaborateurs)
{
Assert.IsTrue(guids.Contains(c.Id));
}
Assert.AreEqual(guids.Count, collaborateurs.Count());
}
[Test]
public async Task GetCollaborateurByGuidsAvecIdsNonExistantEnPlus()
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
List<Guid?> guids = new List<Guid?>();
guids.Add(new Guid("b645f582-0a5d-48dc-97a1-4ebb0fb3a29f"));
guids.Add(new Guid());
guids.Add(new Guid("f42f65cb-dcc1-407f-a048-f67efbe88d65"));
guids.Add(new Guid("e634de52-d921-4ae8-954d-215f39712041"));
guids.Add(new Guid("ad63ff07-6dae-4b02-8d49-1cacf1e8a224"));
guids.Add(new Guid("25d2b0ce-5c95-4ccc-98bb-63b06c4ee4ad"));
guids.Add(new Guid());
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateurDTOsAsync(guids);
foreach (CollaborateurDTO c in collaborateurs)
{
Assert.IsTrue(guids.Contains(c.Id));
}
Assert.AreEqual(guids.Count, collaborateurs.Count()+2);
}
[Test]
public async Task GetCollaborateurByGuidsAvecIdsNonExistantUniquement()
{
ICollaborateurService collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
List<Guid?> guids = new List<Guid?>();
guids.Add(new Guid());
guids.Add(new Guid());
guids.Add(new Guid());
guids.Add(new Guid());
guids.Add(new Guid());
guids.Add(new Guid());
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateurDTOsAsync(guids);
Assert.AreNotEqual(guids.Count, collaborateurs.Count());
Assert.AreEqual(0, collaborateurs.Count());
}
#endregion
}
}

@ -0,0 +1,228 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.IServices;
using EPAServeur.Models.EP;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.DTO;
using IO.Swagger.Enum;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Services
{
[TestFixture]
public class DemandeDelegationServiceTests
{
#region variables
private EpContext context;
private ICollaborateurApi collaborateurApi;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
DataSeeder.AddDemandeDelegationEP(context);
// Ajout du jeu de données pour les tests
//TO DO
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
collaborateurApi = new CollaborateurApi();
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
}
#endregion
#region Test RecuperationDemandeDelegation
[TestCase("771f9129-5610-4f4b-a8eb-902a98d722be", 0)]
[TestCase("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d", 3)]
[TestCase("0afd1573-de75-4e5b-bfcb-1985259d8370", 1)]
[TestCase("de98a866-736f-4295-a669-92a8694e2ee3", 1)]
[TestCase("17b87130-0e9d-4b78-b0e3-a11e5f70318d", 1)]
public async Task RecupererDemandesDelegation_OK(Guid? idReferent, int count)
{
IDemandeDelegationService demandeDelegationService = new DemandeDelegationService(collaborateurService, context, transformDTO);
IEnumerable<DemandeDelegationDTO> demandesDelegation = await demandeDelegationService.RecupererDemandesDelegation(idReferent);
foreach (DemandeDelegationDTO demandeDelegation in demandesDelegation)
{
Assert.AreEqual(idReferent, demandeDelegation.Referent.Id);
Assert.AreEqual(demandeDelegation.EtatDemande, EtatDemande.EnAttente);
}
Assert.AreEqual(count, demandesDelegation.Count());
}
[Test]
public void RecupererDemandeDelegation_ReferentNotFound()
{
Guid? idReferent = new Guid();
IDemandeDelegationService demandeDelegationService = new DemandeDelegationService(collaborateurService, context, transformDTO);
AsyncTestDelegate exception = () => demandeDelegationService.RecupererDemandesDelegation(idReferent);
Assert.ThrowsAsync(typeof(ReferentNotFoundException), exception);
}
#endregion
#region Reponse demande delegation
[TestCase(1)]
[TestCase(2)]
[TestCase(5)]
public async Task UpdateDemandeDelegation_ReponsePositive(long id)
{
IDemandeDelegationService demandeDelegationService = new DemandeDelegationService(collaborateurService, context, transformDTO);
DemandeDelegation demandeDelegation = await context.DemandeDelegation.FindAsync(id);
long idEp = demandeDelegation.IdEP;
Ep ep = await context.Ep.FindAsync(idEp);
Guid idReferent = demandeDelegation.IdReferent;
Assert.AreNotEqual(ep.IdReferent, idReferent);
DemandeDelegationDTO demandeDTO = new DemandeDelegationDTO()
{
Id = id,
DateDemande = demandeDelegation.DateDemande,
RaisonDemande = demandeDelegation.RaisonDemande,
EtatDemande = EtatDemande.Validee,
Referent = new CollaborateurDTO()
{
Id = idReferent
}
};
DemandeDelegationDTO reponse = await demandeDelegationService.UpdateDemandeDelegation(id, demandeDTO);
demandeDelegation = await context.DemandeDelegation.FindAsync(id);
Assert.IsNull(reponse);
Assert.IsNull(demandeDelegation);
ep = await context.Ep.FindAsync(idEp);
Assert.AreEqual(ep.IdReferent, idReferent);
}
[TestCase(3)]
[TestCase(4)]
[TestCase(6)]
public async Task UpdateDemandeDelegation_ReponseNegative(long id)
{
IDemandeDelegationService demandeDelegationService = new DemandeDelegationService(collaborateurService, context, transformDTO);
DemandeDelegation demandeDelegation = await context.DemandeDelegation.FindAsync(id);
long idEp = demandeDelegation.IdEP;
Ep ep = await context.Ep.FindAsync(idEp);
Guid idReferent = demandeDelegation.IdReferent;
Assert.AreNotEqual(ep.IdReferent, idReferent);
DemandeDelegationDTO demandeDTO = new DemandeDelegationDTO()
{
Id = id,
DateDemande = demandeDelegation.DateDemande,
RaisonDemande = demandeDelegation.RaisonDemande,
EtatDemande = EtatDemande.Rejetee,
RaisonRefus = "exemple raison refus"
};
DemandeDelegationDTO reponse = await demandeDelegationService.UpdateDemandeDelegation(id, demandeDTO);
Assert.IsNotNull(reponse);
Assert.AreEqual(reponse.EtatDemande, EtatDemande.Rejetee);
ep = await context.Ep.FindAsync(idEp);
Assert.AreNotEqual(ep.IdReferent, idReferent);
}
[TestCase(-5, EtatDemande.Validee, null)]
[TestCase(-5, EtatDemande.Rejetee, "exemple refus")]
[TestCase(0, EtatDemande.Validee, null)]
[TestCase(0, EtatDemande.Rejetee, "exemple refus")]
[TestCase(10, EtatDemande.Validee, null)]
[TestCase(10, EtatDemande.Rejetee, "exemple refus")]
public void UpdateDemandeDelegation_DemandeNonExistante(long id, EtatDemande etatDemande, string raisonRefus)
{
IDemandeDelegationService demandeDelegationService = new DemandeDelegationService(collaborateurService, context, transformDTO);
DemandeDelegationDTO demandeDTO = new DemandeDelegationDTO()
{
Id = id,
DateDemande = DateTime.Now,
RaisonDemande = "exemple raison demande",
EtatDemande = etatDemande,
RaisonRefus = raisonRefus
};
AsyncTestDelegate exception = () => demandeDelegationService.UpdateDemandeDelegation(id, demandeDTO);
Assert.ThrowsAsync(typeof(DemandeDelegationNotFoundException), exception);
}
[TestCase(1, 4,EtatDemande.Validee, null)]
[TestCase(2, 3,EtatDemande.Rejetee, "exemple refus")]
[TestCase(3, 2,EtatDemande.Validee, null)]
[TestCase(4, 1,EtatDemande.Rejetee, "exemple refus")]
public void UpdateDemandeDelegation_DemandeIncompatible(long id, long idIncompatible, EtatDemande etatDemande, string raisonRefus)
{
IDemandeDelegationService demandeDelegationService = new DemandeDelegationService(collaborateurService, context, transformDTO);
DemandeDelegationDTO demandeDTO = new DemandeDelegationDTO()
{
Id = id,
DateDemande = DateTime.Now,
RaisonDemande = "exemple raison demande",
EtatDemande = etatDemande,
RaisonRefus = raisonRefus
};
AsyncTestDelegate exception = () => demandeDelegationService.UpdateDemandeDelegation(idIncompatible, demandeDTO);
Assert.ThrowsAsync(typeof(DemandeDelegationIncompatibleException), exception);
}
[TestCase(7, EtatDemande.EnAttente, null)]
[TestCase(7, EtatDemande.EnAttente, "raison")]
[TestCase(7, EtatDemande.EnAttente, "")]
[TestCase(7, EtatDemande.Rejetee, null)]
[TestCase(7, EtatDemande.Rejetee, "")]
public async Task UpdateDemandeDelegation_DemandeInvalid(long id, EtatDemande etatDemande, string raisonRefus)
{
IDemandeDelegationService demandeDelegationService = new DemandeDelegationService(collaborateurService, context, transformDTO);
DemandeDelegation demandeDelegation = await context.DemandeDelegation.FindAsync(id);
long idEp = demandeDelegation.IdEP;
Ep ep = await context.Ep.FindAsync(idEp);
Guid idReferent = demandeDelegation.IdReferent;
Assert.AreNotEqual(ep.IdReferent, idReferent);
DemandeDelegationDTO demandeDTO = new DemandeDelegationDTO()
{
Id = id,
DateDemande = demandeDelegation.DateDemande,
RaisonDemande = demandeDelegation.RaisonDemande,
EtatDemande = etatDemande,
RaisonRefus = raisonRefus
};
AsyncTestDelegate exception = () => demandeDelegationService.UpdateDemandeDelegation(id, demandeDTO);
Assert.ThrowsAsync(typeof(DemandeDelegationInvalidException), exception);
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,639 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.IServices;
using EPAServeur.Models.Formation;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.DTO;
using IO.Swagger.Enum;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Services
{
[TestFixture]
public class EngagementServiceTests
{
#region Variables
private EpContext epContext;
private ICollaborateurApi collaborateurApi;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
epContext = new EpContext(optionBuider);
collaborateurApi = new CollaborateurApi();
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(collaborateurApi, epContext, transformDTO);
epContext.Database.EnsureDeleted();
epContext.Database.EnsureCreated();
epContext.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddEngagements(epContext);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in epContext.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
}
#endregion
#region Tests GetEngagementsAsync
[TestCase(new long[] { 1, 2 })]
public async Task GetEngagementsAsync_PasseDesParamsDesIdBUValides_RetourneDesEngagements(long[] arrIdBUs)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = arrIdBUs.Select(x => x).ToList();
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, null, null, null, null, null);
// Assert
Assert.Less(0, engagementDTOs.Count());
}
[TestCase(new EtatEngagement[] { EtatEngagement.EnAttente, EtatEngagement.Respecte })]
[TestCase(new EtatEngagement[] { EtatEngagement.DateLimitePassee })]
public async Task GetEngagementsAsync_PasseDesParamsDesEtatsDEngagementsValides_RetourneDesEngagements(EtatEngagement[] arrEtatsEngagement)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
List<EtatEngagement> etatEngagements = arrEtatsEngagement.Select(x => x).ToList();
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, etatEngagements, null, null, null, null, null);
// Assert
Assert.Less(0, engagementDTOs.Count());
}
[TestCase(1, 5)]
[TestCase(1, 10)]
public async Task GetEngagementsAsync_PasseEnParamNumPageEtParPage_RetourneLaPremierePageDesEngagements(int? numPage, int? parPage)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, null, numPage, parPage, null, null);
// Assert
Assert.AreEqual(parPage, engagementDTOs.Count());
}
[TestCase(2, 5)]
[TestCase(2, 6)]
[TestCase(2, 10)]
[TestCase(2, 15)]
public async Task GetEngagementsAsync_PasseEnParamNumPageEtParPage_RetourneLaDeuxiemePageDesFormations(int? numPage, int? parPage)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
int? nbEngagementDeuxiemePage;
switch (parPage)
{
case 5:
nbEngagementDeuxiemePage = 5;
break;
case 6:
nbEngagementDeuxiemePage = 6;
break;
case 10:
nbEngagementDeuxiemePage = 2;
break;
default:
nbEngagementDeuxiemePage = 0;
break;
}
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, null, numPage, parPage, null, null);
// Assert
Assert.AreEqual(nbEngagementDeuxiemePage, engagementDTOs.Count());
}
[TestCase(true, "action")]
[TestCase(true, null)]
[TestCase(true, "toto")]
public async Task GetEngagementsAsync_PasseEnParamAscEtTri_RetourneDesEngagementsOrdonnancesParActionCroissant(bool? asc, string tri)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, asc, null, null, null, tri);
// Assert
Assert.AreEqual("Je m'engage à attribuer 5 jours de congés supplémentaire.", engagementDTOs.First().Action);
Assert.AreEqual("Je m'engage à trouver une formation sur le Cobol.", engagementDTOs.Last().Action);
}
[TestCase(false, "action")]
[TestCase(false, null)]
[TestCase(false, "toto")]
public async Task GetEngagementsAsync_PasseEnParamAscEtTri_RetourneDesEngagementsOrdonnancesParActionDecroissant(bool? asc, string tri)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, asc, null, null, null, tri);
// Assert
Assert.AreEqual("Je m'engage à trouver une formation sur le Cobol.", engagementDTOs.First().Action);
Assert.AreEqual("Je m'engage à attribuer 5 jours de congés supplémentaire.", engagementDTOs.Last().Action);
}
[Test]
public async Task GetEngagementsAsync_PasseEnParamAscEtTri_RetourneDesEngagementsOrdonnancesParDispositifCroissant()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
bool? asc = true;
string tri = "dispositif";
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, asc, null, null, null, tri);
// Assert
Assert.AreEqual("Contacter le client pour planifier un rendez-vous.", engagementDTOs.First().Dispositif);
Assert.AreEqual("Planifier un point hebdomadaire sur Teams.", engagementDTOs.Last().Dispositif);
}
[Test]
public async Task GetEngagementsAsync_PasseEnParamAscEtTri_RetourneDesEngagementsOrdonnancesParDispositifDecroissant()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
bool? asc = false;
string tri = "dispositif";
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, asc, null, null, null, tri);
// Assert
Assert.AreEqual("Planifier un point hebdomadaire sur Teams.", engagementDTOs.First().Dispositif);
Assert.AreEqual("Contacter le client pour planifier un rendez-vous.", engagementDTOs.Last().Dispositif);
}
[Test]
public async Task GetEngagementsAsync_PasseEnParamAscEtTri_RetourneDesEngagementsOrdonnancesParModaliteCroissante()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
bool? asc = true;
string tri = "modalite";
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, asc, null, null, null, tri);
// Assert
Assert.AreEqual("Hors temps", engagementDTOs.First().Modalite);
Assert.AreEqual("Sur temps de travail", engagementDTOs.Last().Modalite);
}
[Test]
public async Task GetEngagementsAsync_PasseEnParamAscEtTri_RetourneDesEngagementsOrdonnancesParModaliteDecroissante()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
bool? asc = false;
string tri = "modalite";
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, asc, null, null, null, tri);
// Assert
Assert.AreEqual("Sur temps de travail", engagementDTOs.First().Modalite);
Assert.AreEqual("Hors temps", engagementDTOs.Last().Modalite);
}
[Test]
public async Task GetEngagementsAsync_PasseEnParamAscEtTri_RetourneDesEngagementsOrdonnancesParDateCroissante()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
bool? asc = true;
string tri = "date";
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, asc, null, null, null, tri);
// Assert
Assert.AreEqual(new DateTime(2020, 9, 1), engagementDTOs.First().DateLimite);
Assert.AreEqual(new DateTime(2021, 1, 31), engagementDTOs.Last().DateLimite);
}
[Test]
public async Task GetEngagementsAsync_PasseEnParamAscEtTri_RetourneDesEngagementsOrdonnancesParDateDecroissante()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>() { 1, 2, 3 };
bool? asc = false;
string tri = "date";
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, asc, null, null, null, tri);
// Assert
Assert.AreEqual(new DateTime(2021, 1, 31), engagementDTOs.First().DateLimite);
Assert.AreEqual(new DateTime(2020, 9, 1), engagementDTOs.Last().DateLimite);
}
[TestCase(new long[] { 0 }, null )]
[TestCase(new long[] { 4 }, null)]
[TestCase(new long[] { 1, 2 }, "azerty")]
public async Task GetEngagementsAsync_PasseDesParamsInvalides_RetourneZeroEngagement(long[] arrIdBUs, string texte)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs;
if (arrIdBUs != null)
idBUs = arrIdBUs.Select(x => x).ToList();
else
idBUs = new List<long>();
// Act
IEnumerable<EngagementDTO> engagementDTOs = await engagementService.GetEngagementsAsync(idBUs, null, null, null, null, texte, null);
// Assert
Assert.AreEqual(0, engagementDTOs.Count());
}
[Test]
public void GetEngagementsAsync_PasseDesParamsUneListeDIdsBUVide_LeveUneEngagementInvalidException()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = new List<long>();
// Act
AsyncTestDelegate throwException = () => engagementService.GetEngagementsAsync(idBUs, null, null, null, null, null, null);
// Assert
Assert.ThrowsAsync(typeof(EngagementInvalidException), throwException);
}
[Test]
public void GetEngagementsAsync_PasseDesParamsUneListeDIdsBUNull_LeveUneEngagementInvalidException()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs = null;
// Act
AsyncTestDelegate throwException = () => engagementService.GetEngagementsAsync(idBUs, null, null, null, null, null, null);
// Assert
Assert.ThrowsAsync(typeof(EngagementInvalidException), throwException);
}
#endregion
#region Tests GetEngagementsCountAsync
[TestCase(new long[] { 1, 2, 3 }, "Coty")]
[TestCase(new long[] { 1 }, null)]
public async Task GetEngagementsCountAsync_PasseDesParamsValides_RetourneLeNombreTotalDEngagements(long[] arrIdBUs, string texte)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs;
if (arrIdBUs != null)
idBUs = arrIdBUs.Select(x => x).ToList();
else
idBUs = new List<long>();
// Act
long count = await engagementService.GetEngagementsCountAsync(idBUs, null, texte);
// Assert
Assert.Less(0, count);
}
[TestCase(new long[] { 0 }, null)]
[TestCase(new long[] { 4 }, null)]
[TestCase(new long[] { 1, 2 }, "azerty")]
public async Task GetEngagementsCountAsync_PasseDesParamsInvalides_RetourneZero(long[] arrIdBUs, string texte)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
List<long> idBUs;
if (arrIdBUs != null)
idBUs = arrIdBUs.Select(x => x).ToList();
else
idBUs = new List<long>();
// Act
long count = await engagementService.GetEngagementsCountAsync(idBUs, null, texte);
// Assert
Assert.AreEqual(0, count);
}
#endregion
#region Tests RepondreEngagementAsync
[TestCase(1, 9, EtatEngagement.Respecte, null)]
[TestCase(1, 9, EtatEngagement.EnAttente, null)]
[TestCase(2, 9, EtatEngagement.NonRealisable, "Impossible de respecter cet engagement car hors budget.")]
public async Task RepondreEngagementAsync_ModifieUnEngagementValide_EngagementModifieAvecSucces(long idEngagement, long idEp, EtatEngagement etatEngagement, string raisonNonRealisable)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
EpInformationDTO epInformationDTO = epContext.Ep.Where(ep => ep.IdEP == idEp)
.Select(ep => new EpInformationDTO
{
Id = ep.IdEP,
Type = ep.TypeEP,
Statut = ep.Statut,
DateDisponibilite = ep.DateDisponibilite,
DatePrevisionnelle = ep.DatePrevisionnelle,
Obligatoire = ep.Obligatoire
}).FirstOrDefault();
EngagementDTO engagementDTO =new EngagementDTO
{
Id = idEngagement,
Action = "Je m'engage à trouver une formation sur l'Asp.Net Core.",
Dispositif = "Demande de formation RH.",
Modalite = "Sur temps de travail",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = etatEngagement,
RaisonNonRealisable = raisonNonRealisable,
Ep = epInformationDTO
};
// Act
EngagementDTO engagementModifie = await engagementService.RepondreEngagementAsync(engagementDTO, idEngagement);
// Assert
Assert.IsNotNull(engagementModifie);
Assert.AreEqual(idEngagement, engagementModifie.Id);
Assert.AreEqual(engagementDTO.Id, engagementModifie.Id);
Assert.AreEqual(engagementDTO.EtatEngagement, engagementModifie.EtatEngagement);
Assert.AreEqual(engagementDTO.RaisonNonRealisable, engagementModifie.RaisonNonRealisable);
}
[Test]
public async Task RepondreEngagementAsync_ModifieUnEngagementAvecUneDateLimitePasseeValide_EngagementModifieAvecSucces()
{
long idEngagement = 3;
long idEp = 9;
EtatEngagement etatEngagement = EtatEngagement.DateLimitePassee;
string raisonNonRealisableAvantUpdate = null;
string raisonNonRealisableApresUpdate = "La date limite pour respecter l'engagement est passée.";
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
EpInformationDTO epInformationDTO = epContext.Ep.Where(ep => ep.IdEP == idEp)
.Select(ep => new EpInformationDTO
{
Id = ep.IdEP,
Type = ep.TypeEP,
Statut = ep.Statut,
DateDisponibilite = ep.DateDisponibilite,
DatePrevisionnelle = ep.DatePrevisionnelle,
Obligatoire = ep.Obligatoire
}).FirstOrDefault();
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagement,
Action = "Je m'engage à trouver une formation sur l'Asp.Net Core.",
Dispositif = "Demande de formation RH.",
Modalite = "Sur temps de travail",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = etatEngagement,
RaisonNonRealisable = raisonNonRealisableAvantUpdate,
Ep = epInformationDTO
};
// Act
EngagementDTO engagementModifie = await engagementService.RepondreEngagementAsync(engagementDTO, idEngagement);
// Assert
Assert.IsNotNull(engagementModifie);
Assert.AreEqual(idEngagement, engagementModifie.Id);
Assert.AreEqual(engagementDTO.Id, engagementModifie.Id);
Assert.AreEqual(engagementDTO.EtatEngagement, engagementModifie.EtatEngagement);
Assert.AreEqual(raisonNonRealisableApresUpdate, engagementModifie.RaisonNonRealisable);
}
[TestCase(1, 0, "Je m'engage à trouver une formation sur l'Asp.Net Core.", "Demande de formation RH.", "Sur temps de travail", "2020-9-11", EtatEngagement.Respecte, null)]
[TestCase(1, 11, "Je m'engage à trouver une formation sur l'Asp.Net Core.", "Demande de formation RH.", "Sur temps de travail", "2020-9-11", EtatEngagement.Respecte, null)]
[TestCase(1, 9, "", "Demande de formation RH.", "Sur temps de travail", "2020-9-11", EtatEngagement.Respecte, null)]
[TestCase(1, 9, "Je m'engage à trouver une formation sur l'Asp.Net Core.", "", "Sur temps de travail", "2020-9-11", EtatEngagement.Respecte, null)]
[TestCase(1, 9, "Je m'engage à trouver une formation sur l'Asp.Net Core.", "Demande de formation RH.", "", "2020-9-11", EtatEngagement.Respecte, null)]
[TestCase(1, 9, "Je m'engage à trouver une formation sur l'Asp.Net Core.", "Demande de formation RH.", "Sur temps de travail", null, EtatEngagement.Respecte, null)]
[TestCase(1, 9, "Je m'engage à trouver une formation sur l'Asp.Net Core.", "Demande de formation RH.", "Sur temps de travail", "2020-9-11", EtatEngagement.NonRealisable, null)]
public void RepondreEngagementAsync_ModifieUnEngagementAvecDesProprietesInvalide_LeveUneEngagementInvalidException(long idEngagement, long idEp, string action, string dispositif, string modalite, DateTime? dateLimite, EtatEngagement etatEngagement, string raisonNonRealisable)
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
EpInformationDTO epInformationDTO = epContext.Ep.Where(ep => ep.IdEP == idEp)
.Select(ep => new EpInformationDTO
{
Id = ep.IdEP,
Type = ep.TypeEP,
Statut = ep.Statut,
DateDisponibilite = ep.DateDisponibilite,
DatePrevisionnelle = ep.DatePrevisionnelle,
Obligatoire = ep.Obligatoire
}).FirstOrDefault();
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagement,
Action = action,
Dispositif = dispositif,
Modalite = modalite,
DateLimite = dateLimite,
EtatEngagement = etatEngagement,
RaisonNonRealisable = raisonNonRealisable,
Ep = epInformationDTO
};
// Act
AsyncTestDelegate throwException = () => engagementService.RepondreEngagementAsync(engagementDTO, idEngagement);
// Assert
Assert.ThrowsAsync(typeof(EngagementInvalidException), throwException);
}
[Test]
public void RepondreEngagementAsync_ModifieUnEngagementNull_LeveUneEngagementInvalidException()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
EngagementDTO engagementDTO = null;
long idEngagement = 1;
// Act
AsyncTestDelegate throwException = () => engagementService.RepondreEngagementAsync(engagementDTO, idEngagement);
// Assert
Assert.ThrowsAsync(typeof(EngagementInvalidException), throwException);
}
[Test]
public void RepondreEngagementAsync_ModifieUnEngagementAvecUnEPInexistantDansLaBDD_LeveUneEngagementInvalidException()
{
// Arrange
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
long idEngagement = 1;
EpInformationDTO epInformationDTO = new EpInformationDTO
{
Id = 999,
Type = TypeEp.EPA,
Statut = StatutEp.Signe,
DateDisponibilite = DateTime.Now,
DatePrevisionnelle = DateTime.Now,
Obligatoire = false
};
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagement,
Action = "Je m'engage à trouver une formation sur l'Asp.Net Core.",
Dispositif = "Demande de formation RH.",
Modalite = "Sur temps de travail",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = EtatEngagement.Respecte,
RaisonNonRealisable = null,
Ep = epInformationDTO
};
// Act
AsyncTestDelegate throwException = () => engagementService.RepondreEngagementAsync(engagementDTO, idEngagement);
// Assert
Assert.ThrowsAsync(typeof(EngagementInvalidException), throwException);
}
[TestCase(1)]
[TestCase(null)]
public void RepondreEngagementAsync_ModifieUnEngagementAvecUnIdIncorrecte_LeveUneEngagementnIncompatibleIdException(long? idEngagement)
{
// Arrange
long idEngagementIncorrecte = 2;
long idEp = 9;
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
EpInformationDTO epInformationDTO = epContext.Ep.Where(ep => ep.IdEP == idEp)
.Select(ep => new EpInformationDTO
{
Id = ep.IdEP,
Type = ep.TypeEP,
Statut = ep.Statut,
DateDisponibilite = ep.DateDisponibilite,
DatePrevisionnelle = ep.DatePrevisionnelle,
Obligatoire = ep.Obligatoire
}).FirstOrDefault();
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagement,
Action = "Je m'engage à trouver une formation sur l'Asp.Net Core.",
Dispositif = "Demande de formation RH.",
Modalite = "Sur temps de travail",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = EtatEngagement.Respecte,
RaisonNonRealisable = null,
Ep = epInformationDTO
};
// Act
AsyncTestDelegate throwException = () => engagementService.RepondreEngagementAsync(engagementDTO, idEngagementIncorrecte);
// Assert
Assert.ThrowsAsync(typeof(EngagementIncompatibleIdException), throwException);
}
[Test]
public void RepondreEngagementAsync_ModifieUnEngagementAvecUnIdInexistant_LeveUneEngagementNotFoundException()
{
// Arrange
long idEngagement = 0;
long idEp = 9;
EngagementService engagementService = new EngagementService(epContext, collaborateurService, transformDTO);
EpInformationDTO epInformationDTO = epContext.Ep.Where(ep => ep.IdEP == idEp)
.Select(ep => new EpInformationDTO
{
Id = ep.IdEP,
Type = ep.TypeEP,
Statut = ep.Statut,
DateDisponibilite = ep.DateDisponibilite,
DatePrevisionnelle = ep.DatePrevisionnelle,
Obligatoire = ep.Obligatoire
}).FirstOrDefault();
EngagementDTO engagementDTO = new EngagementDTO
{
Id = idEngagement,
Action = "Je m'engage à trouver une formation sur l'Asp.Net Core.",
Dispositif = "Demande de formation RH.",
Modalite = "Sur temps de travail",
DateLimite = new DateTime(2020, 9, 1),
EtatEngagement = EtatEngagement.Respecte,
RaisonNonRealisable = null,
Ep = epInformationDTO
};
// Act
AsyncTestDelegate throwException = () => engagementService.RepondreEngagementAsync(engagementDTO, idEngagement);
// Assert
Assert.ThrowsAsync(typeof(EngagementNotFoundException), throwException);
}
#endregion
}
}

@ -0,0 +1,296 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.IServices;
using EPAServeur.Models.EP;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.DTO;
using IO.Swagger.Enum;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Services
{
[TestFixture]
public class EpDetailsServiceTests
{
#region variables
private EpContext context;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
DataSeeder.AddTypesEntretien(context);
DataSeeder.AddEp(context);
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(new CollaborateurApi(), context, transformDTO);
}
#endregion
#region Récupérer EP simple
[TestCase(1, "301ba7f3-095e-4912-8998-a7c942dc5f23", StatutEp.Disponible)]
[TestCase(2, "e7820f92-eab1-42f5-ae96-5c16e71ff1e6", StatutEp.DatesProposees)]
[TestCase(5, "17b87130-0e9d-4b78-b0e3-a11e5f70318d", StatutEp.AttenteEntretien)]
[TestCase(14, "a0f40e2a-cc03-4032-a627-5389e1281c64", StatutEp.Signe)]
public async Task GetEpById(long idEP, Guid? idCollaborateur, StatutEp statutEp)
{
Ep ep = await context.Ep.FindAsync(idEP);
Assert.IsNotNull(ep);
Assert.AreEqual(idEP, ep.IdEP);
Assert.AreEqual(idCollaborateur, ep.IdCollaborateur);
Assert.AreEqual(statutEp, ep.Statut);
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(ep.IdEP);
Assert.IsNotNull(epDTO);
Assert.AreEqual(epDTO.Collaborateur.Id, ep.IdCollaborateur);
Assert.AreEqual(epDTO.Statut, ep.Statut);
Assert.AreEqual(epDTO.Id, ep.IdEP);
}
#endregion
#region Récupérer EP exceptions
[TestCase(-999)]
[TestCase(20)]
[TestCase(100)]
[TestCase(0)]
public void GetEPById_NotFoundException(long idEp)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
AsyncTestDelegate exception = () => epDetailsService.GetEp(idEp);
Assert.ThrowsAsync(typeof(EpNotFoundException), exception);
}
#endregion
#region Récupérer EP avec Engagements
[TestCase(6, 3)]
[TestCase(8, 0)]
[TestCase(10, 1)]
public async Task GetEPById_GetEngagement(long idEP, int count)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEP);
if(count == 0)
{
Assert.IsNull(epDTO.Engagements);
}
else
{
Assert.IsNotNull(epDTO.Engagements);
Assert.AreEqual(count, epDTO.Engagements.Count);
}
}
#endregion
#region Récupérer EP avec participant EP
[TestCase(1,0)]
[TestCase(3,2)]
[TestCase(5,1)]
[TestCase(11,2)]
public async Task GetEpById_GetParticipantEP(long idEP, int count)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEP);
if (count == 0)
{
Assert.IsNull(epDTO.Participants);
}
else
{
Assert.IsNotNull(epDTO.Participants);
Assert.AreEqual(count, epDTO.Participants.Count);
}
}
#endregion
#region Récupérer EP avec CommentaireAssistant
[TestCase(2, 2)]
[TestCase(4, 0)]
[TestCase(16, 1)]
public async Task GetEpById_GetCommentairesAssistant(long idEP, int count)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEP);
if (count == 0)
{
Assert.IsNull(epDTO.CommentairesAssistant);
}
else
{
Assert.IsNotNull(epDTO.CommentairesAssistant);
Assert.AreEqual(count, epDTO.CommentairesAssistant.Count);
}
}
#endregion
#region Récupérer EP avec demandes de délégation
[TestCase(1, false)]
[TestCase(2, true)]
[TestCase(4, true)]
[TestCase(8, true)]
[TestCase(9, false)]
[TestCase(12, false)]
public async Task GetEpById_GetDemandeDelegation(long idEp, bool possedeDemandeDelegation)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEp);
if(possedeDemandeDelegation)
Assert.IsNotNull(epDTO.DemandesDelegation);
else
Assert.IsNull(epDTO.DemandesDelegation);
}
#endregion
#region Récupérer EP avec RDV entretiens
[TestCase(2)]
[TestCase(5)]
[TestCase(12)]
public async Task GetEp_GetRDVEntretien(long idEp)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEp);
Assert.IsNotNull(epDTO);
Assert.IsNotNull(epDTO.RdvEntretien);
Assert.IsNotNull(epDTO.RdvEntretien.DateEntretien);
}
[TestCase(1, 0)]
[TestCase(2, 3)]
[TestCase(5, 2)]
[TestCase(11, 0)]
[TestCase(13, 0)]
public async Task GetEp_GetPropositionRDVEntretien(long idEp, int count)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEp);
Assert.IsNotNull(epDTO);
if( count == 0)
{
Assert.IsNull(epDTO.PropositionsEntretien);
}
else
{
Assert.IsNotNull(epDTO.PropositionsEntretien);
Assert.AreEqual(epDTO.PropositionsEntretien.Count, count);
Assert.IsTrue(epDTO.PropositionsEntretien.Count <= 3);
Assert.IsTrue(epDTO.PropositionsEntretien.Count > 0);
Assert.Less(epDTO.Statut, StatutEp.Effectue);
}
}
#endregion
#region Récupérer EP avec choix type entretien
[TestCase(1, 0)]
[TestCase(2, 4)]
[TestCase(4, 1)]
[TestCase(5, 2)]
[TestCase(10, 0)]
[TestCase(12, 0)]
public async Task GetEp_GetChoixTypeEntretien(long idEp, int count)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEp);
Assert.IsNotNull(epDTO);
if (count == 0)
{
Assert.IsNull(epDTO.ChoixTypeEntretien);
}
else
{
Assert.IsNotNull(epDTO.ChoixTypeEntretien);
Assert.AreEqual(epDTO.ChoixTypeEntretien.Count, count);
Assert.Less(epDTO.Statut, StatutEp.Effectue);
}
}
#endregion
#region Objectifs
[TestCase(3, true)]
[TestCase(7, false)]
[TestCase(10, true)]
public async Task GetEp_Objectifs_ObjectifsPrecedents(long idEp, bool possedeObjectifsPref)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEp);
Assert.IsNotNull(epDTO);
Assert.IsNotNull(epDTO.Objectifs);
Assert.AreEqual(3, epDTO.Objectifs.Count);
if (possedeObjectifsPref)
{
Assert.IsNotNull(epDTO.ObjectifsPrecedent);
Assert.AreEqual(3, epDTO.ObjectifsPrecedent.Count);
}else
{
Assert.IsNull(epDTO.ObjectifsPrecedent);
}
}
#endregion
#region Demande EPI
[TestCase(4)]
[TestCase(8)]
[TestCase(13)]
public async Task GetEp_GetDemandeEPI(long idEp)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEp);
Assert.IsNotNull(epDTO);
Assert.IsNotNull(epDTO.DemandeEPI);
Assert.IsTrue(epDTO.Collaborateur.Id.Equals(epDTO.DemandeEPI.Collaborateur.Id));
Assert.AreEqual(epDTO.DemandeEPI.EtatDemande, EtatDemande.Validee);
}
#endregion
#region Récupérer EP avec demandes de formation
[TestCase(1,0)]
[TestCase(2,0)]
[TestCase(3,1)]
[TestCase(12,3)]
[TestCase(16,0)]
public async Task GetEp_GetpDemandesFormation(long idEp, int count)
{
IEpDetailsService epDetailsService = new EpDetailsService(context, transformDTO, collaborateurService);
EpDTO epDTO = await epDetailsService.GetEp(idEp);
Assert.IsNotNull(epDTO);
if(count == 0)
{
Assert.IsNull(epDTO.DemandesFormation);
}
else
{
Assert.IsNotNull(epDTO.DemandesFormation);
Assert.AreEqual(epDTO.DemandesFormation.Count, count);
}
}
#endregion
}
}

@ -0,0 +1,603 @@
using EPAServeur.Context;
using EPAServeur.IServices;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.DTO;
using IO.Swagger.Enum;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Services
{
[TestFixture]
public class EpInformationTests
{
#region
private EpContext context;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddEp(context);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(new CollaborateurApi(), context, transformDTO);
}
#endregion
#region Récupération des EP en cours
[TestCase(1, 3)] //Tours
[TestCase(2, 3)] //Orléans
[TestCase(3, 3)] // Paris
public async Task GetEpEnCours_UneBU(long? idBUs, int nbElements)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?>{ idBUs }, true, 1, 15, "", false,"", null, null);
int count = await epInformationService.GetEPEnCoursCount(new List<long?> { idBUs }, "", false, null, null);
Assert.AreEqual(count, nbElements);
Assert.AreEqual(count, epInformationDTOs.Count());
foreach(EpInformationDTO ep in epInformationDTOs)
{
Assert.AreEqual(ep.Collaborateur.BusinessUnit.Id, idBUs);
Assert.IsTrue(EstEpEnCours(ep.Statut));
}
}
[Test]
public async Task GetEpEnCours_OrleansTours()
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1,2 }, true, 1, 15, "", false, "", null, null);
int count = await epInformationService.GetEPEnCoursCount(new List<long?> { 1, 2 }, "", false, null, null);
Assert.AreEqual(count, 6);
Assert.AreEqual(count, epInformationDTOs.Count());
long? bu;
foreach(EpInformationDTO ep in epInformationDTOs)
{
bu = ep.Collaborateur.BusinessUnit.Id;
Assert.IsTrue(bu == 1 || bu == 2);
Assert.IsTrue(EstEpEnCours(ep.Statut));
}
}
//tri colonne
[TestCase("agence")]
[TestCase("collaborateur")]
[TestCase("referent")]
[TestCase("dateentretien")]
[TestCase("typeep")]
[TestCase("statutep")]
[TestCase("datearrivee")]
[TestCase("datedisponibilite")]
public async Task GetEpEnCours_TriColonneASC(string tri)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", false, tri, null, null);
EpInformationDTO ep1, ep2;
int compare = 0;
for(int i = 0; i < epInformationDTOs.Count()-1; ++i)
{
ep1 = epInformationDTOs.ElementAt(i);
ep2 = epInformationDTOs.ElementAt(i+1);
switch(tri)
{
case "agence":
compare = ep1.Collaborateur.BusinessUnit.Nom.CompareTo(ep2.Collaborateur.BusinessUnit.Nom);
break;
case "collaborateur":
compare = (ep1.Collaborateur.Nom + " " + ep1.Collaborateur.Prenom).CompareTo((ep2.Collaborateur.Nom + " " + ep2.Collaborateur.Prenom));
break;
case "referent":
compare = (ep1.Referent.Nom + " " + ep1.Referent.Prenom).CompareTo((ep2.Referent.Nom + " " + ep2.Referent.Prenom));
break;
case "dateentretien":
compare = ep1.DatePrevisionnelle.Value.CompareTo(ep2.DatePrevisionnelle.Value);
break;
case "typeep":
compare = ep1.Type.CompareTo(ep2.Type);
break;
case "statutep":
compare = ep1.Statut.CompareTo(ep2.Statut);
break;
case "datearrivee":
compare = ep1.Collaborateur.DateArrivee.Value.CompareTo(ep2.Collaborateur.DateArrivee.Value);
break;
case "datedisponibilite":
compare = ep1.DateDisponibilite.Value.CompareTo(ep2.DateDisponibilite.Value);
break;
}
Assert.IsTrue(compare <= 0);
Assert.IsTrue(EstEpEnCours(ep1.Statut));
Assert.IsTrue(EstEpEnCours(ep2.Statut));
}
}
//tri colonne
[TestCase("agence")]
[TestCase("collaborateur")]
[TestCase("referent")]
[TestCase("dateentretien")]
[TestCase("typeep")]
[TestCase("statutep")]
[TestCase("datearrivee")]
[TestCase("datedisponibilite")]
public async Task GetEpEnCours_TriColonneDESC(string tri)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, false, 1, 15, "", false, tri, null, null);
EpInformationDTO ep1, ep2;
int compare = 0;
for (int i = 0; i < epInformationDTOs.Count() - 1; ++i)
{
ep1 = epInformationDTOs.ElementAt(i);
ep2 = epInformationDTOs.ElementAt(i + 1);
switch (tri)
{
case "agence":
compare = ep1.Collaborateur.BusinessUnit.Nom.CompareTo(ep2.Collaborateur.BusinessUnit.Nom);
break;
case "collaborateur":
compare = (ep1.Collaborateur.Nom + " " + ep1.Collaborateur.Prenom).CompareTo((ep2.Collaborateur.Nom + " " + ep2.Collaborateur.Prenom));
break;
case "referent":
compare = (ep1.Referent.Nom + " " + ep1.Referent.Prenom).CompareTo((ep2.Referent.Nom + " " + ep2.Referent.Prenom));
break;
case "dateentretien":
compare = ep1.DatePrevisionnelle.Value.CompareTo(ep2.DatePrevisionnelle.Value);
break;
case "typeep":
compare = ep1.Type.CompareTo(ep2.Type);
break;
case "statutep":
compare = ep1.Statut.CompareTo(ep2.Statut);
break;
case "datearrivee":
compare = ep1.Collaborateur.DateArrivee.Value.CompareTo(ep2.Collaborateur.DateArrivee.Value);
break;
case "datedisponibilite":
compare = ep1.DateDisponibilite.Value.CompareTo(ep2.DateDisponibilite.Value);
break;
}
Assert.IsTrue(compare >= 0);
Assert.IsTrue(EstEpEnCours(ep1.Statut));
Assert.IsTrue(EstEpEnCours(ep2.Statut));
}
}
//tris date
[TestCase(01, 03, 2021, 5)]
[TestCase(20, 03, 2021, 2)]
[TestCase(01, 04, 2021, 0)]
public async Task GetEpEnCours_TriDateD1(int j, int m, int a, int count)
{
DateTime date = new DateTime(a, m, j);
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", false, "", date, null);
Assert.AreEqual(epInformationDTOs.Count(), count);
foreach(EpInformationDTO ep in epInformationDTOs)
{
Assert.IsTrue(date <= ep.DatePrevisionnelle.Value);
Assert.IsTrue(EstEpEnCours(ep.Statut));
}
}
[TestCase(01, 04, 2021, 6)]
[TestCase(15, 03, 2021, 3)]
[TestCase(1, 02, 2021, 0)]
public async Task GetEpEnCours_TriDateD2(int j, int m, int a, int count)
{
DateTime date = new DateTime(a, m, j); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", false, "", null, date);
Assert.AreEqual(epInformationDTOs.Count(), count);
foreach (EpInformationDTO ep in epInformationDTOs)
{
Assert.IsTrue(date >= ep.DatePrevisionnelle.Value);
Assert.IsTrue(EstEpEnCours(ep.Statut));
}
}
[TestCase(01, 02, 2021, 28, 02, 2021, 1)]
[TestCase(01, 02, 2021, 01, 04, 2021, 6)]
[TestCase(15, 02, 2021, 15, 03, 2021, 3)]
[TestCase(01, 01, 2021, 31, 01, 2021, 0)]
[TestCase(01, 01, 2022, 31, 01, 2022, 0)]
public async Task GetEpEnCours_TriDateD1D2(int j1, int m1, int a1, int j2, int m2, int a2, int count)
{
DateTime date1 = new DateTime(a1, m1, j1);
DateTime date2 = new DateTime(a2, m2, j2);
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, "", false, "", date1, date2);
Assert.AreEqual(epInformationDTOs.Count(), count);
foreach (EpInformationDTO ep in epInformationDTOs)
{
Assert.IsTrue(condition: date1 <= ep.DatePrevisionnelle.Value);
Assert.IsTrue(date2 >= ep.DatePrevisionnelle.Value);
Assert.IsTrue(EstEpEnCours(ep.Statut));
}
}
//Tri texte
[TestCase("", 6)]
[TestCase("Ma", 2)]
[TestCase("Ne", 2)]
[TestCase("nE", 2)]
[TestCase("ma", 2)]
[TestCase("D", 2)]
[TestCase("d", 2)]
public async Task GetEpEnCours_texte(string texte, int count)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCours(new List<long?> { 1, 2 }, true, 1, 15, texte, false, "", null, null);
Assert.AreEqual(count, epInformationDTOs.Count());
foreach (EpInformationDTO ep in epInformationDTOs)
{
Assert.IsTrue((ep.Collaborateur.Nom + " " + ep.Collaborateur.Prenom).ToLower().Contains(texte.ToLower()) || (ep.Collaborateur.Prenom + " " + ep.Collaborateur.Nom).ToLower().Contains(texte.ToLower()));
Assert.IsTrue(EstEpEnCours(ep.Statut));
}
}
#endregion
#region Récupération des EP signés
[TestCase(1, 3)] //Tours
[TestCase(2, 3)] //Orléans
[TestCase(3, 3)] // Paris
public async Task GetEpSignes_UneBU(long? idBUs, int nbElements)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignes(new List<long?>{ idBUs }, true, 1, 15, "", "", null, null);
int count = await epInformationService.GetEPSignesCount(new List<long?> { idBUs }, "", null, null);
Assert.AreEqual(count, nbElements);
Assert.AreEqual(count, epInformationDTOs.Count());
foreach(EpInformationDTO ep in epInformationDTOs)
{
Assert.AreEqual(ep.Collaborateur.BusinessUnit.Id, idBUs);
Assert.IsTrue(ep.Statut == StatutEp.Signe);
}
}
public async Task GetEpSignes_OrleansTours()
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignes(new List<long?> { 1,2 }, true, 1, 15, "", "", null, null);
int count = await epInformationService.GetEPSignesCount(new List<long?> { 1, 2 }, "", null, null);
Assert.AreEqual(count, 8);
Assert.AreEqual(count, epInformationDTOs.Count());
long? bu;
foreach(EpInformationDTO ep in epInformationDTOs)
{
bu = ep.Collaborateur.BusinessUnit.Id;
Assert.IsTrue(bu == 1 || bu == 2);
Assert.IsTrue(ep.Statut == StatutEp.Signe);
}
}
//tri colonne
[TestCase("agence")]
[TestCase("collaborateur")]
[TestCase("referent")]
[TestCase("dateentretien")]
[TestCase("typeep")]
[TestCase("statutep")]
[TestCase("datearrivee")]
[TestCase("datedisponibilite")]
public async Task GetEpSignes_TriColonneASC(string tri)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignes(new List<long?> { 1, 2 }, true, 1, 15, "", tri, null, null);
EpInformationDTO ep1, ep2;
int compare = 0;
for(int i = 0; i < epInformationDTOs.Count()-1; ++i)
{
ep1 = epInformationDTOs.ElementAt(i);
ep2 = epInformationDTOs.ElementAt(i+1);
switch(tri)
{
case "agence":
compare = ep1.Collaborateur.BusinessUnit.Nom.CompareTo(ep2.Collaborateur.BusinessUnit.Nom);
break;
case "collaborateur":
compare = (ep1.Collaborateur.Nom + " " + ep1.Collaborateur.Prenom).CompareTo((ep2.Collaborateur.Nom + " " + ep2.Collaborateur.Prenom));
break;
case "referent":
compare = (ep1.Referent.Nom + " " + ep1.Referent.Prenom).CompareTo((ep2.Referent.Nom + " " + ep2.Referent.Prenom));
break;
case "dateentretien":
compare = ep1.DatePrevisionnelle.Value.CompareTo(ep2.DatePrevisionnelle.Value);
break;
case "typeep":
compare = ep1.Type.CompareTo(ep2.Type);
break;
case "statutep":
compare = ep1.Statut.CompareTo(ep2.Statut);
break;
case "datearrivee":
compare = ep1.Collaborateur.DateArrivee.Value.CompareTo(ep2.Collaborateur.DateArrivee.Value);
break;
case "datedisponibilite":
compare = ep1.DateDisponibilite.Value.CompareTo(ep2.DateDisponibilite.Value);
break;
}
Assert.IsTrue(compare <= 0);
Assert.IsTrue(ep1.Statut == StatutEp.Signe);
Assert.IsTrue(ep2.Statut == StatutEp.Signe);
}
}
//tri colonne
[TestCase("agence")]
[TestCase("collaborateur")]
[TestCase("referent")]
[TestCase("dateentretien")]
[TestCase("typeep")]
[TestCase("statutep")]
[TestCase("datearrivee")]
[TestCase("datedisponibilite")]
public async Task GetEpSignes_TriColonneDESC(string tri)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignes(new List<long?> { 1, 2 }, false, 1, 15, "", tri, null, null);
EpInformationDTO ep1, ep2;
int compare = 0;
for (int i = 0; i < epInformationDTOs.Count() - 1; ++i)
{
ep1 = epInformationDTOs.ElementAt(i);
ep2 = epInformationDTOs.ElementAt(i + 1);
switch (tri)
{
case "agence":
compare = ep1.Collaborateur.BusinessUnit.Nom.CompareTo(ep2.Collaborateur.BusinessUnit.Nom);
break;
case "collaborateur":
compare = (ep1.Collaborateur.Nom + " " + ep1.Collaborateur.Prenom).CompareTo((ep2.Collaborateur.Nom + " " + ep2.Collaborateur.Prenom));
break;
case "referent":
compare = (ep1.Referent.Nom + " " + ep1.Referent.Prenom).CompareTo((ep2.Referent.Nom + " " + ep2.Referent.Prenom));
break;
case "dateentretien":
compare = ep1.DatePrevisionnelle.Value.CompareTo(ep2.DatePrevisionnelle.Value);
break;
case "typeep":
compare = ep1.Type.CompareTo(ep2.Type);
break;
case "statutep":
compare = ep1.Statut.CompareTo(ep2.Statut);
break;
case "datearrivee":
compare = ep1.Collaborateur.DateArrivee.Value.CompareTo(ep2.Collaborateur.DateArrivee.Value);
break;
case "datedisponibilite":
compare = ep1.DateDisponibilite.Value.CompareTo(ep2.DateDisponibilite.Value);
break;
}
Assert.IsTrue(compare >= 0);
Assert.IsTrue(ep1.Statut == StatutEp.Signe);
Assert.IsTrue(ep2.Statut == StatutEp.Signe);
}
}
//tris date
[TestCase(01, 01, 2018, 4)]
[TestCase(01, 01, 2019, 2)]
[TestCase(01, 01, 2020, 1)]
[TestCase(01, 01, 2021, 0)]
[TestCase(01, 01, 2022, 0)]
public async Task GetEpSignes_TriDateD1(int j, int m, int a, int count)
{
DateTime date = new DateTime(a, m, j);
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignes(new List<long?> { 1, 2 }, true, 1, 15, "", "", date, null);
Assert.AreEqual(epInformationDTOs.Count(), count);
foreach(EpInformationDTO ep in epInformationDTOs)
{
Assert.IsTrue(date <= ep.DatePrevisionnelle.Value);
Assert.IsTrue(ep.Statut == StatutEp.Signe);
}
}
[TestCase(31, 12, 2019)]
[TestCase(01, 01, 2019)]
[TestCase(31, 07, 2018)]
[TestCase(31, 07, 2017)]
public async Task GetEpSignes_TriDateD2(int j, int m, int a)
{
DateTime date = new DateTime(a, m, j); IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignes(new List<long?> { 1, 2 }, true, 1, 15, "", "", null, date);
int count = await epInformationService.GetEPSignesCount(new List<long?> { 1, 2 }, "", null, date);
Assert.AreEqual(epInformationDTOs.Count(), count);
foreach (EpInformationDTO ep in epInformationDTOs)
{
Assert.IsTrue(date >= ep.DatePrevisionnelle.Value);
Assert.IsTrue(ep.Statut == StatutEp.Signe);
}
}
[TestCase(01, 07, 2021, 31, 12, 2021, 0)]
[TestCase(01, 09, 2018, 01, 12, 2019, 1)]
[TestCase(01, 01, 2018, 31, 12, 2019, 3)]
[TestCase(01, 01, 2017, 31, 12, 2017, 2)]
public async Task GetEpSignes_TriDateD1D2(int j1, int m1, int a1, int j2, int m2, int a2, int count)
{
DateTime date1 = new DateTime(a1, m1, j1);
DateTime date2 = new DateTime(a2, m2, j2);
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignes(new List<long?> { 1, 2 }, true, 1, 15, "", "", date1, date2);
Assert.AreEqual(epInformationDTOs.Count(), count);
foreach (EpInformationDTO ep in epInformationDTOs)
{
Assert.IsTrue(condition: date1 <= ep.DatePrevisionnelle.Value);
Assert.IsTrue(date2 >= ep.DatePrevisionnelle.Value);
Assert.IsTrue(ep.Statut == StatutEp.Signe);
}
}
//Tri texte
[TestCase("", 6)]
[TestCase("Ma", 1)]
[TestCase("Ne", 1)]
[TestCase("nE", 1)]
[TestCase("ma", 1)]
[TestCase("D", 2)]
[TestCase("d", 2)]
public async Task GetEpSignes_texte(string texte, int count)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignes(new List<long?> { 1, 2 }, true, 1, 15, texte, "", null, null);
Assert.AreEqual(count, epInformationDTOs.Count());
foreach (EpInformationDTO ep in epInformationDTOs)
{
Assert.IsTrue((ep.Collaborateur.Nom + " " + ep.Collaborateur.Prenom).ToLower().Contains(texte.ToLower()) || (ep.Collaborateur.Prenom + " " + ep.Collaborateur.Nom).ToLower().Contains(texte.ToLower()));
Assert.IsTrue(ep.Statut == StatutEp.Signe);
}
}
#endregion
#region Récupération des EP signés d'un collaborateur
[TestCase("ea027734-ff0f-4308-8879-133a09fb3c46", 1)]
[TestCase("56e3d82d-4be4-4449-a1f7-b4004b6bd186", 1)]
[TestCase("3f276ab8-727a-4e26-ad5d-4d296158688e", 1)]
[TestCase("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d", 1)]
[TestCase("eb8b0f33-f529-4985-861e-1207f3312bb5", 2)]
[TestCase("eb8b0f33-f529-4985-861e-1207f3312bb4", 0)]
[TestCase("ea027734-ff0f-4308-8879-133a09fb3c46", 1)]
[TestCase("80220063-a5fa-472b-b610-2e350566df98", 1)]
public async Task GetEPCoursReferent(Guid idReferent, int count)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPEnCoursReferent(idReferent, true, 1, 15, "", "", null, null);
int epCount = await epInformationService.GetEPEnCoursReferentCount(idReferent, "", null, null);
Assert.AreEqual(epCount, count);
foreach(EpInformationDTO ep in epInformationDTOs)
{
Assert.AreEqual(ep.Referent.Id, idReferent);
Assert.IsTrue(EstEpEnCours(ep.Statut));
}
}
#endregion
#region Récupération des EP
[TestCase("56e3d82d-4be4-4449-a1f7-b4004b6bd186", 1)]
[TestCase("3f276ab8-727a-4e26-ad5d-4d296158688e", 1)]
[TestCase("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d", 1)]
[TestCase("eb8b0f33-f529-4985-861e-1207f3312bb5", 2)]
[TestCase("d4fc247b-015a-44d6-8f3e-a52f0902d2bf", 1)]
[TestCase("b799a9de-7743-435e-933f-7f730affc5ae", 1)]
[TestCase("b799a9de-7743-435e-933f-7f730affc5a5", 0)]
[TestCase("ea027734-ff0f-4308-8879-133a09fb3c46", 1)]
public async Task GetEPEnSignesReferent(Guid idReferent, int count)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignesReferent(idReferent, true, 1, 15, "", "", null, null);
int epCount = await epInformationService.GetEPSignesReferentCount(idReferent, "", null, null);
Assert.AreEqual(epCount, count);
foreach (EpInformationDTO ep in epInformationDTOs)
{
Assert.AreEqual(ep.Referent.Id, idReferent);
Assert.IsTrue(ep.Statut.Equals(StatutEp.Signe));
}
}
#endregion
#region Récupérés EP signés collaborateur
[TestCase("301ba7f3-095e-4912-8998-a7c942dc5f23", 1)]
[TestCase("4f3fcd23-a1e4-4c9e-afa2-d06ca9216491", 0)]
[TestCase("e7820f92-eab1-42f5-ae96-5c16e71ff1e6", 1)]
[TestCase("a0f40e2a-cc03-4032-a627-5389e1281c64", 3)]
[TestCase("b5254c6c-7caa-435f-a4bb-e0cf92559832", 1)]
[TestCase("b5254c6c-7caa-435f-a4bb-e0cf92559830", 0)]
[TestCase("13fbe621-1bc9-4f04-afde-b54ca076e239", 3)]
public async Task GetEPSignesCollaborateur(Guid idCollaborateur, int count)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
IEnumerable<EpInformationDTO> epInformationDTOs = await epInformationService.GetEPSignesCollaborateur(idCollaborateur);
Assert.AreEqual(count, epInformationDTOs.Count());
foreach(EpInformationDTO ep in epInformationDTOs)
{
Assert.AreEqual(ep.Statut, StatutEp.Signe);
Assert.AreEqual(idCollaborateur, ep.Collaborateur.Id);
}
}
#endregion
#region Récupéré EP en cours d'un collaborateur
[TestCase("301ba7f3-095e-4912-8998-a7c942dc5f23", true)]
[TestCase("eb8b0f33-f529-4985-861e-1207f3312bb5", false)]
[TestCase("e7820f92-eab1-42f5-ae96-5c16e71ff1e6", true)]
[TestCase("a0f40e2a-cc03-4032-a627-5389e1281c64", true)]
[TestCase("b799a9de-7743-435e-933f-7f730affc5ae", false)]
[TestCase("de98a866-736f-4295-a669-92a8694e2ee3", true)]
public async Task GetEPEnCoursCollaborateur(Guid idCollaborateur, bool existe)
{
IEpInformationService epInformationService = new EpInformationService(context, collaborateurService, transformDTO);
EpInformationDTO epInformationDTO = await epInformationService.GetProchainEPCollaborateur(idCollaborateur);
if(existe)
{
Assert.IsNotNull(epInformationDTO);
Assert.IsTrue(EstEpEnCours(epInformationDTO.Statut));
Assert.AreEqual(idCollaborateur, epInformationDTO.Collaborateur.Id);
}
else
{
Assert.IsNull(epInformationDTO);
}
}
#endregion
#region méthodes privées
private bool EstEpEnCours(StatutEp statut)
{
return statut != StatutEp.Annule && statut != StatutEp.Cree && statut != StatutEp.Rejete && statut != StatutEp.Signe;
}
#endregion
}
}

@ -0,0 +1,983 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.IServices;
using EPAServeur.Models.Formation;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.DTO;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Services
{
[TestFixture]
public class FormationServiceTests
{
#region Variables
private EpContext epContext;
private ICollaborateurApi collaborateurApi;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
epContext = new EpContext(optionBuider);
collaborateurApi = new CollaborateurApi();
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(collaborateurApi, epContext, transformDTO);
epContext.Database.EnsureDeleted();
epContext.Database.EnsureCreated();
epContext.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddFormations(epContext);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in epContext.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
}
#endregion
#region Tests GetFormationByIdAsync
[Test]
public async Task GetFormationByIdAsync_PasseEnParamUnIdExistantDansLeJeuDeDonneesFictif_RetourneUneFormation()
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
FormationDTO formationDTO = await formationService.GetFormationByIdAsync(3);
// Assert
Assert.AreEqual(3, formationDTO.Id);
Assert.AreEqual("Apprendre C# et le développement de logiciels avec WPF", formationDTO.Intitule);
Assert.AreEqual(1, formationDTO.IdAgence);
Assert.AreEqual(new DateTime(2020, 5, 25, 14, 0, 0), formationDTO.DateDebut);
Assert.AreEqual(new DateTime(2020, 5, 27), formationDTO.DateFin);
Assert.AreEqual(4, formationDTO.Heure);
Assert.AreEqual(2, formationDTO.Jour);
Assert.AreEqual("Organisme2", formationDTO.Organisme);
Assert.True(formationDTO.EstCertifiee);
Assert.IsNotNull(formationDTO.Participations);
Assert.AreEqual(new OrigineFormationDTO { Id = 3, Libelle = "Exigence Apside" }, formationDTO.Origine);
Assert.AreEqual(new StatutFormationDTO { Id = 1, Libelle = "Planifiée" }, formationDTO.Statut);
Assert.AreEqual(new ModeFormationDTO { Id = 4, Libelle = "E-learning" }, formationDTO.Mode);
Assert.AreEqual(new TypeFormationDTO { Id = 3, Libelle = "E-learning" }, formationDTO.Type);
}
[Test]
public async Task GetFormationByIdAsync_PasseEnParamUnIdExistantDansLeJeuDeDonneesFictif_RetourneUneFormationSansParticipation()
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
long idFormation = 11;
// Act
FormationDTO formationDTO = await formationService.GetFormationByIdAsync(idFormation);
// Assert
Assert.AreEqual(idFormation, formationDTO.Id);
Assert.AreEqual("Formation Clean Architecture .Net Core", formationDTO.Intitule);
Assert.AreEqual(1, formationDTO.IdAgence);
Assert.AreEqual(new DateTime(2020, 04, 6, 9, 0, 0), formationDTO.DateDebut);
Assert.AreEqual(new DateTime(2020, 04, 11), formationDTO.DateFin);
Assert.AreEqual(15, formationDTO.Heure);
Assert.AreEqual(5, formationDTO.Jour);
Assert.AreEqual("Organisme1", formationDTO.Organisme);
Assert.False(formationDTO.EstCertifiee);
Assert.IsNull(formationDTO.Participations);
Assert.AreEqual(new OrigineFormationDTO { Id = 4, Libelle = "Formation réglementaire" }, formationDTO.Origine);
Assert.AreEqual(new StatutFormationDTO { Id = 4, Libelle = "Annulée" }, formationDTO.Statut);
Assert.AreEqual(new ModeFormationDTO { Id = 3, Libelle = "Présentiel" }, formationDTO.Mode);
Assert.AreEqual(new TypeFormationDTO { Id = 2, Libelle = "Interne" }, formationDTO.Type);
}
[TestCase(-1)]
[TestCase(0)]
[TestCase(999999)]
public void GetFormationByIdAsync_PasseEnParamUnIdInexistantDansLeJeuDeDonneesFictif_LeveUneFormationNotFoundException(long idFormation)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
AsyncTestDelegate throwException = () => formationService.GetFormationByIdAsync(idFormation);
// Assert
Assert.ThrowsAsync(typeof(FormationNotFoundException), throwException);
}
#endregion
#region Tests GetFormationsAsync
[TestCase(1, new int[] { 1, 2, 3 }, true, 1, 5, "formation", null, null, null)]
[TestCase(1, new int[] { 1 }, false, 1, 5, "Formation Mainframe Complète", null, null, null)]
[TestCase(null, null, null, 2, 10, null, null, null, null)]
[TestCase(null, new int[] { 1 }, null, 1, 10, null, null, null, null)]
[TestCase(1, null, null, 1, 10, "for", null, null, null)]
[TestCase(1, new int[] { }, null, 1, 10, "for", null, null, null)]
public async Task GetFormationsAsync_PasseDesParamsValides_RetourneDesFormations(long? idAgence, int[] arrIdStatuts, bool? asc, int? numPage, int? parPAge, string texte, string tri, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
List<int?> idStatuts;
if (arrIdStatuts != null)
idStatuts = arrIdStatuts.Select(x => (int?)x).ToList();
else
idStatuts = null;
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(idAgence, idStatuts, asc, numPage, parPAge, texte, tri, dateDebut, dateFin);
// Assert
Assert.Less(0, formationDTOs.Count());
}
[TestCase(1, 5)]
[TestCase(1, 10)]
public async Task GetFormationsAsync_PasseEnParamNumPageEtParPage_RetourneLaPremierePageDesFormations(int? numPage, int? parPAge)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, numPage, parPAge, null, null, null, null);
// Assert
Assert.AreEqual(parPAge, formationDTOs.Count());
}
[TestCase(2, 5)]
[TestCase(2, 6)]
[TestCase(2, 10)]
[TestCase(2, 15)]
public async Task GetFormationsAsync_PasseEnParamNumPageEtParPage_RetourneLaDeuxiemePageDesFormations(int? numPage, int? parPAge)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
int? nbFormationDeuxiemePage;
switch (parPAge)
{
case 5:
nbFormationDeuxiemePage = 5;
break;
case 6:
nbFormationDeuxiemePage = 5;
break;
case 10:
nbFormationDeuxiemePage = 1;
break;
default:
nbFormationDeuxiemePage = 0;
break;
}
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, numPage, parPAge, null, null, null, null);
// Assert
Assert.AreEqual(nbFormationDeuxiemePage, formationDTOs.Count());
}
[TestCase(true, "intitule")]
[TestCase(true, null)]
[TestCase(true, "toto")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParIntituleCroissant(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual("Apprendre C# et le développement de logiciels avec WPF", formationDTOs.First().Intitule);
Assert.AreEqual("Formation Xamarin, Développer des applications mobiles en C# pour iOS et Android", formationDTOs.Last().Intitule);
}
[TestCase(false, "intitule")]
[TestCase(false, null)]
[TestCase(false, "toto")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParIntituleDecroissant(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual("Formation Xamarin, Développer des applications mobiles en C# pour iOS et Android", formationDTOs.First().Intitule);
Assert.AreEqual("Apprendre C# et le développement de logiciels avec WPF", formationDTOs.Last().Intitule);
}
[TestCase(true, "statut")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParStatutCroissant(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual("Annulée", formationDTOs.First().Statut.Libelle);
Assert.AreEqual("Replanifiée", formationDTOs.Last().Statut.Libelle);
}
[TestCase(false, "statut")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParStatutDecroissant(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual("Replanifiée", formationDTOs.First().Statut.Libelle);
Assert.AreEqual("Annulée", formationDTOs.Last().Statut.Libelle);
}
[TestCase(true, "participants")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParNombreDeParticipantsCroissant(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual(0, formationDTOs.First().NbParticipations);
Assert.AreEqual(2, formationDTOs.Last().NbParticipations);
}
[TestCase(false, "participants")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParNombreDeParticipantsDecroissant(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual(2, formationDTOs.First().NbParticipations);
Assert.AreEqual(0, formationDTOs.Last().NbParticipations);
}
[TestCase(true, "origine")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParOrigineCroissante(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual("Demande collaborateur", formationDTOs.First().Origine.Libelle);
Assert.AreEqual("Formation réglementaire", formationDTOs.Last().Origine.Libelle);
}
[TestCase(false, "origine")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParOrigineDecroissante(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual("Formation réglementaire", formationDTOs.First().Origine.Libelle);
Assert.AreEqual("Demande collaborateur", formationDTOs.Last().Origine.Libelle);
}
[TestCase(true, "date")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParDateCroissante(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual(new DateTime(2020, 1, 25, 10, 0, 0), formationDTOs.First().DateDebut);
Assert.AreEqual(new DateTime(2020, 12, 25, 14, 0, 0), formationDTOs.Last().DateDebut);
}
[TestCase(false, "date")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParDateDecroissante(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual(new DateTime(2020, 12, 25, 14, 0, 0), formationDTOs.First().DateDebut);
Assert.AreEqual(new DateTime(2020, 1, 25, 10, 0, 0), formationDTOs.Last().DateDebut);
}
[TestCase(true, "certification")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParCertificationCroissante(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual(false, formationDTOs.First().EstCertifiee);
Assert.AreEqual(true, formationDTOs.Last().EstCertifiee);
}
[TestCase(false, "certification")]
public async Task GetFormationsAsync_PasseEnParamAscEtTri_RetourneDesFormationsOrdonnanceeParCertificationDecroissante(bool? asc, string tri)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, asc, null, null, null, tri, null, null);
// Assert
Assert.AreEqual(true, formationDTOs.First().EstCertifiee);
Assert.AreEqual(false, formationDTOs.Last().EstCertifiee);
}
[TestCase("2020-10-01")]
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebut_RetourneDesFormationsAvecUneDateDeDebutSuperieur(DateTime dateDebut)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, dateDebut, null);
// Assert
Assert.Greater(formationDTOs.First().DateDebut, dateDebut);
Assert.GreaterOrEqual(formationDTOs.Last().DateDebut, dateDebut);
}
[TestCase("2020-10-01")]
public async Task GetFormationsAsync_PasseEnParamUneDateDeFin_RetourneDesFormationsAvecUneDateDeFinInferieur(DateTime dateFin)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, null, dateFin);
// Assert
Assert.Less(formationDTOs.First().DateFin, dateFin);
Assert.LessOrEqual(formationDTOs.Last().DateFin, dateFin);
}
[TestCase("2020-11-01", "2020-12-01")]
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebutEtUneDateDeFin_RetourneDesFormationsAvecUneDateDeDebutSuperieurUneDateDeFinInferieur(DateTime dateDebut, DateTime dateFin)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, dateDebut, dateFin);
// Assert
Assert.Greater(formationDTOs.First().DateDebut, dateDebut);
Assert.Less(formationDTOs.First().DateFin, dateFin);
Assert.GreaterOrEqual(formationDTOs.Last().DateDebut, dateDebut);
Assert.LessOrEqual(formationDTOs.Last().DateFin, dateFin);
}
[TestCase("2020-11-01", "2020-10-01")]
public async Task GetFormationsAsync_PasseEnParamUneDateDeDebutSuperieurEtUneDateDeFinInferieur_RetourneZeroFormation(DateTime dateDebut, DateTime dateFin)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(null, null, null, null, null, null, null, dateDebut, dateFin);
// Assert
Assert.AreEqual(0, formationDTOs.Count());
}
[TestCase(1, new int[] { 1 }, true, 1, 15, "azerty", null, null, null)]
[TestCase(-1, new int[] { -1 }, null, -1, -1, "azerty", null, null, null)]
[TestCase(0, new int[] { 0 }, null, 0, 0, null, null, null, null)]
public async Task GetFormationsAsync_PasseDesParamsInvalides_RetourneZeroFormation(long? idAgence, int[] arrIdStatuts, bool? asc, int? numPage, int? parPAge, string texte, string tri, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
List<int?> idStatuts;
if (arrIdStatuts != null)
idStatuts = arrIdStatuts.Select(x => (int?)x).ToList();
else
idStatuts = null;
// Act
IEnumerable<FormationDetailsDTO> formationDTOs = await formationService.GetFormationsAsync(idAgence, idStatuts, asc, numPage, parPAge, texte, tri, dateDebut, dateFin);
// Assert
Assert.AreEqual(0, formationDTOs.Count());
}
#endregion
#region Tests GetFormationsCountAsync
[TestCase(1, new int[] { 1, 2, 3 }, "formation", "2020-09-30", "2020-11-30")]
[TestCase(1, new int[] { 1 }, "Formation Mainframe Complète", null, null)]
[TestCase(null, null, null, null, null)]
[TestCase(null, new int[] { 1 }, null, null, null)]
[TestCase(1, null, "for", null, null)]
[TestCase(1, new int[] { }, "for", null, null)]
public async Task GetFormationsCountAsync_PasseDesParamsValides_RetourneLeNombreTotalDeFormations(long? idAgence, int[] arrIdStatuts, string texte, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
List<int?> idStatuts;
if (arrIdStatuts != null)
idStatuts = arrIdStatuts.Select(x => (int?)x).ToList();
else
idStatuts = null;
// Act
long count = await formationService.GetFormationsCountAsync(idAgence, idStatuts, texte, dateDebut, dateFin);
// Assert
Assert.Less(0, count);
}
[TestCase(1, new int[] { 1 }, "azerty", null, null)]
[TestCase(-1, new int[] { -1 }, "azerty", null, null)]
[TestCase(0, new int[] { 0 }, null, null, null)]
public async Task GetFormationsCountAsync_PasseDesParamsInvalides_RetourneZero(long? idAgence, int[] arrIdStatuts, string texte, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
List<int?> idStatuts;
if (arrIdStatuts != null)
idStatuts = arrIdStatuts.Select(x => (int?)x).ToList();
else
idStatuts = null;
// Act
long count = await formationService.GetFormationsCountAsync(idAgence, idStatuts, texte, dateDebut, dateFin);
// Assert
Assert.AreEqual(0, count);
}
#endregion
#region Tests GetModesFormationAsync
[Test]
public async Task GetModesFormationAsync_RetourneTousLesModesDeFormation()
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<ModeFormationDTO> modeFormationDTOs = await formationService.GetModesFormationAsync();
// Assert
Assert.IsNotNull(modeFormationDTOs);
Assert.AreEqual(4, modeFormationDTOs.Count()); // Nombre total de mode de formation dans la classe DataSeeder le 2020-10-31
}
#endregion
#region Tests GetOriginesFormationAsync
[Test]
public async Task GetOriginesAsyncFormation_RetourneToutesLesOriginesDeFormation()
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<OrigineFormationDTO> origineFormationDTOs = await formationService.GetOriginesFormationAsync();
// Assert
Assert.IsNotNull(origineFormationDTOs);
Assert.AreEqual(4, origineFormationDTOs.Count()); // Nombre total d'origine de formation dans la classe DataSeeder le 2020-10-31
}
#endregion
#region Tests GetStatutsFormationAsync
[Test]
public async Task GetStatutsFormationAsyncFormation_RetourneTousLesStatutsDeFormation()
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<StatutFormationDTO> statutFormationDTOs = await formationService.GetStatutsFormationAsync();
// Assert
Assert.IsNotNull(statutFormationDTOs);
Assert.AreEqual(4, statutFormationDTOs.Count()); // Nombre total de statut de formation dans la classe DataSeeder le 2020-10-31
}
#endregion
#region Tests GetTypesFormationAsync
[Test]
public async Task GetTypesFormationAsync_RetourneTousLesTypesDeFormation()
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<TypeFormationDTO> typeFormationDTOs = await formationService.GetTypesFormationAsync();
// Assert
Assert.IsNotNull(typeFormationDTOs);
Assert.AreEqual(4, typeFormationDTOs.Count()); // Nombre total de type de formation dans la classe DataSeeder le 2020-10-31
}
#endregion
#region Tests AddFormationAsync
[TestCase(1, 1, 3, 1, 1, "Test ajout formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 3, 1, 1, "Test ajout formation", "Apside", "2020-10-31", "2020-10-31")]
[TestCase(1, 1, 3, 1, 1, "Test ajout formation", "Apside", "2020-11-02", "2020-11-02")]
public async Task AddFormationAsync_AjouteUneFormationValide_FormationAjouteeAvecSucces(int? idMode, int? idStatut, int? idType, long? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationDTO formation = new FormationDTO
{
Intitule = intitule,
IdAgence = idAgence,
DateDebut = dateDebut,
DateFin = dateFin,
Heure = 2,
Jour = 1,
Mode = modeExterne,
Type = typeELearning,
Organisme = organisme,
Origine = origineFormationCollaborateur,
Statut = statutPlanifie,
EstCertifiee = false
};
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
FormationDTO formationAjoute = await formationService.AddFormationAsync(formation);
// Assert
Assert.IsNotNull(formationAjoute);
Assert.AreEqual(12, formationAjoute.Id);
Assert.AreEqual(formation.Intitule, formationAjoute.Intitule);
Assert.AreEqual(formation.IdAgence, formationAjoute.IdAgence);
Assert.AreEqual(formation.DateDebut, formationAjoute.DateDebut);
Assert.AreEqual(formation.DateFin, formationAjoute.DateFin);
Assert.AreEqual(formation.Heure, formationAjoute.Heure);
Assert.AreEqual(formation.Jour, formationAjoute.Jour);
Assert.AreEqual(formation.Mode, formationAjoute.Mode);
Assert.AreEqual(formation.Type, formationAjoute.Type);
Assert.AreEqual(formation.Organisme, formationAjoute.Organisme);
Assert.AreEqual(formation.Origine, formationAjoute.Origine);
Assert.AreEqual(formation.Statut, formationAjoute.Statut);
Assert.AreEqual(formation.EstCertifiee, formationAjoute.EstCertifiee);
}
[Test]
public void AddFormationAsync_AjouteUneFormationNull_LeveUneFormationInvalidException()
{
// Arrange
FormationDTO formation = null;
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
AsyncTestDelegate throwException = () => formationService.AddFormationAsync(formation);
// Assert
Assert.ThrowsAsync(typeof(FormationInvalidException), throwException);
}
[TestCase(1, 1, 3, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-10-30")]
[TestCase(0, 1, 3, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 0, 3, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 0, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 3, 0, 1, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 3, 1, 0, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 3, 1, 1, "", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 3, 1, 1, "Test Formation", "", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 3, 1, null, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 3, 1, 1, null, "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 3, 1, 1, "Test Formation", null, "2020-10-31", "2020-11-02")]
public void AddFormationAsync_AjouteUneFormationAvecDesProprietesInvalides_LeveUneFormationInvalidException(int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationDTO formation = new FormationDTO
{
Intitule = intitule,
IdAgence = idAgence,
DateDebut = dateDebut,
DateFin = dateFin,
Heure = 2,
Jour = 1,
Mode = modeExterne,
Type = typeELearning,
Organisme = organisme,
Origine = origineFormationCollaborateur,
Statut = statutPlanifie,
EstCertifiee = false
};
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
AsyncTestDelegate throwException = () => formationService.AddFormationAsync(formation);
// Assert
Assert.ThrowsAsync(typeof(FormationInvalidException), throwException);
}
[TestCase(0, 1, 3, 1, "Externe", "Planifiée", "E-learning", "Demande collaborateur")]
[TestCase(1, 0, 3, 1, "Externe", "Planifiée", "E-learning", "Demande collaborateur")]
[TestCase(1, 1, 0, 1, "Externe", "Planifiée", "E-learning", "Demande collaborateur")]
[TestCase(1, 1, 3, 0, "Externe", "Planifiée", "E-learning", "Demande collaborateur")]
[TestCase(null, 1, 3, 1, "Externe", "Planifiée", "E-learning", "Demande collaborateur")]
[TestCase(1, null, 3, 1, "Externe", "Planifiée", "E-learning", "Demande collaborateur")]
[TestCase(1, 1, null, 1, "Externe", "Planifiée", "E-learning", "Demande collaborateur")]
[TestCase(1, 1, 3, null, "Externe", "Planifiée", "E-learning", "Demande collaborateur")]
[TestCase(1, 1, 3, 1, "Externez", "Planifiée", "E-learning", "Demande collaborateur")]
[TestCase(1, 1, 3, 1, "Externe", "Planifiées", "E-learning", "Demande collaborateur")]
[TestCase(1, 1, 3, 1, "Externe", "Planifiée", "E-learnings", "Demande collaborateur")]
[TestCase(1, 1, 3, 1, "Externe", "Planifiée", "E-learning", "Demande collaborateurs")]
public void AddFormationAsync_AjouteUneFormationAvecDesObjetsEnfantsInvalides_LeveUneFormationInvalidException(int? idMode, int? idStatut, int? idType, int? idOrigine, string libelleMode, string libelleStatut, string libelleType, string libelleOrigine)
{
// Arrange
ModeFormationDTO modeExterne = new ModeFormationDTO { Id = idMode, Libelle = libelleMode };
StatutFormationDTO statutPlanifie = new StatutFormationDTO { Id = idStatut, Libelle = libelleStatut };
TypeFormationDTO typeELearning = new TypeFormationDTO { Id = idType, Libelle = libelleType };
OrigineFormationDTO origineFormationCollaborateur = new OrigineFormationDTO { Id = idOrigine, Libelle = libelleOrigine };
FormationDTO formation = new FormationDTO
{
Intitule = "Test Formation",
IdAgence = 1,
DateDebut = new DateTime(2020, 10, 31),
DateFin = new DateTime(2020, 11, 02),
Heure = 2,
Jour = 1,
Mode = modeExterne,
Type = typeELearning,
Organisme = "Apside",
Origine = origineFormationCollaborateur,
Statut = statutPlanifie,
EstCertifiee = false
};
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
AsyncTestDelegate throwException = () => formationService.AddFormationAsync(formation);
// Assert
Assert.ThrowsAsync(typeof(FormationInvalidException), throwException);
}
#endregion
#region Tests UpdateFormationAsync
[TestCase(1, 2, 2, 1, 1, 2, "Test modification formation", "Apside", "2020-10-31", "2020-11-04")]
public async Task UpdateFormationAsync_ModifieUneFormationValide_FormationModifieeAvecSucces(long idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation);
formation.Intitule = intitule;
formation.IdAgence = idAgence;
formation.DateDebut = dateDebut;
formation.DateFin = dateFin;
formation.Heure = 2;
formation.Jour = 1;
formation.Mode = modeExterne;
formation.Type = typeELearning;
formation.Organisme = organisme;
formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie;
formation.EstCertifiee = false;
// Act
FormationDTO formationModifie = await formationService.UpdateFormationAsync(idFormation, formation);
// Assert
Assert.IsNotNull(formationModifie);
Assert.AreEqual(idFormation, formationModifie.Id);
Assert.AreEqual(formation.Intitule, formationModifie.Intitule);
Assert.AreEqual(formation.IdAgence, formationModifie.IdAgence);
Assert.AreEqual(formation.DateDebut, formationModifie.DateDebut);
Assert.AreEqual(formation.DateFin, formationModifie.DateFin);
Assert.AreEqual(formation.Heure, formationModifie.Heure);
Assert.AreEqual(formation.Jour, formationModifie.Jour);
Assert.AreEqual(formation.Mode, formationModifie.Mode);
Assert.AreEqual(formation.Type, formationModifie.Type);
Assert.AreEqual(formation.Organisme, formationModifie.Organisme);
Assert.AreEqual(formation.Origine, formationModifie.Origine);
Assert.AreEqual(formation.Statut, formationModifie.Statut);
Assert.AreEqual(formation.EstCertifiee, formationModifie.EstCertifiee);
}
[TestCase(1, 1, 1, 3, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-10-30")]
[TestCase(1, 0, 1, 3, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 0, 3, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 1, 0, 1, 1, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 1, 3, 0, 1, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 1, 3, 1, 0, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 1, 3, 1, 1, "", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 1, 3, 1, 1, "Test Formation", "", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 1, 3, 1, null, "Test Formation", "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 1, 3, 1, 1, null, "Apside", "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 1, 3, 1, 1, "Test Formation", null, "2020-10-31", "2020-11-02")]
[TestCase(1, 1, 1, 3, 1, 1, "Test Formation", "Apside", null, "2020-11-02")]
[TestCase(1, 1, 1, 3, 1, 1, "Test Formation", "Apside", "2020-10-31", null)]
public async Task UpdateFormationAsync_ModifieUneFormationAvecDesProprietesInvalides_LeveUneFormationInvalidException(long idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
FormationDTO formation = await formationService.GetFormationByIdAsync(idFormation);
formation.Intitule = intitule;
formation.IdAgence = idAgence;
formation.DateDebut = dateDebut;
formation.DateFin = dateFin;
formation.Heure = 2;
formation.Jour = 1;
formation.Mode = modeExterne;
formation.Type = typeELearning;
formation.Organisme = organisme;
formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie;
formation.EstCertifiee = false;
// Act
AsyncTestDelegate throwException = () => formationService.UpdateFormationAsync(idFormation, formation);
// Assert
Assert.ThrowsAsync(typeof(FormationInvalidException), throwException);
}
[TestCase(2, 2, 2, 1, 1, 2, "Test modification formation", "Apside", "2020-10-31", "2020-11-04")]
[TestCase(0, 2, 2, 1, 1, 2, "Test modification formation", "Apside", "2020-10-31", "2020-11-04")]
[TestCase(null, 2, 2, 1, 1, 2, "Test modification formation", "Apside", "2020-10-31", "2020-11-04")]
public async Task UpdateFormationAsync_ModifieUneFormationAvecUnIdIncorrecte_LeveUneFormationIncompatibleIdException(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
FormationDTO formation = await formationService.GetFormationByIdAsync(1);
formation.Id = idFormation;
formation.Intitule = intitule;
formation.IdAgence = idAgence;
formation.DateDebut = dateDebut;
formation.DateFin = dateFin;
formation.Heure = 2;
formation.Jour = 1;
formation.Mode = modeExterne;
formation.Type = typeELearning;
formation.Organisme = organisme;
formation.Origine = origineFormationCollaborateur;
formation.Statut = statutPlanifie;
formation.EstCertifiee = false;
// Act
AsyncTestDelegate throwException = () => formationService.UpdateFormationAsync(1, formation);
// Assert
Assert.ThrowsAsync(typeof(FormationIncompatibleIdException), throwException);
}
[TestCase(0, 2, 2, 1, 1, 2, "Test modification formation", "Apside", "2020-10-31", "2020-11-04")]
public void UpdateFormationAsync_ModifieUneFormationAvecUnIdInexistant_RetourneUnObjetNull(long idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin)
{
// Arrange
ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode)
.Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault();
StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut)
.Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault();
TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType)
.Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault();
OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine)
.Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault();
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
FormationDTO formation = new FormationDTO
{
Id = idFormation,
Intitule = intitule,
IdAgence = idAgence,
DateDebut = dateDebut,
DateFin = dateFin,
Heure = 2,
Jour = 1,
Mode = modeExterne,
Type = typeELearning,
Organisme = organisme,
Origine = origineFormationCollaborateur,
Statut = statutPlanifie,
EstCertifiee = false
};
// Act
AsyncTestDelegate throwException = () => formationService.UpdateFormationAsync(idFormation, formation);
// Assert
Assert.ThrowsAsync(typeof(FormationNotFoundException), throwException);
}
#endregion
#region Tests DeleteFormationById et DeleteFormationByIdAsync
[TestCase(1)]
[TestCase(2)]
public async Task DeleteFormationByIdAsync_SupprimeUneFormationAvecUnIdValide_FormationSupprimeAvecSucces(long idFormation)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
bool existFormation = true;
// Act
FormationDTO formationSupprime = await formationService.DeleteFormationByIdAsync(idFormation);
existFormation = await epContext.Formation.AnyAsync(formation => formation.IdFormation == formationSupprime.Id.Value);
// Assert
Assert.IsFalse(existFormation);
}
[TestCase(0)]
[TestCase(-1)]
public void DeleteFormationByIdAsync_SupprimeUneFormationAvecUnIdInvalide_LeveUneFormationNotFoundException(long idFormation)
{
// Arrange
FormationService formationService = new FormationService(epContext, collaborateurService, transformDTO);
// Act
AsyncTestDelegate throwException = () => formationService.DeleteFormationByIdAsync(idFormation);
// Assert
Assert.ThrowsAsync(typeof(FormationNotFoundException), throwException);
}
#endregion
}
}

@ -0,0 +1,515 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.IServices;
using EPAServeur.Models.Notes;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.DTO;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Services
{
[TestFixture]
public class NoteServiceTests
{
#region Variables
private EpContext context;
private ICollaborateurApi collaborateurApi;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
private Guid? auteur1, auteur2, auteur3;
private Guid? collaborateur1, collaborateur2, collaborateur3;
private Guid? auteurNonExistant, collaborateurNonExistant, collaborateurParti, referentParti;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddNotes(context);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
collaborateurApi = new CollaborateurApi();
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
auteur1 = new Guid("aa36f34c-9041-42f5-9db3-6536fe7f1696");
auteur2 = new Guid("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d");
auteur3 = new Guid("eb8b0f33-f529-4985-861e-1207f3312bb5");
collaborateur1 = new Guid("842650db-a548-4472-a3af-4c5fff3c1ab8");
collaborateur2 = new Guid("b5254c6c-7caa-435f-a4bb-e0cf92559832");
collaborateur3 = new Guid("de98a866-736f-4295-a669-92a8694e2ee3");
auteurNonExistant = collaborateurNonExistant = new Guid("397f616e-44ff-11eb-b378-0242ac130002");
collaborateurParti = new Guid("13fbe621-1bc9-4f04-afde-b54ca076e239");
referentParti = new Guid("ea027734-ff0f-4308-8879-133a09fb3c46");
}
#endregion
#region Test AjouterNote
[Test]
public async Task AjouterNote_Ajouter4NoteAvecSucces()
{
// récupérer les collaborateurs liés aux notes
CollaborateurDTO collaborateur1DTO = await collaborateurService.GetCollaborateurByIdAsync(collaborateur1);
CollaborateurDTO collaborateur2DTO = await collaborateurService.GetCollaborateurByIdAsync(collaborateur2);
CollaborateurDTO collaborateur3DTO = await collaborateurService.GetCollaborateurByIdAsync(collaborateur3);
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DateTime date = DateTime.Now;
DetailsNoteDTO noteAjoutee1, noteAjoutee2;
Note noteAjoutee3, noteAjoutee4;
DetailsNoteDTO nouvelleNote1 = new DetailsNoteDTO()
{
Collaborateur = collaborateur1DTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = auteur1,
Texte = "Texte nouvelle note 11",
Titre = "Titre nouvelle note 11"
};
noteAjoutee1 = await noteService.AjouterNoteAsync(nouvelleNote1);
DetailsNoteDTO nouvelleNote2 = new DetailsNoteDTO()
{
Collaborateur = collaborateur2DTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = auteur2,
Texte = "Texte nouvelle note 12",
Titre = "Titre nouvelle note 12"
};
noteAjoutee2 = await noteService.AjouterNoteAsync(nouvelleNote2);
DetailsNoteDTO nouvelleNote3 = new DetailsNoteDTO()
{
Collaborateur = collaborateur3DTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = auteur3,
Texte = "Texte nouvelle note 13",
Titre = "Titre nouvelle note 13",
};
await noteService.AjouterNoteAsync(nouvelleNote3);
noteAjoutee3 = await context.Note.FindAsync((long)13);
DetailsNoteDTO nouvelleNote4 = new DetailsNoteDTO()
{
Collaborateur = collaborateur3DTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = auteur1,
Texte = "Texte nouvelle note 14",
Titre = "Titre nouvelle note 14"
};
await noteService.AjouterNoteAsync(nouvelleNote4);
noteAjoutee4 = await context.Note.FindAsync((long)14);
//Assert note 1
Assert.IsNotNull(noteAjoutee1);
Assert.AreEqual(11, noteAjoutee1.Id);
Assert.AreEqual(nouvelleNote1.IdAuteur, noteAjoutee1.IdAuteur);
Assert.AreEqual(nouvelleNote1.DateCreation, noteAjoutee1.DateCreation);
Assert.AreEqual(nouvelleNote1.Collaborateur.Id, noteAjoutee1.Collaborateur.Id);
Assert.AreEqual(nouvelleNote1.Titre, noteAjoutee1.Titre);
Assert.AreEqual(nouvelleNote1.Texte, noteAjoutee1.Texte);
Assert.AreEqual(nouvelleNote1.DateMiseAjour, noteAjoutee1.DateMiseAjour);
Assert.AreEqual(nouvelleNote1.DateCreation, noteAjoutee1.DateCreation);
//Assert note 2
Assert.IsNotNull(noteAjoutee2);
Assert.AreEqual(12, noteAjoutee2.Id);
Assert.AreEqual(nouvelleNote2.IdAuteur, noteAjoutee2.IdAuteur);
Assert.AreEqual(nouvelleNote2.DateCreation, noteAjoutee2.DateCreation);
Assert.AreEqual(nouvelleNote2.Collaborateur.Id, noteAjoutee2.Collaborateur.Id);
Assert.AreEqual(nouvelleNote2.Titre, noteAjoutee2.Titre);
Assert.AreEqual(nouvelleNote2.Texte, noteAjoutee2.Texte);
Assert.AreEqual(nouvelleNote2.DateMiseAjour, noteAjoutee2.DateMiseAjour);
Assert.AreEqual(nouvelleNote2.DateCreation, noteAjoutee2.DateCreation);
//Assert note 3
Assert.IsNotNull(noteAjoutee3);
Assert.AreEqual(13, noteAjoutee3.IdNote);
Assert.AreEqual(nouvelleNote3.IdAuteur, noteAjoutee3.IdAuteur);
Assert.AreEqual(nouvelleNote3.DateCreation, noteAjoutee3.DateCreation);
Assert.AreEqual(nouvelleNote3.Collaborateur.Id, noteAjoutee3.IdCollaborateur);
Assert.AreEqual(nouvelleNote3.Titre, noteAjoutee3.Titre);
Assert.AreEqual(nouvelleNote3.Texte, noteAjoutee3.Texte);
Assert.AreEqual(nouvelleNote3.DateMiseAjour, noteAjoutee3.DateMiseAJour);
Assert.AreEqual(nouvelleNote3.DateCreation, noteAjoutee3.DateCreation);
//Assert note 4
Assert.IsNotNull(noteAjoutee4);
Assert.AreEqual(14, noteAjoutee4.IdNote);
Assert.AreEqual(nouvelleNote4.IdAuteur, noteAjoutee4.IdAuteur);
Assert.AreEqual(nouvelleNote4.DateCreation, noteAjoutee4.DateCreation);
Assert.AreEqual(nouvelleNote4.Collaborateur.Id, noteAjoutee4.IdCollaborateur);
Assert.AreEqual(nouvelleNote4.Titre, noteAjoutee4.Titre);
Assert.AreEqual(nouvelleNote4.Texte, noteAjoutee4.Texte);
Assert.AreEqual(nouvelleNote4.DateMiseAjour, noteAjoutee4.DateMiseAJour);
Assert.AreEqual(nouvelleNote4.DateCreation, noteAjoutee4.DateCreation);
}
[TestCase("", "")]
[TestCase("Titre 2", "")]
[TestCase("", "Texte 3")]
[TestCase("Titre 3", "Te")]
[TestCase("T", "Texte 4")]
[TestCase("T", "T")]
public async Task AjouterNote_NoteInvalideException(string titre, string texte)
{
CollaborateurDTO collaborateurDTO = await collaborateurService.GetCollaborateurByIdAsync(collaborateur1);
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DateTime date = DateTime.Now;
DetailsNoteDTO noteAjoutee1 = new DetailsNoteDTO()
{
Collaborateur = collaborateurDTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = auteur1,
Texte = texte,
Titre = titre,
};
AsyncTestDelegate exception = () => noteService.AjouterNoteAsync(noteAjoutee1);
Assert.ThrowsAsync(typeof(NoteInvalideException), exception);
}
[Test]
public async Task AjouterNote_ReferentNotFoundException()
{
CollaborateurDTO collaborateurDTO = await collaborateurService.GetCollaborateurByIdAsync(collaborateur1);
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DateTime date = DateTime.Now;
DetailsNoteDTO note = new DetailsNoteDTO()
{
Collaborateur = collaborateurDTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = auteurNonExistant,
Texte = "Texte nouvelle note",
Titre = "Titre nouvelle note"
};
AsyncTestDelegate exception = () => noteService.AjouterNoteAsync(note);
Assert.ThrowsAsync(typeof(ReferentNotFoundException), exception);
}
[Test]
public async Task AjouterNote_CollaborateurNotFoundException()
{
CollaborateurDTO collaborateurDTO = await collaborateurService.GetCollaborateurByIdAsync(collaborateur1);
collaborateurDTO.Id = collaborateurNonExistant;
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DateTime date = DateTime.Now;
DetailsNoteDTO note = new DetailsNoteDTO()
{
Collaborateur = collaborateurDTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = auteur1,
Texte = "Texte nouvelle note",
Titre = "Titre nouvelle note"
};
AsyncTestDelegate exception = () => noteService.AjouterNoteAsync(note);
Assert.ThrowsAsync(typeof(CollaborateurNotFoundException), exception);
}
//[Test]
[Test]
public async Task AjouterNote_CollaborateurPartiException()
{
CollaborateurDTO collaborateurDTO = await collaborateurService.GetCollaborateurByIdAsync(collaborateur1);
CollaborateurDTO collaborateurPartiDTO = await collaborateurService.GetCollaborateurByIdAsync(collaborateurParti);
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DateTime date = DateTime.Now;
DetailsNoteDTO note1 = new DetailsNoteDTO()
{
Collaborateur = collaborateurDTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = referentParti,
Texte = "Texte note 1",
Titre = "Titre note 1"
};
AsyncTestDelegate exception1 = () => noteService.AjouterNoteAsync(note1);
DetailsNoteDTO note2 = new DetailsNoteDTO()
{
Collaborateur = collaborateurPartiDTO,
DateCreation = date,
DateMiseAjour = date,
IdAuteur = auteur2,
Texte = "Texte note 2",
Titre = "Titre note 2"
};
AsyncTestDelegate exception2 = () => noteService.AjouterNoteAsync(note2);
Assert.ThrowsAsync(typeof(CollaborateurPartiException), exception1);
Assert.ThrowsAsync(typeof(CollaborateurPartiException), exception2);
}
#endregion
#region Tests GetNoteById
[TestCase(1)]
[TestCase(2)]
[TestCase(4)]
[TestCase(5)]
[TestCase(6)]
[TestCase(9)]
public async Task GetNote_NoteNotNull(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DetailsNoteDTO detailsNoteDTO = await noteService.GetNoteByIdAsync(id);
Assert.NotNull(detailsNoteDTO);
Assert.NotNull(detailsNoteDTO.Titre);
Assert.NotNull(detailsNoteDTO.Texte);
Assert.NotNull(detailsNoteDTO.IdAuteur);
Assert.NotNull(detailsNoteDTO.Collaborateur);
Assert.NotNull(detailsNoteDTO.DateCreation);
Assert.NotNull(detailsNoteDTO.DateMiseAjour);
Assert.AreEqual(id, detailsNoteDTO.Id);
}
[TestCase(-999)]
[TestCase(-1)]
[TestCase(0)]
[TestCase(11)]
[TestCase(20)]
[TestCase(30)]
[TestCase(100)]
public void GetNote_NoteNotFoundException(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
AsyncTestDelegate exception = () => noteService.GetNoteByIdAsync(id);
Assert.ThrowsAsync(typeof(NoteNotFoundException), exception);
}
[TestCase(3)]
[TestCase(7)]
public void GetNote_ReferentNotFoundException(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
AsyncTestDelegate exception = () => noteService.GetNoteByIdAsync(id);
Assert.ThrowsAsync(typeof(ReferentNotFoundException), exception);
}
[TestCase(8)]
[TestCase(10)]
public void GetNote_CollaborateurNotFoundException(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
AsyncTestDelegate exception = () => noteService.GetNoteByIdAsync(id);
Assert.ThrowsAsync(typeof(CollaborateurNotFoundException), exception);
}
#endregion
#region Test Supprimer Note
[TestCase(5)]
[TestCase(7)]
[TestCase(8)]
public async Task SupprimerNote_Succes(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
await noteService.SupprimerNoteAsync(id);
Note note = await context.Note.FindAsync(id);
Assert.IsNull(note);
}
[TestCase(0)]
[TestCase(-1)]
[TestCase(-999)]
[TestCase(20)]
[TestCase(30)]
[TestCase(100)]
public void SupprimerNote_NoteNotFoundException(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
AsyncTestDelegate exception = () => noteService.SupprimerNoteAsync(id);
Assert.ThrowsAsync(typeof(NoteNotFoundException), exception);
}
#endregion
#region Tests UpdateNote
[TestCase(1)]
[TestCase(2)]
[TestCase(6)]
[TestCase(9)]
public async Task UpdateNote_UpdateTitreEtTexte(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DetailsNoteDTO note = await noteService.GetNoteByIdAsync(id);
note.Titre = "Titre à jour " + id;
note.Texte= "Texte à jour " + id;
DetailsNoteDTO noteUpdate = await noteService.UpdateNoteAsync(id, note);
Note noteUpdated = context.Note.Find(noteUpdate.Id);
Assert.IsNotNull(noteUpdate);
Assert.IsNotNull(noteUpdated);
Assert.AreEqual(noteUpdated.IdNote, noteUpdate.Id);
Assert.AreEqual(noteUpdated.IdAuteur, noteUpdate.IdAuteur);
Assert.AreEqual(noteUpdated.IdCollaborateur, noteUpdate.Collaborateur.Id);
Assert.AreEqual(noteUpdated.DateCreation, noteUpdate.DateCreation);
Assert.AreEqual(noteUpdated.Titre, noteUpdate.Titre);
Assert.AreEqual(noteUpdated.Texte, noteUpdate.Texte);
Assert.AreEqual(noteUpdated.DateMiseAJour, noteUpdated.DateMiseAJour);
}
[TestCase(1)]
[TestCase(2)]
[TestCase(6)]
[TestCase(9)]
public async Task UpdateNote_UpdateTexte(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DetailsNoteDTO note = await noteService.GetNoteByIdAsync(id);
note.Texte = "Texte à jour " + id;
DetailsNoteDTO noteUpdate = await noteService.UpdateNoteAsync(id, note);
Note noteUpdated = context.Note.Find(noteUpdate.Id);
Assert.IsNotNull(noteUpdate);
Assert.IsNotNull(noteUpdated);
Assert.AreEqual(noteUpdated.IdNote, noteUpdate.Id);
Assert.AreEqual(noteUpdated.IdAuteur, noteUpdate.IdAuteur);
Assert.AreEqual(noteUpdated.IdCollaborateur, noteUpdate.Collaborateur.Id);
Assert.AreEqual(noteUpdated.DateCreation, noteUpdate.DateCreation);
Assert.AreEqual(noteUpdated.Titre, noteUpdate.Titre);
Assert.AreEqual(noteUpdated.Texte, noteUpdate.Texte);
Assert.AreEqual(noteUpdated.DateMiseAJour, noteUpdated.DateMiseAJour);
}
[TestCase(1)]
[TestCase(2)]
[TestCase(6)]
[TestCase(9)]
public async Task UpdateNote_UpdateTitre(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DetailsNoteDTO note = await noteService.GetNoteByIdAsync(id);
note.Titre = "Titre à jour " + id;
DetailsNoteDTO noteUpdate = await noteService.UpdateNoteAsync(id, note);
Note noteUpdated = context.Note.Find(noteUpdate.Id);
Assert.IsNotNull(noteUpdate);
Assert.IsNotNull(noteUpdated);
Assert.AreEqual(noteUpdated.IdNote, noteUpdate.Id);
Assert.AreEqual(noteUpdated.IdAuteur, noteUpdate.IdAuteur);
Assert.AreEqual(noteUpdated.IdCollaborateur, noteUpdate.Collaborateur.Id);
Assert.AreEqual(noteUpdated.DateCreation, noteUpdate.DateCreation);
Assert.AreEqual(noteUpdated.Titre, noteUpdate.Titre);
Assert.AreEqual(noteUpdated.Texte, noteUpdate.Texte);
Assert.AreEqual(noteUpdated.DateMiseAJour, noteUpdated.DateMiseAJour);
}
[TestCase(1,2)]
[TestCase(1,3)]
[TestCase(2,4)]
[TestCase(2,5)]
[TestCase(9,6)]
[TestCase(9,7)]
public async Task UpdateNote_NoteIdImcompatibleExceptionId(long id, long mauvaisId)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DetailsNoteDTO note = await noteService.GetNoteByIdAsync(id);
note.Titre = "Titre à jour " + id;
note.Texte = "Texte à jour " + id;
AsyncTestDelegate exception = () => noteService.UpdateNoteAsync(mauvaisId, note);
Assert.ThrowsAsync(typeof(NoteIdImcompatibleException), exception);
}
[TestCase(1)]
[TestCase(2)]
[TestCase(6)]
[TestCase(9)]
public async Task UpdateNote_NoteIdImcompatibleExceptionDate(long id)
{
INoteService noteService = new NoteService(collaborateurApi, collaborateurService, context, transformDTO);
DetailsNoteDTO note = await noteService.GetNoteByIdAsync(id);
note.Titre = "Titre à jour " + id;
note.Texte = "Texte à jour " + id;
note.DateCreation = DateTime.Now;
AsyncTestDelegate exception = () => noteService.UpdateNoteAsync(id, note);
Assert.ThrowsAsync(typeof(NoteIdImcompatibleException), exception);
}
#endregion
#region Tests GetNoteByAuteur
#endregion.
}
}

@ -0,0 +1,763 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.IServices;
using EPAServeur.Models.Formation;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.DTO;
using IO.Swagger.Enum;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Services
{
[TestFixture]
public class ParticipationFormationServiceTests
{
#region Variables
private EpContext epContext;
private ICollaborateurApi collaborateurApi;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
#endregion
#region Setup
[SetUp]
public void Setup()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
epContext = new EpContext(optionBuider);
collaborateurApi = new CollaborateurApi();
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(collaborateurApi, epContext, transformDTO);
epContext.Database.EnsureDeleted();
epContext.Database.EnsureCreated();
epContext.SaveChanges();
// Ajout du jeu de données pour les tests
DataSeeder.AddFormations(epContext);
DataSeeder.AddChamps(epContext);
// Détache les entités du context car la base de données InMemory créé des conflits
// entre les clés primaires lors d'un Update ou d'un Insert
foreach (var entity in epContext.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
}
#endregion
#region Tests GetEvaluationCollaborateurAsync
[Test]
public async Task GetEvaluationCollaborateurAsync_PasseEnParamUnIdExistantDansLeJeuDeDonneesFictif_RetourneUneEvaluation()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
// Act
EvaluationDTO evaluationDTO = await participationFormationService.GetEvaluationCollaborateurAsync(idParticipationFormation);
// Assert
Assert.AreEqual(idParticipationFormation, evaluationDTO.Id);
Assert.AreEqual(new DateTime(2020, 5, 25, 14, 0, 0), evaluationDTO.DateDebut);
Assert.True(evaluationDTO.EstCertifiee);
Assert.AreEqual("Apprendre C# et le développement de logiciels avec WPF", evaluationDTO.Intitule);
}
[TestCase(-1)]
[TestCase(0)]
[TestCase(999999)]
public void GetEvaluationCollaborateurAsync_PasseEnParamUnIdInexistantDansLeJeuDeDonneesFictif_LeveUneParticipationFormationNotFoundException(long idParticipationFormation)
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
// Act
AsyncTestDelegate throwException = () => participationFormationService.GetEvaluationCollaborateurAsync(idParticipationFormation);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationNotFoundException), throwException);
}
#endregion
#region Tests GetParticipationsByCollaborateurAsync
[TestCase("842650db-a548-4472-a3af-4c5fff3c1ab8")]
[TestCase("4f3fcd23-a1e4-4c9e-afa2-d06ca9216491")]
public async Task GetParticipationByCollaborateurAsync_PasseDesParamsValides_RetourneDesParticipationsFormations(Guid idCollaborateur)
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<ParticipationFormationDTO> participationFormationDTOs = await participationFormationService.GetParticipationsByCollaborateurAsync(idCollaborateur);
// Assert
Assert.Less(0, participationFormationDTOs.Count());
}
[TestCase("e7820f92-eab1-42f5-ae96-5c16e71ff1e6")]
[TestCase("b5254c6c-7caa-435f-a4bb-e0cf92559832")]
public async Task GetParticipationByCollaborateurAsync_PasseDesParamsInvalides_RetourneZeroParticipation(Guid idCollaborateur)
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
// Act
IEnumerable<ParticipationFormationDTO> participationFormationDTOs = await participationFormationService.GetParticipationsByCollaborateurAsync(idCollaborateur);
// Assert
Assert.AreEqual(0, participationFormationDTOs.Count());
}
#endregion
#region Tests EvaluerFormationAsync
[Test]
public async Task EvaluerFormationAsync_EvaluerUneFormationValide_EvaluationRealiseeAvecSucces()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
// Act
EvaluationDTO evaluationModifiee = await participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
bool EstEvaluee = await epContext.ParticipationFormation.Where(p => p.IdParticipationFormation == idParticipationFormation).Select(p => p.EstEvaluee).FirstOrDefaultAsync();
// Assert
Assert.IsNotNull(evaluationModifiee);
Assert.True(EstEvaluee);
Assert.AreEqual(evaluationDTO.Id, evaluationModifiee.Id);
Assert.AreEqual(evaluationDTO.Intitule, evaluationModifiee.Intitule);
Assert.AreEqual(evaluationDTO.Saisies.Count, evaluationModifiee.Saisies.Count);
Assert.AreEqual(evaluationDTO.DateDebut, evaluationModifiee.DateDebut);
Assert.AreEqual(evaluationDTO.EstCertifiee, evaluationModifiee.EstCertifiee);
}
[TestCase(null)]
[TestCase("")]
[TestCase(" ")]
public async Task EvaluerFormationAsync_EvaluerUneFormationSansIntitule_LeveUneParticipationFormationInvalidException(string intitule)
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
evaluationDTO.Intitule = intitule;
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationInvalidException), throwException);
}
[Test]
public async Task EvaluerFormationAsync_EvaluerUneFormationSansEstCertifiee_LeveUneParticipationFormationInvalidException()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
bool? estCertifiee = null;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
evaluationDTO.EstCertifiee = estCertifiee;
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationInvalidException), throwException);
}
[Test]
public async Task EvaluerFormationAsync_EvaluerUneFormationSansDateDebut_LeveUneParticipationFormationInvalidException()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
DateTime? dateDebut = null;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
evaluationDTO.DateDebut = dateDebut;
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationInvalidException), throwException);
}
[Test]
public async Task EvaluerFormationAsync_EvaluerUneFormationSansSaisie_LeveUneParticipationFormationInvalidException()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
evaluationDTO.Saisies = null;
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationInvalidException), throwException);
}
[Test]
public async Task EvaluerFormationAsync_EvaluerUneFormationAvecZeroSaisie_LeveUneParticipationFormationInvalidException()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
evaluationDTO.Saisies = new List<SaisieDTO>();
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationInvalidException), throwException);
}
[Test]
public async Task EvaluerFormationAsync_EvaluerUneFormationAvecDesSaisiesSansNotesEtUnTypeDeSaisieCompetence_LeveUneParticipationFormationInvalidException()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = null, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationInvalidException), throwException);
}
[Test]
public async Task EvaluerFormationAsync_EvaluerUneFormationAvecDesSaisiesSansNotesEtUnTypeDeSaisieNotation_LeveUneParticipationFormationInvalidException()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Notation };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = null, Texte = "", TypeSaisie = TypeSaisie.Notation, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationInvalidException), throwException);
}
[Test]
public void EvaluerFormationAsync_EvaluerUneFormationAvecUnDTONull_LeveUneParticipationFormationInvalidException()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
EvaluationDTO evaluationDTO = null;
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationInvalidException), throwException);
}
[TestCase(0)]
[TestCase(6)]
public async Task EvaluerFormationAsync_EvaluerUneFormationAvecUnIdIncorrecte_LeveUneParticipationFormationIncompatibleIdException(long idParticipationFormationIncompatible)
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormationIncompatible, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationIncompatibleIdException), throwException);
}
[TestCase(0)]
[TestCase(6)]
[TestCase(null)]
public async Task EvaluerFormationAsync_EvaluerUneFormationAvecUnIdIncorrecteAuNiveauDuDTO_LeveUneParticipationFormationIncompatibleIdException(long? idParticipationFormationIncompatible)
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
evaluationDTO.Id = idParticipationFormationIncompatible;
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormation, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationIncompatibleIdException), throwException);
}
[Test]
public async Task EvaluerFormationAsync_EvaluerUneFormationAvecUnIdInexistant_LeveUneParticipationFormationNotFoundException()
{
// Arrange
ParticipationFormationService participationFormationService = new ParticipationFormationService(epContext, collaborateurService, transformDTO);
long idParticipationFormation = 5;
long idParticipationFormationInexistant = 0;
EvaluationDTO evaluationDTO = await epContext.ParticipationFormation.Include(p => p.Formation)
.Where(p => p.IdParticipationFormation == idParticipationFormation)
.Select(p => new EvaluationDTO()
{
Id = p.IdParticipationFormation,
Intitule = p.Formation.Intitule,
DateDebut = p.Formation.DateDebut,
EstCertifiee = p.Formation.EstCertifiee,
Saisies = new List<SaisieDTO>()
}).FirstOrDefaultAsync();
ChampDTO c1 = new ChampDTO { Id = 35, Section = "Evaluation", Ordre = 0, Texte = "Accueil et organisation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c2 = new ChampDTO { Id = 36, Section = "Evaluation", Ordre = 1, Texte = "Compétences animateur", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c3 = new ChampDTO { Id = 37, Section = "Evaluation", Ordre = 2, Texte = "Pédagogie/Animation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c4 = new ChampDTO { Id = 38, Section = "Evaluation", Ordre = 3, Texte = "Exhaustivité des sujets traités", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c5 = new ChampDTO { Id = 39, Section = "Evaluation", Ordre = 4, Texte = "Utilité/Apport de la formation", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c6 = new ChampDTO { Id = 40, Section = "Evaluation", Ordre = 5, Texte = "Contenu théorique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c7 = new ChampDTO { Id = 41, Section = "Evaluation", Ordre = 6, Texte = "Contenu pratique", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c8 = new ChampDTO { Id = 42, Section = "Evaluation", Ordre = 7, Texte = "Equilibre pratique/théorie", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c9 = new ChampDTO { Id = 43, Section = "Evaluation", Ordre = 8, Texte = "Support de cours", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
ChampDTO c10 = new ChampDTO { Id = 44, Section = "Evaluation", Ordre = 9, Texte = "Durée", TypeChamp = TypeChamps.Evaluation, TypeSaisie = TypeSaisie.Competence };
SaisieDTO s1 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c1 };
SaisieDTO s2 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c2 };
SaisieDTO s3 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c3 };
SaisieDTO s4 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c4 };
SaisieDTO s5 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c5 };
SaisieDTO s6 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c6 };
SaisieDTO s7 = new SaisieDTO { Note = 4, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c7 };
SaisieDTO s8 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c8 };
SaisieDTO s9 = new SaisieDTO { Note = 3, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c9 };
SaisieDTO s10 = new SaisieDTO { Note = 5, Texte = "", TypeSaisie = TypeSaisie.Competence, Champ = c10 };
evaluationDTO.Saisies.Add(s1);
evaluationDTO.Saisies.Add(s2);
evaluationDTO.Saisies.Add(s3);
evaluationDTO.Saisies.Add(s4);
evaluationDTO.Saisies.Add(s5);
evaluationDTO.Saisies.Add(s6);
evaluationDTO.Saisies.Add(s7);
evaluationDTO.Saisies.Add(s8);
evaluationDTO.Saisies.Add(s9);
evaluationDTO.Saisies.Add(s10);
evaluationDTO.Id = idParticipationFormationInexistant;
// Act
AsyncTestDelegate throwException = () => participationFormationService.EvaluerFormationAsync(idParticipationFormationInexistant, evaluationDTO);
// Assert
Assert.ThrowsAsync(typeof(ParticipationFormationNotFoundException), throwException);
}
#endregion
}
}

@ -0,0 +1,256 @@
using EPAServeur.Context;
using EPAServeur.Exceptions;
using EPAServeur.IServices;
using EPAServeur.Models.EP;
using EPAServeur.Services;
using IO.Swagger.ApiCollaborateur;
using IO.Swagger.ClientCollaborateur;
using IO.Swagger.DTO;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace EPAServeur.Tests.Services
{
[TestFixture]
public class ReferentEPTests
{
#region Variables
private EpContext context;
private ICollaborateurApi collaborateurApi;
private ICollaborateurService collaborateurService;
private ITransformDTO transformDTO;
private Guid? referent1;
private Guid? collaborateur1, collaborateur2, collaborateur3;
private Guid? collaborateurNonExistant, collaborateurParti;
#endregion
#region SetUp
[SetUp]
public void SetUp()
{
// Utilisation d'une base de données en mémoire
var optionBuider = new DbContextOptionsBuilder<EpContext>()
.UseInMemoryDatabase("server_ep_test")
.Options;
context = new EpContext(optionBuider);
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
foreach (var entity in context.ChangeTracker.Entries())
{
entity.State = EntityState.Detached;
}
collaborateurApi = new CollaborateurApi();
transformDTO = new TransformDTO();
collaborateurService = new CollaborateurService(collaborateurApi, context, transformDTO);
referent1 = new Guid("aa36f34c-9041-42f5-9db3-6536fe7f1696");
collaborateur1 = new Guid("301ba7f3-095e-4912-8998-a7c942dc5f23");
collaborateur2 = new Guid("a43b6f4f-f199-4dd0-93b6-a1cb2c0a0d14");
collaborateur3 = new Guid("b5254c6c-7caa-435f-a4bb-e0cf92559832");
collaborateurNonExistant = new Guid();
collaborateurParti = new Guid("ea027734-ff0f-4308-8879-133a09fb3c46");
}
#endregion
#region Ajout pour un collaborateur
[Test]
public async Task UpdateReferentUnCollaborateur()
{
ReferentEPService referentEPService = new ReferentEPService(context, collaborateurApi);
CollaborateurDTO collaborateurDTO1 = await collaborateurService.GetCollaborateurByIdAsync(collaborateur1);
ReferentEPDTO referentEPDTO1 = new ReferentEPDTO()
{
IdReferent = referent1,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO1.IdsCollaborateur.Add(collaborateur1);
await referentEPService.UpdateReferentCollaborateurAsync(referentEPDTO1, collaborateur1);
Assert.IsNotNull(collaborateurDTO1);
Assert.IsNull(collaborateurDTO1.Referent);
collaborateurDTO1 = await collaborateurService.GetCollaborateurByIdAsync(collaborateur1);
Assert.IsNotNull(collaborateurDTO1);
Assert.IsNotNull(collaborateurDTO1.Referent);
Assert.AreEqual(collaborateurDTO1.Referent.Id, referent1);
}
[Test]
public void UpdateReferentCollaborateur_CollaborateurIncompatibleException()
{
ReferentEPService referentEPService = new ReferentEPService(context, collaborateurApi);
ReferentEPDTO referentEPDTO1 = new ReferentEPDTO()
{
IdReferent = referent1,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO1.IdsCollaborateur.Add(collaborateur1);
ReferentEPDTO referentEPDTO2 = new ReferentEPDTO()
{
IdReferent = referent1,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO2.IdsCollaborateur.Add(null);
AsyncTestDelegate exception1 = () => referentEPService.UpdateReferentCollaborateurAsync(referentEPDTO1, collaborateur2);
Assert.ThrowsAsync(typeof(CollaborateurIncompatibleException), exception1);
AsyncTestDelegate exception2 = () => referentEPService.UpdateReferentCollaborateurAsync(referentEPDTO2, null);
Assert.ThrowsAsync(typeof(CollaborateurIncompatibleException), exception2);
}
[Test]
public void UpdateReferentCollaborateur_ReferentNotFoundException()
{
ReferentEPService referentEPService = new ReferentEPService(context, collaborateurApi);
ReferentEPDTO referentEPDTO = new ReferentEPDTO()
{
IdReferent = collaborateurNonExistant,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO.IdsCollaborateur.Add(collaborateur1);
AsyncTestDelegate exception = () => referentEPService.UpdateReferentCollaborateurAsync(referentEPDTO, collaborateur1);
Assert.ThrowsAsync(typeof(ReferentNotFoundException), exception);
}
[Test]
public void UpdateReferentCollaborateur_CollaborateurPartiException()
{
ReferentEPService referentEPService = new ReferentEPService(context, collaborateurApi);
ReferentEPDTO referentEPDTO1 = new ReferentEPDTO()
{
IdReferent = collaborateurParti,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO1.IdsCollaborateur.Add(collaborateur1);
ReferentEPDTO referentEPDTO2 = new ReferentEPDTO()
{
IdReferent = collaborateurParti,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO2.IdsCollaborateur.Add(collaborateurParti);
AsyncTestDelegate exception1 = () => referentEPService.UpdateReferentCollaborateurAsync(referentEPDTO1, collaborateur1);
AsyncTestDelegate exception2 = () => referentEPService.UpdateReferentCollaborateurAsync(referentEPDTO2, collaborateurParti);
Assert.ThrowsAsync(typeof(CollaborateurPartiException), exception1);
Assert.ThrowsAsync(typeof(CollaborateurPartiException), exception2);
}
[Test]
public void UpdateReferentCollaborateur_CollaborateurNotFoundException()
{
ReferentEPService referentEPService = new ReferentEPService(context, collaborateurApi);
ReferentEPDTO referentEPDTO = new ReferentEPDTO()
{
IdReferent = referent1,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO.IdsCollaborateur.Add(collaborateurNonExistant);
AsyncTestDelegate exception = () => referentEPService.UpdateReferentCollaborateurAsync(referentEPDTO, collaborateurNonExistant);
Assert.ThrowsAsync(typeof(CollaborateurNotFoundException), exception);
}
[Test]
public void UpdateReferentCollaborateur_ApiException()
{
ReferentEPService referentEPService = new ReferentEPService(context, collaborateurApi);
ReferentEPDTO referentEPDTO = new ReferentEPDTO()
{
IdReferent = null,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO.IdsCollaborateur.Add(collaborateur1);
AsyncTestDelegate exception = () => referentEPService.UpdateReferentCollaborateurAsync(referentEPDTO, collaborateur1);
Assert.ThrowsAsync(typeof(ApiException), exception);
}
#endregion
#region ajout de plusieurs collaborateur
[Test]
public async Task UpdateCollaborateursReferent()
{
ReferentEPService referentEPService = new ReferentEPService(context, collaborateurApi);
ReferentEPDTO referentEPDTO = new ReferentEPDTO()
{
IdReferent = referent1,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO.IdsCollaborateur.Add(collaborateur1);
referentEPDTO.IdsCollaborateur.Add(collaborateur3);
referentEPDTO.IdsCollaborateur.Add(collaborateur2);
await referentEPService.UpdateCollaborateursReferentAsync(referentEPDTO, referent1);
foreach(Guid guid in referentEPDTO.IdsCollaborateur)
{
ReferentEP referentEP = await context.ReferentEP.FindAsync(guid);
Assert.AreEqual(referent1, referentEP.IdReferent);
}
}
[Test]
public void UpdateCollaborateursReferent_CollaborateurNotFound()
{
ReferentEPService referentEPService = new ReferentEPService(context, collaborateurApi);
ReferentEPDTO referentEPDTO = new ReferentEPDTO()
{
IdReferent = referent1,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO.IdsCollaborateur.Add(collaborateur1);
referentEPDTO.IdsCollaborateur.Add(collaborateur3);
referentEPDTO.IdsCollaborateur.Add(collaborateurNonExistant);
referentEPDTO.IdsCollaborateur.Add(collaborateur2);
AsyncTestDelegate exception = () => referentEPService.UpdateCollaborateursReferentAsync(referentEPDTO, referent1);
Assert.ThrowsAsync(typeof(CollaborateurNotFoundException), exception);
}
[Test]
public void UpdateCollaborateursReferent_ReferentNotFound()
{
ReferentEPService referentEPService = new ReferentEPService(context, collaborateurApi);
ReferentEPDTO referentEPDTO = new ReferentEPDTO()
{
IdReferent = collaborateurNonExistant,
IdsCollaborateur = new List<Guid?>(),
};
referentEPDTO.IdsCollaborateur.Add(collaborateur1);
referentEPDTO.IdsCollaborateur.Add(collaborateur3);
referentEPDTO.IdsCollaborateur.Add(collaborateur2);
AsyncTestDelegate exception = () => referentEPService.UpdateCollaborateursReferentAsync(referentEPDTO, collaborateurNonExistant);
Assert.ThrowsAsync(typeof(ReferentNotFoundException), exception);
}
#endregion
}
}

@ -1,20 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Configurations>Debug;Release;InitDB</Configurations>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.7" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.21" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="RestSharp" Version="106.11.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.5.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.5.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="5.5.1" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="5.5.1" />
</ItemGroup>
</Project>

@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30128.74
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EPAServeur", "EPAServeur.csproj", "{D19F441B-010F-481F-8A59-C5FA928B5077}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EPAServeur", "EPAServeur\EPAServeur.csproj", "{D19F441B-010F-481F-8A59-C5FA928B5077}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EPAServeur.Tests", "EPAServeur.Tests\EPAServeur.Tests.csproj", "{DD39768F-7C13-4620-AE46-EE9F5B5FEE44}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -18,6 +20,12 @@ Global
{D19F441B-010F-481F-8A59-C5FA928B5077}.InitDB|Any CPU.Build.0 = InitDB|Any CPU
{D19F441B-010F-481F-8A59-C5FA928B5077}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D19F441B-010F-481F-8A59-C5FA928B5077}.Release|Any CPU.Build.0 = Release|Any CPU
{DD39768F-7C13-4620-AE46-EE9F5B5FEE44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD39768F-7C13-4620-AE46-EE9F5B5FEE44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD39768F-7C13-4620-AE46-EE9F5B5FEE44}.InitDB|Any CPU.ActiveCfg = Release|Any CPU
{DD39768F-7C13-4620-AE46-EE9F5B5FEE44}.InitDB|Any CPU.Build.0 = Release|Any CPU
{DD39768F-7C13-4620-AE46-EE9F5B5FEE44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD39768F-7C13-4620-AE46-EE9F5B5FEE44}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -12,8 +12,8 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using RestSharp;
using IO.Swagger.ClientCollaborateur;
using IO.Swagger.ModelCollaborateur;
using IO.Swagger.ClientCollaborateur;
namespace IO.Swagger.ApiCollaborateur
{

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -511,7 +511,7 @@ namespace IO.Swagger.ApiCollaborateur
if (agenceId == null)
throw new ApiException(400, "Missing required parameter 'agenceId' when calling AgenceApi->ChercherAgence");
var localVarPath = "/agence/{agenceId}";
var localVarPath = "/agences/{agenceId}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
@ -577,7 +577,7 @@ namespace IO.Swagger.ApiCollaborateur
if (agenceId == null)
throw new ApiException(400, "Missing required parameter 'agenceId' when calling AgenceApi->ChercherAgence");
var localVarPath = "/agence/{agenceId}";
var localVarPath = "/agences/{agenceId}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
@ -762,7 +762,7 @@ namespace IO.Swagger.ApiCollaborateur
if (agenceId == null)
throw new ApiException(400, "Missing required parameter 'agenceId' when calling AgenceApi->MajAgence");
var localVarPath = "/agence/{agenceId}";
var localVarPath = "/agences/{agenceId}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
@ -837,7 +837,7 @@ namespace IO.Swagger.ApiCollaborateur
if (agenceId == null)
throw new ApiException(400, "Missing required parameter 'agenceId' when calling AgenceApi->MajAgence");
var localVarPath = "/agence/{agenceId}";
var localVarPath = "/agences/{agenceId}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
@ -911,7 +911,7 @@ namespace IO.Swagger.ApiCollaborateur
if (agenceId == null)
throw new ApiException(400, "Missing required parameter 'agenceId' when calling AgenceApi->MajAgencepatch");
var localVarPath = "/agence/{agenceId}";
var localVarPath = "/agences/{agenceId}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
@ -986,7 +986,7 @@ namespace IO.Swagger.ApiCollaborateur
if (agenceId == null)
throw new ApiException(400, "Missing required parameter 'agenceId' when calling AgenceApi->MajAgencepatch");
var localVarPath = "/agence/{agenceId}";
var localVarPath = "/agences/{agenceId}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -20,7 +20,7 @@ namespace IO.Swagger.ApiCollaborateur
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IPridodeDessaiApi : IApiAccessor
public interface IPeridodeDessaiApi : IApiAccessor
{
#region Synchronous Operations
/// <summary>
@ -215,15 +215,15 @@ namespace IO.Swagger.ApiCollaborateur
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class PridodeDessaiApi : IPridodeDessaiApi
public partial class PeriodeDessaiApi : IPeridodeDessaiApi
{
private IO.Swagger.ClientCollaborateur.ExceptionFactory _exceptionFactory = (name, response) => null;
/// <summary>
/// Initializes a new instance of the <see cref="PridodeDessaiApi"/> class.
/// Initializes a new instance of the <see cref="PeriodeDessaiApi"/> class.
/// </summary>
/// <returns></returns>
public PridodeDessaiApi(String basePath)
public PeriodeDessaiApi(String basePath)
{
this.Configuration = new IO.Swagger.ClientCollaborateur.Configuration { BasePath = basePath };
@ -231,10 +231,10 @@ namespace IO.Swagger.ApiCollaborateur
}
/// <summary>
/// Initializes a new instance of the <see cref="PridodeDessaiApi"/> class
/// Initializes a new instance of the <see cref="PeriodeDessaiApi"/> class
/// </summary>
/// <returns></returns>
public PridodeDessaiApi()
public PeriodeDessaiApi()
{
this.Configuration = IO.Swagger.ClientCollaborateur.Configuration.Default;
@ -242,12 +242,12 @@ namespace IO.Swagger.ApiCollaborateur
}
/// <summary>
/// Initializes a new instance of the <see cref="PridodeDessaiApi"/> class
/// Initializes a new instance of the <see cref="PeriodeDessaiApi"/> class
/// using Configuration object
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <returns></returns>
public PridodeDessaiApi(IO.Swagger.ClientCollaborateur.Configuration configuration = null)
public PeriodeDessaiApi(IO.Swagger.ClientCollaborateur.Configuration configuration = null)
{
if (configuration == null) // use the default one in Configuration
this.Configuration = IO.Swagger.ClientCollaborateur.Configuration.Default;
@ -343,7 +343,7 @@ namespace IO.Swagger.ApiCollaborateur
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling PridodeDessaiApi->Maj1PE");
throw new ApiException(400, "Missing required parameter 'collabId' when calling PeridodeDessaiApi->Maj1PE");
var localVarPath = "/collaborateurs/{collabId}/PremierePeriodeEssai";
var localVarPathParams = new Dictionary<String, String>();
@ -418,7 +418,7 @@ namespace IO.Swagger.ApiCollaborateur
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling PridodeDessaiApi->Maj1PE");
throw new ApiException(400, "Missing required parameter 'collabId' when calling PeridodeDessaiApi->Maj1PE");
var localVarPath = "/collaborateurs/{collabId}/PremierePeriodeEssai";
var localVarPathParams = new Dictionary<String, String>();
@ -492,7 +492,7 @@ namespace IO.Swagger.ApiCollaborateur
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling PridodeDessaiApi->Maj1PEPatch");
throw new ApiException(400, "Missing required parameter 'collabId' when calling PeridodeDessaiApi->Maj1PEPatch");
var localVarPath = "/collaborateurs/{collabId}/PremierePeriodeEssai";
var localVarPathParams = new Dictionary<String, String>();
@ -567,7 +567,7 @@ namespace IO.Swagger.ApiCollaborateur
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling PridodeDessaiApi->Maj1PEPatch");
throw new ApiException(400, "Missing required parameter 'collabId' when calling PeridodeDessaiApi->Maj1PEPatch");
var localVarPath = "/collaborateurs/{collabId}/PremierePeriodeEssai";
var localVarPathParams = new Dictionary<String, String>();
@ -641,7 +641,7 @@ namespace IO.Swagger.ApiCollaborateur
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling PridodeDessaiApi->MajPE");
throw new ApiException(400, "Missing required parameter 'collabId' when calling PeridodeDessaiApi->MajPE");
var localVarPath = "/collaborateurs/{collabId}/PeriodeEssai";
var localVarPathParams = new Dictionary<String, String>();
@ -716,7 +716,7 @@ namespace IO.Swagger.ApiCollaborateur
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling PridodeDessaiApi->MajPE");
throw new ApiException(400, "Missing required parameter 'collabId' when calling PeridodeDessaiApi->MajPE");
var localVarPath = "/collaborateurs/{collabId}/PeriodeEssai";
var localVarPathParams = new Dictionary<String, String>();
@ -790,7 +790,7 @@ namespace IO.Swagger.ApiCollaborateur
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling PridodeDessaiApi->MajPEPatch");
throw new ApiException(400, "Missing required parameter 'collabId' when calling PeridodeDessaiApi->MajPEPatch");
var localVarPath = "/collaborateurs/{collabId}/PeriodeEssai";
var localVarPathParams = new Dictionary<String, String>();
@ -865,7 +865,7 @@ namespace IO.Swagger.ApiCollaborateur
{
// verify the required parameter 'collabId' is set
if (collabId == null)
throw new ApiException(400, "Missing required parameter 'collabId' when calling PridodeDessaiApi->MajPEPatch");
throw new ApiException(400, "Missing required parameter 'collabId' when calling PeridodeDessaiApi->MajPEPatch");
var localVarPath = "/collaborateurs/{collabId}/PeriodeEssai";
var localVarPathParams = new Dictionary<String, String>();

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

@ -0,0 +1,19 @@
using System;
using System.Collections;
using System.ComponentModel.DataAnnotations;
namespace EPAServeur.Attributes
{
/// <summary>
/// Specifies that a collection of a specified type must have at least one element.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
public sealed class CannotBeEmptyAttribute : RequiredAttribute
{
public override bool IsValid(object value)
{
var list = value as IEnumerable;
return list != null && list.GetEnumerator().MoveNext();
}
}
}

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -25,7 +25,7 @@ namespace IO.Swagger.ClientCollaborateur
/// <summary>
/// API client is mainly responsible for making the HTTP call to the API backend.
/// </summary>
public partial class ApiClient
public partial class ApiClient
{
private JsonSerializerSettings serializerSettings = new JsonSerializerSettings
{
@ -53,12 +53,12 @@ namespace IO.Swagger.ClientCollaborateur
public ApiClient()
{
Configuration = IO.Swagger.ClientCollaborateur.Configuration.Default;
RestClient = new RestClient("https://virtserver.swaggerhub.com/LilianG/Service-Collaborateur/1.1.1");
RestClient = new RestClient("http://localhost:3000");
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" /> class
/// with default base path (https://virtserver.swaggerhub.com/LilianG/Service-Collaborateur/1.1.1).
/// with default base path (http://localhost:3000).
/// </summary>
/// <param name="config">An instance of Configuration.</param>
public ApiClient(Configuration config)
@ -73,9 +73,9 @@ namespace IO.Swagger.ClientCollaborateur
/// with default configuration.
/// </summary>
/// <param name="basePath">The base path.</param>
public ApiClient(String basePath = "http://localhost:3000/api")
public ApiClient(String basePath = "http://localhost:3000")
{
if (String.IsNullOrEmpty(basePath))
if (String.IsNullOrEmpty(basePath))
throw new ArgumentException("basePath cannot be empty");
RestClient = new RestClient(basePath);
@ -116,23 +116,23 @@ namespace IO.Swagger.ClientCollaborateur
var request = new RestRequest(path, method);
// add path parameter, if any
foreach(var param in pathParams)
foreach (var param in pathParams)
request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment);
// add header parameter, if any
foreach(var param in headerParams)
foreach (var param in headerParams)
request.AddHeader(param.Key, param.Value);
// add query parameter, if any
foreach(var param in queryParams)
foreach (var param in queryParams)
request.AddQueryParameter(param.Key, param.Value);
// add form parameter, if any
foreach(var param in formParams)
foreach (var param in formParams)
request.AddParameter(param.Key, param.Value);
// add file parameter, if any
foreach(var param in fileParams)
foreach (var param in fileParams)
{
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentLength, param.Value.ContentType);
}
@ -169,7 +169,7 @@ namespace IO.Swagger.ClientCollaborateur
pathParams, contentType);
// set timeout
RestClient.Timeout = Configuration.Timeout;
// set user agent
RestClient.UserAgent = Configuration.UserAgent;
@ -178,7 +178,7 @@ namespace IO.Swagger.ClientCollaborateur
var response = RestClient.Execute(request);
InterceptResponse(request, response);
return (Object) response;
return (Object)response;
}
/// <summary>
/// Makes the asynchronous HTTP request.
@ -204,6 +204,7 @@ namespace IO.Swagger.ClientCollaborateur
pathParams, contentType);
InterceptRequest(request);
var response = await RestClient.ExecuteAsync(request);
//var response = await RestClient.ExecuteAsync(request);
InterceptResponse(request, response);
return (Object)response;
}
@ -246,13 +247,13 @@ namespace IO.Swagger.ClientCollaborateur
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15T13:45:30.0000000
return ((DateTime)obj).ToString (Configuration.DateTimeFormat);
return ((DateTime)obj).ToString(Configuration.DateTimeFormat);
else if (obj is DateTimeOffset)
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15T13:45:30.0000000
return ((DateTimeOffset)obj).ToString (Configuration.DateTimeFormat);
return ((DateTimeOffset)obj).ToString(Configuration.DateTimeFormat);
else if (obj is IList)
{
var flattenedString = new StringBuilder();
@ -265,7 +266,7 @@ namespace IO.Swagger.ClientCollaborateur
return flattenedString.ToString();
}
else
return Convert.ToString (obj);
return Convert.ToString(obj);
}
/// <summary>
@ -308,13 +309,14 @@ namespace IO.Swagger.ClientCollaborateur
if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object
{
return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind);
return DateTime.Parse(response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind);
}
if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type
{
return ConvertType(response.Content, type);
}
// at this point, it must be a model (json)
try
{
@ -426,7 +428,7 @@ namespace IO.Swagger.ClientCollaborateur
/// <returns>Byte array</returns>
public static byte[] ReadAsBytes(Stream inputStream)
{
byte[] buf = new byte[16*1024];
byte[] buf = new byte[16 * 1024];
using (MemoryStream ms = new MemoryStream())
{
int count;

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -114,7 +114,7 @@ namespace IO.Swagger.ClientCollaborateur
public Configuration()
{
UserAgent = "Swagger-Codegen/1.0.0/csharp";
BasePath = "http://localhost:3000/api";
BasePath = "http://localhost:3000";
DefaultHeader = new ConcurrentDictionary<string, string>();
ApiKey = new ConcurrentDictionary<string, string>();
ApiKeyPrefix = new ConcurrentDictionary<string, string>();
@ -129,7 +129,7 @@ namespace IO.Swagger.ClientCollaborateur
IDictionary<string, string> defaultHeader,
IDictionary<string, string> apiKey,
IDictionary<string, string> apiKeyPrefix,
string basePath = "http://localhost:3000/api") : this()
string basePath = "http://localhost:3000") : this()
{
if (string.IsNullOrWhiteSpace(basePath))
throw new ArgumentException("The provided basePath is invalid.", "basePath");
@ -437,7 +437,7 @@ namespace IO.Swagger.ClientCollaborateur
String report = "C# SDK (IO.Swagger) Debug Report:\n";
report += " OS: " + System.Environment.OSVersion + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
report += " Version of the API: 1.1.2\n";
report += " Version of the API: 1.1.3\n";
report += " SDK Package Version: 1.0.0\n";
return report;

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

@ -3,7 +3,7 @@
*
* Api du service Collaborateur, utilisée pour récupérer les données des collaborateurs d'Apside
*
* OpenAPI spec version: 1.1.2
* OpenAPI spec version: 1.1.3
* Contact: lilian.gayet@apside-groupe.com
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/

@ -12,7 +12,7 @@ namespace EPAServeur.BDAccess
public class APIAccess
{
private static APIAccess instance = null;
private string serveur = "http://localhost:3000";
private string serveur = "http://www.epa.apside.com/api";
private APIAccess()
{

@ -16,9 +16,9 @@ namespace EPAServeur.BDAccess
{
MySqlConnectionStringBuilder infoConnection = new MySqlConnectionStringBuilder()
{
Server = "localhost",
Server = "digitepa_db",
Port = 3306,
Database = "evaluationprofessionelle",
Database = "database_ep",
UserID = "dev",
Password = "dev"
};

@ -10,7 +10,7 @@ namespace EPAServeur.Commun
{
public class KeycloakAuthentificator
{
private static readonly string host = "http://localhost:8080/auth/realms/master/protocol/openid-connect/userinfo";
private static readonly string host = "http://www.epa.apside.com/auth/realms/master/protocol/openid-connect/userinfo";
public static bool IsvalidToken(string token)
{
List<KeyValuePair<string, string>> param = new List<KeyValuePair<string, string>>();

File diff suppressed because it is too large Load Diff

@ -0,0 +1,236 @@
using EPAServeur.Models.EP;
using EPAServeur.Models.Formation;
using EPAServeur.Models.Notes;
using EPAServeur.Models.SaisieChamp;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EPAServeur.Context
{
public class EpContext : DbContext
{
public EpContext(DbContextOptions options): base(options)
{
}
//EP
public DbSet<AugmentationSalaire> AugmentationSalaire { get; set; }
public DbSet<ChoixTypeEntretien> ChoixTypeEntretien { get; set; }
public DbSet<DemandeDelegation> DemandeDelegation { get; set; }
public DbSet<Document> Document { get; set; }
public DbSet<Engagement> Engagement { get; set; }
public DbSet<Ep> Ep { get; set; }
public DbSet<Objectif> Objectif { get; set; }
public DbSet<ObjectifPrecedent> ObjectifPrecedent { get; set; }
public DbSet<RdvEntretien> RdvEntretien { get; set; }
public DbSet<ReferentEP> ReferentEP { get; set; }
public DbSet<TypeEntretien> TypeEntretien { get; set; }
//Formation
public DbSet<DemandeFormation> DemandeFormation { get; set; }
public DbSet<Formation> Formation { get; set; }
public DbSet<ModeFormation> ModeFormation { get; set; }
public DbSet<OrigineDemande> OrigineDemandeFormation { get; set; }
public DbSet<OrigineFormation> OrigineFormation { get; set; }
public DbSet<ParticipationFormation> ParticipationFormation { get; set; }
public DbSet<StatutFormation> StatutFormation { get; set; }
public DbSet<TypeFormation> TypeFormation { get; set; }
//Note
public DbSet<Note> Note { get; set; }
//SaisieChamp
public DbSet<Champ> Champ { get; set; }
public DbSet<Saisie> Saisie { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
//EP
modelBuilder.Entity<AugmentationSalaire>(entity =>
{
entity.HasKey(e => e.IdAugmentationSalaire);
entity.Property(e => e.IdAugmentationSalaire).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Document>(entity =>
{
entity.HasKey(e => e.IdDocument);
entity.Property(e => e.IdDocument).ValueGeneratedOnAdd();
entity.HasMany<Saisie>(e => e.Saisies).WithOne(e => e.Document);
});
modelBuilder.Entity<Engagement>(entity =>
{
entity.HasKey(e => e.IdEngagement);
entity.Property(e => e.IdEngagement).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Ep>(entity =>
{
entity.HasKey(e => e.IdEP);
entity.HasOne<AugmentationSalaire>(e => e.AugmentationSalaire).WithOne(a => a.Ep).HasForeignKey<AugmentationSalaire>(a => a.IdEP);
entity.HasMany<ChoixTypeEntretien>(e => e.ChoixTypeEntretien).WithOne(c => c.Ep);
entity.HasOne<DemandeDelegation>(e => e.DemandeDelegation).WithOne(d => d.Ep).HasForeignKey<DemandeDelegation>(d => d.IdEP);
entity.HasMany<DemandeFormation>(e => e.DemandesFormation).WithOne(d => d.Ep);
entity.HasMany<CommentaireAssistant>(e => e.CommentairesAssistant).WithOne(c => c.Ep);
entity.HasMany<Document>(e => e.Documents).WithOne(d => d.Ep);
entity.HasMany<Engagement>(e => e.Engagements).WithOne(e => e.Ep);
entity.HasMany<Objectif>(e => e.Objectifs).WithOne(o => o.Ep);
entity.HasMany<ObjectifPrecedent>(e => e.ObjectifsPrecedents).WithOne(o => o.Ep);
entity.HasMany<ParticipationEP>(e => e.Participants).WithOne(p => p.Ep);
entity.HasOne<RdvEntretien>(e => e.RdvEntretien).WithOne(r => r.EpChoixRDV).HasForeignKey<RdvEntretien>( r => r.IdEPChoixRDV);
entity.HasMany<RdvEntretien>(e => e.PropositionsRDV).WithOne(r => r.EpProposition);
entity.HasOne<DemandeEPI>(e => e.DemandeEPI).WithOne(a => a.Ep).HasForeignKey<DemandeEPI>(a => a.IdEP);
});
modelBuilder.Entity<Objectif>(entity =>
{
entity.HasKey(e => e.IdObjectif);
entity.Property(e => e.IdObjectif).ValueGeneratedOnAdd();
});
modelBuilder.Entity<ObjectifPrecedent>(entity =>
{
entity.HasKey(e => e.IdObjectif);
entity.Property(e => e.IdObjectif).ValueGeneratedOnAdd();
});
modelBuilder.Entity<RdvEntretien>(entity =>
{
entity.HasKey(e => e.IdRdvEntretien);
entity.Property(e => e.IdRdvEntretien).ValueGeneratedOnAdd();
entity.HasOne(e => e.TypeEntretien).WithMany(t => t.RdvEntretiens);
});
modelBuilder.Entity<ReferentEP>(entity =>
{
entity.HasKey(e => e.IdCollaborateur);
});
modelBuilder.Entity<ChoixTypeEntretien>(entity =>
{
entity.HasKey(e => e.IdChoixTypeEntretien);
});
modelBuilder.Entity<DemandeDelegation>(entity =>
{
entity.HasKey(e => e.IdDemandeDelegation);
});
modelBuilder.Entity<DemandeEPI>(entity =>
{
entity.HasKey(e => e.IdDemandeEPI);
});
modelBuilder.Entity<ParticipationEP>(entity =>
{
entity.HasKey(e => e.IdParticipationEP);
});
modelBuilder.Entity<TypeEntretien>(entity =>
{
entity.HasKey(e => e.IdTypeEntretien);
entity.HasIndex(e => e.Libelle).IsUnique();
entity.HasMany<ChoixTypeEntretien>(e => e.ChoixTypeEntretien).WithOne(c => c.TypeEntretien);
});
modelBuilder.Entity<CommentaireAssistant>(entity =>
{
entity.HasKey(e => e.IdCommentaireAssistant);
entity.Property(e => e.IdCommentaireAssistant).ValueGeneratedOnAdd();
});
//Formation
modelBuilder.Entity<DemandeFormation>(entity =>
{
entity.HasKey(e => e.IdDemandeFormation);
entity.Property(e => e.IdDemandeFormation).ValueGeneratedOnAdd();
entity.HasOne<ParticipationFormation>(e => e.ParticipationFormation).WithOne(e => e.DemandeFormation).HasForeignKey<ParticipationFormation>("IdDemandeFormation");
entity.HasOne<OrigineDemande>(o => o.OrigineDemande).WithMany().IsRequired();
});
modelBuilder.Entity<Formation>(entity =>
{
entity.HasKey(e => e.IdFormation);
entity.Property(e => e.IdFormation).ValueGeneratedOnAdd();
entity.HasMany<ParticipationFormation>(e => e.ParticipationsFormation).WithOne(e => e.Formation);
});
modelBuilder.Entity<ModeFormation>(entity =>
{
entity.HasKey(e => e.IdModeFormation);
entity.Property(e => e.IdModeFormation).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<OrigineDemande>(entity =>
{
entity.HasKey(e => e.IdOrigineDemande);
entity.Property(e => e.IdOrigineDemande).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<OrigineFormation>(entity =>
{
entity.HasKey(e => e.IdOrigineFormation);
entity.Property(e => e.IdOrigineFormation).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<ParticipationFormation>(entity =>
{
entity.HasKey(e => e.IdParticipationFormation);
entity.Property(e => e.IdParticipationFormation).ValueGeneratedOnAdd();
entity.Property<long>("IdDemandeFormation");
entity.HasMany<Saisie>(e => e.Evaluation).WithOne(e => e.ParticipationFormation);
});
modelBuilder.Entity<StatutFormation>(entity =>
{
entity.HasKey(e => e.IdStatutFormation);
entity.Property(e => e.IdStatutFormation).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
modelBuilder.Entity<TypeFormation>(entity =>
{
entity.HasKey(e => e.IdTypeFormation);
entity.Property(e => e.IdTypeFormation).ValueGeneratedOnAdd();
entity.HasIndex(e => e.Libelle).IsUnique();
});
//Notes
modelBuilder.Entity<Note>(entity =>
{
entity.HasKey(e => e.IdNote);
entity.Property(e => e.IdNote).ValueGeneratedOnAdd();
});
//SaisieChamp
modelBuilder.Entity<Champ>(entity =>
{
entity.HasKey(e => e.IdChamp);
entity.Property(e => e.IdChamp).ValueGeneratedOnAdd();
entity.HasMany<Saisie>(e => e.Saisies).WithOne(e => e.Champ);
});
modelBuilder.Entity<Saisie>(entity =>
{
entity.HasKey(e => e.IdSaisie);
entity.Property(e => e.IdSaisie).ValueGeneratedOnAdd();
});
}
}
}

@ -0,0 +1,596 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using Microsoft.Extensions.Logging;
using EPAServeur.IServices;
using System.Threading.Tasks;
using IO.Swagger.ClientCollaborateur;
using EPAServeur.Exceptions;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class CollaborateursApiController : ControllerBase
{
private readonly ICollaborateurService collaborateurService;
private readonly ILogger<CollaborateursApiController> logger;
private readonly IAuthorizationService authorizationService;
public CollaborateursApiController(ICollaborateurService _collaborateurService, ILogger<CollaborateursApiController> _logger, IAuthorizationService _authorizationService)
{
collaborateurService = _collaborateurService;
logger = _logger;
authorizationService = _authorizationService;
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer un collaborateur par son id.</remarks>
/// <param name="idCollaborateur">Id du collaborateur</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/collaborateurs/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateurById")]
[SwaggerResponse(statusCode: 200, type: typeof(CollaborateurDTO), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetCollaborateurById([FromRoute][Required]Guid? idCollaborateur)
{
CollaborateurDTO collaborateurDTO;
try
{
collaborateurDTO = await collaborateurService.GetCollaborateurByIdAsync(idCollaborateur);
}
catch (ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des données collaborateurs"
};
return StatusCode(500, erreur);
}
catch (CollaborateurNotFoundException e)
{
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreurDTO);
}
catch (Exception e)
{
logger.LogError(e.Message);
//TODO : vérifier des cas d'erreur possible avant ?...
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 500,
Message = "Une erreur interne est survenue sur le serveur",
};
return StatusCode(500, erreurDTO);
}
// Si l'utilisateur connecté est un collaborateur, on vérifie si il est autorisé à accéder au détail du collaborateur
if (User.IsInRole("Collaborateur"))
{
//Le collaborateur récupère ses informations
if (!(await authorizationService.AuthorizeAsync(User, collaborateurDTO, "SameMailRequirement")).Succeeded)
{
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 403,
Message = "Accès interdit",
};
return StatusCode(403, erreurDTO);
}
//TODO : Le collaborateur récupère les informations d'un collaborateur dont il est référentEP
//TODO : Le collaborateur récupère les informations d'un collaborateur dont il est référent de l'EP actuel
}
return Ok(collaborateurDTO);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(CollaborateurDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer un collaborateur par son mail.</remarks>
/// <param name="mail">Mail de l&#x27;utilisateur connecté (mail obtenu via le token Keycloak)</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/collaborateurs/{mail}/mail")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateurByMail")]
[SwaggerResponse(statusCode: 200, type: typeof(CollaborateurDTO), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetCollaborateurByMail([FromRoute][Required]string mail)
{
CollaborateurDTO collaborateurDTO;
try
{
collaborateurDTO = await collaborateurService.GetCollaborateurByMailAsync(mail);
}
catch (ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des données collaborateurs"
};
return StatusCode(500, erreur);
}
catch (CollaborateurNotFoundException e)
{
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreurDTO);
}
catch (Exception e)
{
logger.LogError(e.Message);
//TODO : vérifier des cas d'erreur possible avant ?...
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 500,
Message = "Une erreur interne est survenue sur le serveur",
};
return StatusCode(500, erreurDTO);
}
// Si l'utilisateur connecté est un collaborateur, on vérifie si il est autorisé à accéder au détail du collaborateur
if (User.IsInRole("Collaborateur"))
{
//Le collaborateur récupère ses informations
if (!(await authorizationService.AuthorizeAsync(User, collaborateurDTO, "SameMailRequirement")).Succeeded)
{
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 403,
Message = "Accès interdit",
};
return StatusCode(403, erreurDTO);
}
//TODO : Le collaborateur récupère les informations d'un collaborateur dont il est référentEP
//TODO : Le collaborateur récupère les informations d'un collaborateur dont il est référent de l'EP actuel
}
return Ok(collaborateurDTO);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(CollaborateurDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer une liste de collaborateurs.</remarks>
/// <param name="roles">Liste des rôles auquels appartiennent les collaborateurs (e.g [”CP”, ”Commerciaux”,”RA”])</param>
/// <param name="idBUs">liste des ids des BU auxquelles les données sont rattachées</param>
/// <param name="asc">Indique si les données sont récupérées dans l&#x27;ordre croissant ou non</param>
/// <param name="numPage">Numéro de la page du tableau à afficher</param>
/// <param name="parPage">Nombre d’élément maximum à afficher dans le tableau</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <param name="tri">Colonne du tableau sur lequel le tri devra être effectué</param>
/// <param name="dateDebut">Date à partir de laquelle les données son récupérées</param>
/// <param name="dateFin">Date jusqu&#x27;à laquelle les données sont récupérées</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/collaborateurs")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateurs")]
[SwaggerResponse(statusCode: 200, type: typeof(List<CollaborateurDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetCollaborateurs([FromQuery]List<string> roles, [FromQuery]List<long?> idBUs, [FromQuery]bool? asc, [FromQuery]int? numPage, [FromQuery][Range(5, 100)]int? parPage, [FromQuery]string texte, [FromQuery]string tri, [FromQuery]DateTime? dateDebut, [FromQuery]DateTime? dateFin)
{
IEnumerable<CollaborateurDTO> collaborateurs;
try
{
collaborateurs = await collaborateurService.GetCollaborateursAsync(roles, idBUs, asc, numPage, parPage, texte, tri, dateDebut, dateFin);
}
catch (ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des données collaborateurs"
};
return StatusCode(500, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 500,
Message = "Une erreur interne est survenue",
};
return StatusCode(500, erreurDTO);
}
return Ok(collaborateurs);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<CollaborateurDTO>));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des collaborateurs d’un référent.</remarks>
/// <param name="idReferent">Id d&#x27;un référent</param>
/// <param name="asc">Indique si les données sont récupérées dans l&#x27;ordre croissant ou non</param>
/// <param name="numPage">Numéro de la page du tableau à afficher</param>
/// <param name="parPage">Nombre d’élément maximum à afficher dans le tableau</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <param name="tri">Colonne du tableau sur lequel le tri devra être effectué</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/collaborateurs/referent/{idReferent}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateursByReferent")]
[SwaggerResponse(statusCode: 200, type: typeof(List<CollaborateurDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetCollaborateursByReferent([FromRoute][Required]Guid? idReferent, [FromQuery]bool? asc, [FromQuery]int? numPage, [FromQuery][Range(5, 100)]int? parPage, [FromQuery]string texte, [FromQuery]string tri)
{
IEnumerable<CollaborateurDTO> collaborateurs;
try
{
collaborateurs = await collaborateurService.GetCollaborateursByReferentAsync(idReferent, asc, numPage, parPage, texte, tri);
}
catch (ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des données collaborateurs"
};
return StatusCode(500, erreur);
}
catch (ReferentNotFoundException e)
{
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreurDTO);
}
catch (Exception e)
{
logger.LogError(e.Message);
//TODO : vérifier des cas d'erreur possible avant ?...
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 500,
Message = "Une erreur interne est survenue sur le serveur",
};
return StatusCode(500, erreurDTO);
}
return Ok(collaborateurs);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<CollaborateurDTO>));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer le nombre total de collaborateurs d’un référent.</remarks>
/// <param name="idReferent">Id d&#x27;un référent</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/collaborateurs/referent/{idReferent}/count")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateursByReferentCount")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetCollaborateursByReferentCount([FromRoute][Required]Guid? idReferent, [FromQuery]string texte)
{
int collaborateurs;
try
{
collaborateurs = await collaborateurService.GetCollaborateursCountByReferentAsync(idReferent, texte);
}
catch (ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des données collaborateurs"
};
return StatusCode(500, erreur);
}
catch (ReferentNotFoundException e)
{
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreurDTO);
}
catch (Exception e)
{
logger.LogError(e.Message);
//TODO : vérifier des cas d'erreur possible avant ?...
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 500,
Message = "Une erreur interne est survenue sur le serveur",
};
return StatusCode(500, erreurDTO);
}
return Ok(collaborateurs);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(long?));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer le nombre total de collaborateurs.</remarks>
/// <param name="roles">Liste des rôles auquels appartiennent les collaborateurs (e.g [”CP”, ”Commerciaux”,”RA”])</param>
/// <param name="idBUs">liste des ids des BU auxquelles les données sont rattachées</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <param name="dateDebut">Date à partir de laquelle les données son récupérées</param>
/// <param name="dateFin">Date jusqu&#x27;à laquelle les données sont récupérées</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/collaborateurs/count")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetCollaborateursCount")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetCollaborateursCount([FromQuery]List<string> roles, [FromQuery]List<long?> idBUs, [FromQuery]string texte, [FromQuery]DateTime? dateDebut, [FromQuery]DateTime? dateFin)
{
int collaborateurs;
try
{
collaborateurs = await collaborateurService.GetCollaborateursCountAsync(roles, idBUs, texte, dateDebut, dateFin);
}
catch (ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des données collaborateurs"
};
return StatusCode(500, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
//TODO : vérifier des cas d'erreur possible avant ?...
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 500,
Message = "Une erreur interne est survenue sur le serveur",
};
return StatusCode(500, erreurDTO);
}
return Ok(collaborateurs);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(long?));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des référents des précédents EP du collaborateur.</remarks>
/// <param name="idCollaborateur">Id du collaborateur</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/collaborateurs/{idCollaborateur}/ep/referents")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetReferentsPrecedentEPCollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<CollaborateurDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetReferentsPrecedentEPCollaborateur([FromRoute][Required]Guid? idCollaborateur)
{
IEnumerable<CollaborateurDTO> referents = null;
try
{
referents = await collaborateurService.GetReferentsPrecedentsEPAsync(idCollaborateur);
}
catch (CollaborateurNotFoundException e) {
ErreurDTO erreur = new ErreurDTO()
{
Code = 404,
Message = e.Message
};
return NotFound(erreur);
}
catch (ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des données collaborateurs"
};
return StatusCode(500, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
//TODO : vérifier des cas d'erreur possible avant ?...
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 500,
Message = "Une erreur interne est survenue sur le serveur",
};
return StatusCode(500, erreurDTO);
}
return Ok(referents);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<CollaborateurDTO>));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
}
}

@ -0,0 +1,223 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using EPAServeur.IServices;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using EPAServeur.Exceptions;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class DemandesDelegationApiController : ControllerBase
{
/// <summary>
/// Services des demandes de délégation
/// </summary>
private readonly IDemandeDelegationService demandeDelegationService;
/// <summary>
/// Logger du contrôleur
/// </summary>
private readonly ILogger<DemandesDelegationApiController> logger;
public DemandesDelegationApiController(IDemandeDelegationService _demandeDelegationService, ILogger<DemandesDelegationApiController> _logger)
{
demandeDelegationService = _demandeDelegationService;
logger = _logger;
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des demandes de délégation d’un référent.</remarks>
/// <param name="idReferent">Id d&#x27;un référent</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/demandesdelegation/referent/{idReferent}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandesDelegationReferent")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeDelegationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetDemandesDelegationReferent([FromRoute][Required]Guid? idReferent)
{
IEnumerable<DemandeDelegationDTO> demandeDelegations;
try
{
demandeDelegations = await demandeDelegationService.RecupererDemandesDelegation(idReferent);
}
catch (ReferentNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreur);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur inconnue est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
return Ok(demandeDelegations);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<DemandeDelegationDTO>));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Répondre à une demande de délégation.</remarks>
/// <param name="body"></param>
/// <param name="idDemandeDelegation">Id d&#x27;une demande delegation</param>
/// <response code="200">Demande de délégation mise à jour avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[Route("/api/demandesdelegation/{idDemandeDelegation}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("UpdateDemandeDelegation")]
[SwaggerResponse(statusCode: 200, type: typeof(DemandeDelegationDTO), description: "Demande de délégation mise à jour avec succès")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> UpdateDemandeDelegation([FromBody]DemandeDelegationDTO body, [FromRoute][Required]long? idDemandeDelegation)
{
try
{
body = await demandeDelegationService.UpdateDemandeDelegation(idDemandeDelegation, body);
}
catch (DemandeDelegationIncompatibleException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DemandeDelegationInvalidException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DemandeDelegationNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur inconnue est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
return Ok(body);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(DemandeDelegationDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 415 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(415, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
}
}

@ -0,0 +1,440 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using IO.Swagger.Enum;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class DemandesEPIApiController : ControllerBase
{
/// <summary>
///
/// </summary>
/// <remarks>Effectuer la création d’une demande d’EPI par l&#x27;assistant ou bien un responsable d&#x27;agence.</remarks>
/// <param name="body"></param>
/// <response code="201">Demande d&#x27;EPI créée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPost]
[Route("/api/demandesepi/demande/assistant")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("AddDemandeEpiAssistant")]
[SwaggerResponse(statusCode: 201, type: typeof(DemandeEPIDTO), description: "Demande d&#x27;EPI créée avec succès")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual IActionResult AddDemandeEpiAssistant([FromBody]DemandeEPIDTO body)
{
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201, default(DemandeEPIDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 415 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(415, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 8,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<DemandeEPIDTO>(exampleJson)
: default(DemandeEPIDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Effectuer la création d’une demande d’EPI par le collaborateur.</remarks>
/// <param name="body"></param>
/// <response code="201">Demande d&#x27;EPI créée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPost]
[Route("/api/demandesepi/demande/collaborateur")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("AddDemandeEpiCollaborateur")]
[SwaggerResponse(statusCode: 201, type: typeof(DemandeEPIDTO), description: "Demande d&#x27;EPI créée avec succès")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual IActionResult AddDemandeEpiCollaborateur([FromBody]DemandeEPIDTO body)
{
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201, default(DemandeEPIDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 415 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(415, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 8,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<DemandeEPIDTO>(exampleJson)
: default(DemandeEPIDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Effectuer la création d’une demande d’EPI par le référent.</remarks>
/// <param name="body"></param>
/// <response code="201">Demande d&#x27;EPI créée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPost]
[Route("/api/demandesepi/demande/referent")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("AddDemandeEpiReferent")]
[SwaggerResponse(statusCode: 201, type: typeof(DemandeEPIDTO), description: "Demande d&#x27;EPI créée avec succès")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual IActionResult AddDemandeEpiReferent([FromBody]DemandeEPIDTO body)
{
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201, default(DemandeEPIDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 415 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(415, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 8,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<DemandeEPIDTO>(exampleJson)
: default(DemandeEPIDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Annuler une demande d’EPI.</remarks>
/// <param name="idDemandeEPI">Id d&#x27;une demande d&#x27;EPI</param>
/// <response code="204">Demande annulée</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpDelete]
[Route("/api/demandesepi/{idDemandeEPI}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("DeleteDemandeEPI")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual IActionResult DeleteDemandeEPI([FromRoute][Required]long? idDemandeEPI)
{
//TODO: Uncomment the next line to return response 204 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(204);
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
throw new NotImplementedException();
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des demandes d’EPI d’un collaborateur.</remarks>
/// <param name="idCollaborateur">Id du collaborateur</param>
/// <param name="etatsDemande">Liste des états des demandes à afficher</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/demandesepi/collaborateur/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandeEPICollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeEPIDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual IActionResult GetDemandeEPICollaborateur([FromRoute][Required]Guid? idCollaborateur, [FromQuery]List<EtatDemande> etatsDemande)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<DemandeEPIDTO>));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 8,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}, {\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 8,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<DemandeEPIDTO>>(exampleJson)
: default(List<DemandeEPIDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer le nombre total de demandes d’EPI d’un collaborateur.</remarks>
/// <param name="idCollaborateur">Id du collaborateur</param>
/// <param name="etatsDemande">Liste des états des demandes à afficher</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/demandesepi/collaborateur/{idCollaborateur}/count")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandeEPICollaborateurCount")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual IActionResult GetDemandeEPICollaborateurCount([FromRoute][Required]Guid? idCollaborateur, [FromQuery]List<EtatDemande> etatsDemande)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(long?));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
string exampleJson = null;
exampleJson = "0";
var example = exampleJson != null
? JsonConvert.DeserializeObject<long?>(exampleJson)
: default(long?); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des demandes d’EPI qu’un référent a reçu.</remarks>
/// <param name="idReferent">Id d&#x27;un référent</param>
/// <param name="etatsDemande">Liste des états des demandes à afficher</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/demandesepi/referent/{idReferent}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandeEPIReferent")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeEPIDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual IActionResult GetDemandeEPIReferent([FromRoute][Required]Guid? idReferent, [FromQuery]List<EtatDemande> etatsDemande)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<DemandeEPIDTO>));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
string exampleJson = null;
exampleJson = "[ {\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 8,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}, {\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 8,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n} ]";
var example = exampleJson != null
? JsonConvert.DeserializeObject<List<DemandeEPIDTO>>(exampleJson)
: default(List<DemandeEPIDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer le nombre total de demandes d’EPI qu’un référent a reçu.</remarks>
/// <param name="idReferent">Id d&#x27;un référent</param>
/// <param name="etatsDemande">Liste des états des demandes à afficher</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/demandesepi/referent/{idReferent}/count")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandeEPIReferentCount")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual IActionResult GetDemandeEPIReferentCount([FromRoute][Required]Guid? idReferent, [FromQuery]List<EtatDemande> etatsDemande)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(long?));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
string exampleJson = null;
exampleJson = "0";
var example = exampleJson != null
? JsonConvert.DeserializeObject<long?>(exampleJson)
: default(long?); //TODO: Change the data returned
return new ObjectResult(example);
}
/// <summary>
///
/// </summary>
/// <remarks>Répondre à une demande d’EPI.</remarks>
/// <param name="body"></param>
/// <param name="idDemandeEPI">Id d&#x27;une demande d&#x27;EPI</param>
/// <response code="200">Demande mise à jour</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[Route("/api/demandesepi/{idDemandeEPI}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("UpdateDemandeEPI")]
[SwaggerResponse(statusCode: 200, type: typeof(DemandeEPIDTO), description: "Demande mise à jour")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual IActionResult UpdateDemandeEPI([FromBody]DemandeEPIDTO body, [FromRoute][Required]long? idDemandeEPI)
{
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(DemandeEPIDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 415 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(415, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
string exampleJson = null;
exampleJson = "{\n \"raisonRefus\" : \"raisonRefus\",\n \"dateReponse\" : \"2000-01-23T04:56:07.000+00:00\",\n \"id\" : 8,\n \"dateDemande\" : \"2000-01-23T04:56:07.000+00:00\"\n}";
var example = exampleJson != null
? JsonConvert.DeserializeObject<DemandeEPIDTO>(exampleJson)
: default(DemandeEPIDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
}
}

@ -0,0 +1,494 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using IO.Swagger.Enum;
using EPAServeur.IServices;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Hosting;
using Microsoft.AspNetCore.Hosting;
using System.Threading.Tasks;
using EPAServeur.Exceptions;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class DemandesFormationApiController : ControllerBase
{
private readonly IDemandeFormationService demandeFormationService;
private readonly ILogger<DemandesFormationApiController> logger;
private readonly IWebHostEnvironment env;
public DemandesFormationApiController(IDemandeFormationService _demandeFormationService, ILogger<DemandesFormationApiController> _logger, IWebHostEnvironment _env)
{
demandeFormationService = _demandeFormationService;
logger = _logger;
env = _env;
}
/// <summary>
///
/// </summary>
/// <remarks>Créer demande de formation pour un collaborateur.</remarks>
/// <param name="body"></param>
/// <response code="201">Demande formation créée</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPost]
[Route("/api/demandesformation")]
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("AddDemandeFormation")]
[SwaggerResponse(statusCode: 201, type: typeof(DemandeFormationDTO), description: "Demande formation créée")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> AddDemandeFormation([FromBody] DemandeFormationDTO body)
{
if (env.IsDevelopment())
logger.LogInformation("Ajout d'une nouvelle demande de formation.");
try
{
body = await demandeFormationService.AddDemandeFormationAsync(body);
}
catch (DemandeFormationInvalidException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur est survenue sur le serveur lors de l'ajout de la demande de formation.",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur.",
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Nouvelle demande de formation ajoutée.");
return Created("", body);
}
/// <summary>
///
/// </summary>
/// <remarks>Supprimer une demande de formation.</remarks>
/// <param name="idDemandeFormation">Id d&#x27;une demande de formation</param>
/// <response code="204">Demande de formation supprimée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpDelete]
[Route("/api/demandesformation/{idDemandeFormation}")]
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("DeleteDemandeFormation")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> DeleteDemandeFormation([FromRoute][Required] long idDemandeFormation)
{
try
{
if (env.IsDevelopment())
logger.LogInformation("Suppression de la demande de formation {idDemandeFormation}.", idDemandeFormation);
bool demandeFormationSupprimee = await demandeFormationService.DeleteDemandeFormationAsync(idDemandeFormation);
}
catch (DemandeFormationNotFoundException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status404NotFound,
Message = e.Message
};
return NotFound(erreur);
}
catch (DemandeFormationInvalidException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (DbUpdateConcurrencyException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = string.Format("La demande de formation {0} n'a pas pu être supprimée car elle est prise par une autre ressource.", idDemandeFormation)
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur est survenue sur le serveur lors de la suppression de la demande de formation."
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Demande de formation {idDemandeFormation} supprimée avec succès.", idDemandeFormation);
return NoContent();
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des demandes de formation.</remarks>
/// <param name="etatsDemande">Liste des états des demandes à afficher</param>
/// <param name="idBUs">liste des ids des BU auxquelles les données sont rattachées</param>
/// <param name="statutsEp">Liste des statuts d'EP auxquelles les données sont rattachées</param>
/// <param name="asc">Indique si les données sont récupérées dans l&#x27;ordre croissant ou non</param>
/// <param name="numPage">Numéro de la page du tableau à afficher</param>
/// <param name="parPAge">Nombre d’élément maximum à afficher dans le tableau</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <param name="tri">Colonne du tableau sur lequel le tri devra être effectué</param>
/// <param name="dateDebut">Date à partir de laquelle les données son récupérées</param>
/// <param name="dateFin">Date jusqu&#x27;à laquelle les données sont récupérées</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/demandesformation")]
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<DemandeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetDemandesFormation([FromQuery] List<EtatDemande> etatsDemande, [FromQuery] List<long?> idBUs, [FromQuery] List<StatutEp> statutsEp, [FromQuery] bool? asc, [FromQuery] int? numPage, [FromQuery][Range(5, 100)] int? parPAge, [FromQuery] string texte, [FromQuery] string tri, [FromQuery] DateTime? dateDebut, [FromQuery] DateTime? dateFin)
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la liste des demandes de formation.");
IEnumerable<DemandeFormationDTO> demandeFormations;
try
{
demandeFormations = await demandeFormationService.GetDemandesFormationAsync(etatsDemande, idBUs, statutsEp, asc, numPage, parPAge, texte, tri, dateDebut, dateFin);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Liste des demandes de formation récupérée.");
return Ok(demandeFormations);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer le nombre total de demandes de formation.</remarks>
/// <param name="etatsDemande">Liste des états des demandes à afficher</param>
/// <param name="idBUs">liste des ids des BU auxquelles les données sont rattachées</param>
/// <param name="statutsEp">Liste des statuts d'EP auxquelles les données sont rattachées</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <param name="dateDebut">Date à partir de laquelle les données son récupérées</param>
/// <param name="dateFin">Date jusqu&#x27;à laquelle les données sont récupérées</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/demandesformation/count")]
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetDemandesFormationCount")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetDemandesFormationCount([FromQuery] List<EtatDemande> etatsDemande, [FromQuery] List<long?> idBUs, [FromQuery] List<StatutEp> statutsEp, [FromQuery] string texte, [FromQuery] DateTime? dateDebut, [FromQuery] DateTime? dateFin)
{
if (env.IsDevelopment())
logger.LogInformation("Récupération du nombre total de demandes de formation.");
long count;
try
{
count = await demandeFormationService.GetDemandesFormationCountAsync(etatsDemande, idBUs, statutsEp, texte, dateDebut, dateFin);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Nombre total de demandes de formation récupéré.");
return Ok(count);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des origines des demandes de formation.</remarks>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/originesdemandeformation")]
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetOriginesDemandeFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineDemandeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetOriginesDemandeFormation()
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la liste des origines de demande de formation.");
IEnumerable<OrigineDemandeFormationDTO> origineDemandes;
try
{
origineDemandes = await demandeFormationService.GetOriginesDemandeFormationAsync();
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Liste des origines de demande de formation récupérée.");
return Ok(origineDemandes);
}
/// <summary>
///
/// </summary>
/// <remarks>Répondre à une demande de formation.</remarks>
/// <param name="body"></param>
/// <param name="idDemandeFormation">Id d&#x27;une demande de formation</param>
/// <response code="200">demande formation mise à jour</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[Route("/api/demandesformation/{idDemandeFormation}")]
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("UpdateDemandeFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(DemandeFormationDTO), description: "demande formation mise à jour")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> UpdateDemandeFormation([FromBody] DemandeFormationDTO body, [FromRoute][Required] long idDemandeFormation)
{
if (env.IsDevelopment())
logger.LogInformation("Mise à jour de la demande de formation d'id {idDemandeFormation}.", idDemandeFormation);
try
{
body = await demandeFormationService.UpdateDemandeFormationAsync(idDemandeFormation, body);
}
catch (DemandeFormationInvalidException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (DemandeFormationIncompatibleIdException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (DemandeFormationNotFoundException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status404NotFound,
Message = e.Message
};
return NotFound(erreur);
}
catch (DbUpdateConcurrencyException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = string.Format("La demande de formation {0} n'a pas pu être mise à jour car elle est prise par une autre ressource.", idDemandeFormation)
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur est survenue sur le serveur lors de la mise à jour de la demande de formation."
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Update effectué avec succès");
return Ok(body);
}
}
}

@ -0,0 +1,270 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using IO.Swagger.Enum;
using EPAServeur.Attributes;
using EPAServeur.IServices;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
using EPAServeur.Exceptions;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authentication.JwtBearer;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class EngagementsApiController : ControllerBase
{
private readonly IEngagementService engagementService;
private readonly ILogger<EngagementsApiController> logger;
private readonly IWebHostEnvironment env;
public EngagementsApiController(IEngagementService _engagementService, ILogger<EngagementsApiController> _logger, IWebHostEnvironment _env)
{
engagementService = _engagementService;
logger = _logger;
env = _env;
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des engagements.</remarks>
/// <param name="idBUs">liste des ids des BU auxquelles les données sont rattachées</param>
/// <param name="etatsEngagement">Etats de l&#x27;engagement</param>
/// <param name="asc">Indique si les données sont récupérées dans l&#x27;ordre croissant ou non</param>
/// <param name="numPage">Numéro de la page du tableau à afficher</param>
/// <param name="parPage">Nombre d’élément maximum à afficher dans le tableau</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <param name="tri">Colonne du tableau sur lequel le tri devra être effectué</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/engagements")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("GetEngagements")]
[SwaggerResponse(statusCode: 200, type: typeof(List<EngagementDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetEngagements([FromQuery][CannotBeEmpty] List<long> idBUs, [FromQuery]List<EtatEngagement> etatsEngagement, [FromQuery]bool? asc, [FromQuery]int? numPage, [FromQuery][Range(5, 100)]int? parPage, [FromQuery]string texte, [FromQuery]string tri)
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la liste des engagements.");
IEnumerable<EngagementDTO> engagements;
try
{
engagements = await engagementService.GetEngagementsAsync(idBUs, etatsEngagement, asc, numPage, parPage, texte, tri);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Liste des engagements récupérée.");
return Ok(engagements);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer le nombre total d’engagements.</remarks>
/// <param name="idBUs">liste des ids des BU auxquelles les données sont rattachées</param>
/// <param name="etatsEngagement">Etats de l&#x27;engagement</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/engagements/count")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("GetEngagementsCount")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetEngagementsCount([FromQuery][CannotBeEmpty]List<long> idBUs, [FromQuery]List<EtatEngagement> etatsEngagement, [FromQuery]string texte)
{
if (env.IsDevelopment())
logger.LogInformation("Récupération du nombre total d'engagements.");
long count;
try
{
count = await engagementService.GetEngagementsCountAsync(idBUs, etatsEngagement, texte);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Nombre total d'engagement récupéré.");
return Ok(count);
}
/// <summary>
///
/// </summary>
/// <remarks>Répondre à un engagement.</remarks>
/// <param name="body"></param>
/// <param name="idEngagement">Id d&#x27;un engagement</param>
/// <response code="200">Engagement modifié avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[Route("/api/engagements/{idEngagement}")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("UpdateEngagement")]
[SwaggerResponse(statusCode: 200, type: typeof(EngagementDTO), description: "Engagement modifié avec succès")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> UpdateEngagement([FromBody]EngagementDTO body, [FromRoute][Required]long idEngagement)
{
if (env.IsDevelopment())
logger.LogInformation("Mise à jour de l'engagement d'id {idEngagement}.", idEngagement);
try
{
body = await engagementService.RepondreEngagementAsync(body, idEngagement);
}
catch (EngagementInvalidException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (EngagementIncompatibleIdException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (EngagementNotFoundException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status404NotFound,
Message = e.Message
};
return NotFound(erreur);
}
catch (DbUpdateConcurrencyException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = string.Format("L'engagement {0} n'a pas pu être mise à jour car il est pris par une autre ressource.", idEngagement)
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur est survenue sur le serveur lors de la mise à jour de l'engagement."
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Update effectué avec succès.");
return Ok(body);
}
}
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,681 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using System.ComponentModel;
using EPAServeur.IServices;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using EPAServeur.Exceptions;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Authentication.JwtBearer;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class FormationsApiController : ControllerBase
{
private readonly IFormationService formationService;
private readonly ILogger<FormationsApiController> logger;
private readonly IWebHostEnvironment env;
public FormationsApiController(IFormationService _formationService, ILogger<FormationsApiController> _logger, IWebHostEnvironment _env)
{
formationService = _formationService;
logger = _logger;
env = _env;
}
/// <summary>
///
/// </summary>
/// <remarks>Créer une nouvelle formation.</remarks>
/// <param name="body"></param>
/// <response code="201">Formation créée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPost]
[Route("/api/formations")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("AddFormation")]
[SwaggerResponse(statusCode: 201, type: typeof(FormationDTO), description: "Formation créée avec succès")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> AddFormation([FromBody] FormationDTO body)
{
if (env.IsDevelopment())
logger.LogInformation("Ajout d'une nouvelle formation.");
try
{
body = await formationService.AddFormationAsync(body);
}
catch (FormationInvalidException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur est survenue sur le serveur lors de l'ajout de la formation.",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur.",
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Nouvelle formation ajoutée.");
return Created("", body);
}
/// <summary>
///
/// </summary>
/// <remarks>Supprimer une formation par son id.</remarks>
/// <param name="idFormation">Id d&#x27;une formation</param>
/// <response code="204">Formation supprimée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpDelete]
[Route("/api/formations/{idFormation}")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("DeleteFormation")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> DeleteFormation([FromRoute][Required] long idFormation)
{
try
{
if (env.IsDevelopment())
logger.LogInformation("Suppresion de la formation {idFormation}.", idFormation);
FormationDTO formation = await formationService.DeleteFormationByIdAsync(idFormation);
}
catch (FormationNotFoundException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status404NotFound,
Message = e.Message
};
return NotFound(erreur);
}
catch (DbUpdateConcurrencyException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = string.Format("La formation {0} n'a pas pu être supprimée car elle est prise par une autre ressource.", idFormation)
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur est survenue sur le serveur lors de la suppression de la formation."
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Formation {idFormation} supprimée avec succès.", idFormation);
return NoContent();
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer une formation par son id.</remarks>
/// <param name="idFormation">Id d&#x27;une formation</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/formations/{idFormation}")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("GetFormationById")]
[SwaggerResponse(statusCode: 200, type: typeof(FormationDTO), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetFormationById([FromRoute][Required] long idFormation)
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la formation {idFormation}.", idFormation);
FormationDTO formationDTO;
try
{
formationDTO = await formationService.GetFormationByIdAsync(idFormation);
}
catch (FormationNotFoundException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = StatusCodes.Status404NotFound,
Message = e.Message
};
return NotFound(erreurDTO);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Formation {idFormation} récupérée.", idFormation);
return Ok(formationDTO);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des formations.</remarks>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="idStatuts">liste des ids des statuts des formations à récupérer</param>
/// <param name="asc">Indique si les données sont récupérées dans l&#x27;ordre croissant ou non</param>
/// <param name="numPage">Numéro de la page du tableau à afficher</param>
/// <param name="parPage">Nombre d’élément maximum à afficher dans le tableau</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <param name="tri">Colonne du tableau sur lequel le tri devra être effectué</param>
/// <param name="dateDebut">Date à partir de laquelle les données son récupérées</param>
/// <param name="dateFin">Date jusqu&#x27;à laquelle les données sont récupérées</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/formations")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("GetFormations")]
[SwaggerResponse(statusCode: 200, type: typeof(List<FormationDetailsDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetFormations([FromQuery] long? idAgence, [FromQuery] List<int?> idStatuts, [FromQuery] bool? asc, [FromQuery] int? numPage, [FromQuery][Range(5, 100)][DefaultValue(15)] int? parPage, [FromQuery] string texte, [FromQuery] string tri, [FromQuery] DateTime? dateDebut, [FromQuery] DateTime? dateFin)
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la liste des formations.");
IEnumerable<FormationDetailsDTO> formations;
try
{
formations = await formationService.GetFormationsAsync(idAgence, idStatuts, asc, numPage, parPage, texte, tri, dateDebut, dateFin);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Liste des formations récupérée.");
return Ok(formations);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer le nombre total de formations.</remarks>
/// <param name="idAgence">id de l&#x27;agence à laquelle sont rattachées les données à récupérer</param>
/// <param name="idStatuts">liste des ids des statuts des formations à récupérer</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <param name="dateDebut">Date à partir de laquelle les données son récupérées</param>
/// <param name="dateFin">Date jusqu&#x27;à laquelle les données sont récupérées</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/formations/count")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("GetFormationsCount")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetFormationsCount([FromQuery] long? idAgence, [FromQuery] List<int?> idStatuts, [FromQuery] string texte, [FromQuery] DateTime? dateDebut, [FromQuery] DateTime? dateFin)
{
if (env.IsDevelopment())
logger.LogInformation("Récupération du nombre total de formations.");
long count;
try
{
count = await formationService.GetFormationsCountAsync(idAgence, idStatuts, texte, dateDebut, dateFin);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Nombre total de formations récupéré.");
return Ok(count);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des modes de formation.</remarks>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/modesformation")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("GetModesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ModeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetModesFormation()
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la liste des modes de formation.");
IEnumerable<ModeFormationDTO> modeFormations;
try
{
modeFormations = await formationService.GetModesFormationAsync();
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Liste des modes de formation récupérée.");
return Ok(modeFormations);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des origines de formation.</remarks>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/originesformation")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("GetOriginesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<OrigineFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetOriginesFormation()
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la liste des origines de formation.");
IEnumerable<OrigineFormationDTO> origineFormations;
try
{
origineFormations = await formationService.GetOriginesFormationAsync();
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Liste des origines de formation récupérée.");
return Ok(origineFormations);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des statuts de formation.</remarks>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/statutsformation")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("GetStatutsFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<StatutFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetStatutsFormation()
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la liste des statuts de formation.");
IEnumerable<StatutFormationDTO> statutFormations;
try
{
statutFormations = await formationService.GetStatutsFormationAsync();
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Liste des statuts de formation récupérée.");
return Ok(statutFormations);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des types de formation.</remarks>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/typesformation")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("GetTypesFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(List<TypeFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetTypesFormation()
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la liste des types de formation.");
IEnumerable<TypeFormationDTO> typeFormations;
try
{
typeFormations = await formationService.GetTypesFormationAsync();
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Liste des types de formation récupérée.");
return Ok(typeFormations);
}
/// <summary>
///
/// </summary>
/// <remarks>Mettre à jour une formation.</remarks>
/// <param name="body"></param>
/// <param name="idFormation">Id d&#x27;une formation</param>
/// <response code="200">formation mise à jour</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[Route("/api/formations/{idFormation}")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH")]
[ValidateModelState]
[SwaggerOperation("UpdateFormation")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> UpdateFormation([FromBody] FormationDTO body, [FromRoute][Required] long idFormation)
{
if (env.IsDevelopment())
logger.LogInformation("Mise à jour de la formation d'id {idFormation}.", idFormation);
try
{
body = await formationService.UpdateFormationAsync(idFormation, body);
}
catch (FormationIncompatibleIdException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (FormationInvalidException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (FormationNotFoundException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status404NotFound,
Message = e.Message
};
return NotFound(erreur);
}
catch (DbUpdateConcurrencyException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = string.Format("La formation {0} n'a pas pu être mise à jour car elle est prise par une autre ressource.", idFormation)
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur est survenue sur le serveur lors de la mise à jour de la formation."
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Update effectué avec succès");
return Ok(body);
}
}
}

@ -0,0 +1,566 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using EPAServeur.IServices;
using Microsoft.Extensions.Logging;
using IO.Swagger.ClientCollaborateur;
using EPAServeur.Exceptions;
using Microsoft.EntityFrameworkCore;
using System.Threading.Tasks;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class NotesApiController : ControllerBase
{
/// <summary>
/// Service des note
/// </summary>
private readonly INoteService noteService;
/// <summary>
/// Logger du contrôleur
/// </summary>
private readonly ILogger<NotesApiController> logger;
public NotesApiController(INoteService _noteService, ILogger<NotesApiController> _logger)
{
noteService = _noteService;
logger = _logger;
}
/// <summary>
///
/// </summary>
/// <remarks>Créer une nouvelle note.</remarks>
/// <param name="body"></param>
/// <response code="201">Note créée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPost]
[Route("/api/notes/")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("AddNote")]
[SwaggerResponse(statusCode: 201, type: typeof(DetailsNoteDTO), description: "Note créée avec succès")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> AddNote([FromBody]DetailsNoteDTO body)
{
try
{
body = await noteService.AjouterNoteAsync(body);
}
catch(ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des données collaborateurs",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch(NoteInvalideException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch(ReferentNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreur);
}
catch(CollaborateurNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreur);
}
catch(CollaborateurPartiException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value,erreur);
}
catch(DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch(Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur inconnue est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
return Created("",body);
//TODO: Uncomment the next line to return response 201 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(201, default(DetailsNoteDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 415 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(415, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Supprimer une note.</remarks>
/// <param name="idNote">Id d&#x27;une note</param>
/// <response code="204">Note supprimée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpDelete]
[Route("/api/notes/{idNote}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("DeleteNote")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> DeleteNote([FromRoute][Required]long? idNote)
{
try
{
await noteService.SupprimerNoteAsync(idNote);
}
catch(NoteNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 404,
Message = e.Message
};
return NotFound(erreur);
}
catch(DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la suppression"
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur inconnue est survenue"
};
return StatusCode(erreur.Code.Value, erreur);
}
return NoContent();
//TODO: Uncomment the next line to return response 204 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(204);
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer une note par son id.</remarks>
/// <param name="idNote">Id d&#x27;une note</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/notes/{idNote}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetNoteById")]
[SwaggerResponse(statusCode: 200, type: typeof(DetailsNoteDTO), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetNoteById([FromRoute][Required]long? idNote)
{
DetailsNoteDTO note;
try
{
note = await noteService.GetNoteByIdAsync(idNote);
}
catch(ReferentNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreur);
}
catch (CollaborateurNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreur);
}
catch (NoteNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreur);
}
catch(Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur inconnue est survenue",
};
return StatusCode(500, erreur);
}
return Ok(note);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(DetailsNoteDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer les notes d’un auteur.</remarks>
/// <param name="idAuteur">Id de l&#x27;auteur</param>
/// <param name="asc">Indique si les données sont récupérées dans l&#x27;ordre croissant ou non</param>
/// <param name="numPage">Numéro de la page du tableau à afficher</param>
/// <param name="parPage">Nombre d’élément maximum à afficher dans le tableau</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <param name="tri">Colonne du tableau sur lequel le tri devra être effectué</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/notes/auteur/{idAuteur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetNotesAuteur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<AffichageNoteDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetNotesAuteur([FromRoute][Required]Guid? idAuteur, [FromQuery]bool? asc, [FromQuery]int? numPage, [FromQuery][Range(5, 100)]int? parPage, [FromQuery]string texte, [FromQuery]string tri)
{
IEnumerable<AffichageNoteDTO> affichageNotes;
try
{
affichageNotes = await noteService.GetNotesByAuteurAsync(idAuteur, asc, numPage, parPage, texte, tri);
//affichageNotes = noteService.GetNotesByAuteur(idAuteur, asc, numPage, parPage, texte, tri);
}
catch(ReferentNotFoundException e)
{
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreurDTO);
}
catch(ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des informations collaborateurs",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch(Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = 500,
//Message = "Une erreur inconnue est survenue",
Message = e.StackTrace,
};
return StatusCode(500, erreur);
}
return Ok(affichageNotes);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(List<AffichageNoteDTO>));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer le nombre total de notes d’un auteur.</remarks>
/// <param name="idAuteur">Id de l&#x27;auteur</param>
/// <param name="texte">Texte permettant de filtrer les données</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/notes/auteur/{idAuteur}/count")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetNotesAuteurCount")]
[SwaggerResponse(statusCode: 200, type: typeof(long?), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetNotesAuteurCount([FromRoute][Required]Guid? idAuteur, [FromQuery]string texte)
{
int notes;
try
{
notes = await noteService.GetNotesByAuteurCountAsync(idAuteur, texte);
}
catch(ApiException e)
{
logger.LogError(e.Message);
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 500,
Message = "Une erreur est survenue lors de la récupération des informations collaborateurs",
};
return StatusCode(500, erreurDTO);
}
catch(ReferentNotFoundException e)
{
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 404,
Message = e.Message,
};
return NotFound(erreurDTO);
}
catch(Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = 500,
Message = "Une erreur inconnue es survenue sur le serveur",
};
return StatusCode(500, erreurDTO);
}
return Ok(notes);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(long?));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Modifier une note.</remarks>
/// <param name="body"></param>
/// <param name="idNote">Id d&#x27;une note</param>
/// <response code="200">Note modifiée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[Route("/api/notes/{idNote}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("UpdateNote")]
[SwaggerResponse(statusCode: 200, type: typeof(DetailsNoteDTO), description: "Note modifiée avec succès")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> UpdateNote([FromBody]DetailsNoteDTO body, [FromRoute][Required]long? idNote)
{
try
{
body = await noteService.UpdateNoteAsync(idNote, body);
}
catch(NoteIdImcompatibleException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}catch(NoteInvalideException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateConcurrencyException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur inconnue est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
return Ok(body);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(DetailsNoteDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 415 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(415, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
}
}

@ -0,0 +1,276 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using EPAServeur.IServices;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using System.Threading.Tasks;
using EPAServeur.Exceptions;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class ParticipationsFormationsApiController : ControllerBase
{
private readonly IParticipationFormationService participationFormationService;
private readonly ILogger<ParticipationsFormationsApiController> logger;
private readonly IWebHostEnvironment env;
public ParticipationsFormationsApiController(IParticipationFormationService _participationFormationService, ILogger<ParticipationsFormationsApiController> _logger, IWebHostEnvironment _env)
{
participationFormationService = _participationFormationService;
logger = _logger;
env = _env;
}
/// <summary>
///
/// </summary>
/// <remarks>Evaluer une formation.</remarks>
/// <param name="body"></param>
/// <param name="idParticipationFormation">Id d&#x27;une participation formation</param>
/// <response code="200">Evaluation envoyée avec succès</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[Route("/api/participationsformation/{idParticipationFormation}/evaluation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("EvaluerFormation")]
[SwaggerResponse(statusCode: 200, type: typeof(EvaluationDTO), description: "Evaluation envoyée avec succès")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> EvaluerFormation([FromBody]EvaluationDTO body, [FromRoute][Required]long idParticipationFormation)
{
if (env.IsDevelopment())
logger.LogInformation("Mise à jour de la participation à la formation d'id {idParticipationFormation}.", idParticipationFormation);
try
{
body = await participationFormationService.EvaluerFormationAsync(idParticipationFormation, body);
}
catch (ParticipationFormationIncompatibleIdException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (ParticipationFormationInvalidException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status415UnsupportedMediaType,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur.Message);
}
catch (ParticipationFormationNotFoundException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status404NotFound,
Message = e.Message
};
return NotFound(erreur);
}
catch (DbUpdateConcurrencyException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = string.Format("La participation à la formation {0} n'a pas pu être mise à jour car elle est prise par une autre ressource.", idParticipationFormation)
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur est survenue sur le serveur lors de la mise à jour de la participation à la formation."
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Update effectué avec succès");
return Ok(body);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer une évaluation faite par un collaborateur.</remarks>
/// <param name="idParticipationFormation">Id d&#x27;une participation formation</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/participationsformation/{idParticipationFormation}/evaluation")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetEvaluationCollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(EvaluationDTO), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetEvaluationCollaborateur([FromRoute][Required]long idParticipationFormation)
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la participation à la formation {idParticipationFormation}.", idParticipationFormation);
EvaluationDTO evaluationDTO;
try
{
evaluationDTO = await participationFormationService.GetEvaluationCollaborateurAsync(idParticipationFormation);
}
catch (ParticipationFormationNotFoundException e)
{
if (env.IsDevelopment())
logger.LogInformation(e.Message);
ErreurDTO erreurDTO = new ErreurDTO()
{
Code = StatusCodes.Status404NotFound,
Message = e.Message
};
return NotFound(erreurDTO);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Participation à la formation {idParticipationFormation} récupérée.", idParticipationFormation);
return Ok(evaluationDTO);
}
/// <summary>
///
/// </summary>
/// <remarks>Récupérer la liste des participations de formation d’un collaborateur.</remarks>
/// <param name="idCollaborateur">Id du collaborateur</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpGet]
[Route("/api/participationsformation/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetParticipationByCollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<ParticipationFormationDTO>), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> GetParticipationsByCollaborateur([FromRoute][Required]Guid idCollaborateur)
{
if (env.IsDevelopment())
logger.LogInformation("Récupération de la liste des particicaptions aux formations d'un collaborateur.");
IEnumerable<ParticipationFormationDTO> participationFormationDTOs;
try
{
participationFormationDTOs = await participationFormationService.GetParticipationsByCollaborateurAsync(idCollaborateur);
}
catch (Exception e)
{
logger.LogError(e.Message);
ErreurDTO erreur = new ErreurDTO()
{
Code = StatusCodes.Status500InternalServerError,
Message = "Une erreur inconnue est survenue sur le serveur."
};
return StatusCode(erreur.Code.Value, erreur);
}
if (env.IsDevelopment())
logger.LogInformation("Liste des particicaptions aux formations d'un collaborateur récupérée.");
return Ok(participationFormationDTOs);
}
}
}

@ -0,0 +1,323 @@
/*
* API du serveur de l'application de digitalisation des EP
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Swashbuckle.AspNetCore.SwaggerGen;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using IO.Swagger.Attributes;
using IO.Swagger.Security;
using Microsoft.AspNetCore.Authorization;
using IO.Swagger.DTO;
using EPAServeur.IServices;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using EPAServeur.Exceptions;
using IO.Swagger.ClientCollaborateur;
using Microsoft.EntityFrameworkCore;
namespace IO.Swagger.Controllers
{
/// <summary>
///
/// </summary>
[ApiController]
public class ReferentsEPApiController : ControllerBase
{
private readonly IReferentEPService referentEPService;
private readonly ILogger<ReferentsEPApiController> logger;
public ReferentsEPApiController(IReferentEPService _referentEPService, ILogger<ReferentsEPApiController> _logger)
{
referentEPService = _referentEPService;
logger = _logger;
}
/// <summary>
///
/// </summary>
/// <remarks>Mettre à jour les collaborateurs d&#x27;un référent.</remarks>
/// <param name="body"></param>
/// <param name="idReferent">Id d&#x27;un référent</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[Route("/api/referentsep/referent/{idReferent}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("UpdateCollaborateursReferent")]
[SwaggerResponse(statusCode: 200, type: typeof(ReferentEPDTO), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> UpdateCollaborateursReferent([FromBody]ReferentEPDTO body, [FromRoute][Required]Guid? idReferent)
{
try
{
body = await referentEPService.UpdateCollaborateursReferentAsync(body, idReferent);
}
catch (ApiException e)
{
ErreurDTO erreur = new ErreurDTO();
if (e.ErrorCode == 415)
{
erreur.Code = 415;
erreur.Message = e.Message;
}
else
{
erreur.Code = 500;
erreur.Message = "Un erreur est survenue lors de la communication avec le serveur distant";
}
return StatusCode(erreur.Code.Value, erreur);
}
catch (ReferentIncompatibleException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (ReferentNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 404,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (ListeIdsCollaborateursVideException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (CollaborateurPartiException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 4,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (CollaborateurNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 404,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateConcurrencyException)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Les données n'ont pas pu être mise à jour car elles ont été modifiés avant votre mise à jour",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError("Une erreur est survenue avec la base de données" + e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError("Une erreur inconnue est survenue :" + e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur incconue est survenue",
};
return StatusCode(erreur.Code.Value, erreur);
}
return Ok(body);
//catch() { }
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(ReferentEPDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 415 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(415, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
/// <summary>
///
/// </summary>
/// <remarks>Mettre à jour le référent d&#x27;un collaborateur.</remarks>
/// <param name="body"></param>
/// <param name="idCollaborateur">Id du collaborateur</param>
/// <response code="200">OK</response>
/// <response code="401">L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié</response>
/// <response code="403">L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants</response>
/// <response code="404">La ressource n&#x27;a pas été trouvée</response>
/// <response code="415">L’opération ne peut pas être effectuée car certaines données sont manquantes</response>
/// <response code="500">Une erreur est survenue sur le serveur</response>
[HttpPut]
[Route("/api/referentsep/collaborateur/{idCollaborateur}")]
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("UpdateReferentCollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(ReferentEPDTO), description: "OK")]
[SwaggerResponse(statusCode: 401, type: typeof(ErreurDTO), description: "L&#x27;utilisateur souhaitant accéder à la ressource n&#x27;est pas authentifié")]
[SwaggerResponse(statusCode: 403, type: typeof(ErreurDTO), description: "L’utilisateur souhaitant accéder à la ressource n’a pas les droits d’accès suffisants")]
[SwaggerResponse(statusCode: 404, type: typeof(ErreurDTO), description: "La ressource n&#x27;a pas été trouvée")]
[SwaggerResponse(statusCode: 415, type: typeof(ErreurDTO), description: "L’opération ne peut pas être effectuée car certaines données sont manquantes")]
[SwaggerResponse(statusCode: 500, type: typeof(ErreurDTO), description: "Une erreur est survenue sur le serveur")]
public virtual async Task<IActionResult> UpdateReferentCollaborateur([FromBody]ReferentEPDTO body, [FromRoute][Required]Guid? idCollaborateur)
{
try
{
body = await referentEPService.UpdateReferentCollaborateurAsync(body, idCollaborateur);
}
catch (CollaborateurIncompatibleException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (ApiException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = e.Message,
//Message = "Un erreur est survenue lors de la communication avec le serveur distant",
};
return StatusCode(500, erreur);
}
catch(ListeIdsCollaborateursVideException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 415,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (ReferentNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 404,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (CollaborateurPartiException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 4,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (CollaborateurNotFoundException e)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 404,
Message = e.Message,
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateConcurrencyException)
{
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Les données n'ont pas pu être mise à jour car elles ont été modifiés avant votre mise à jour",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (DbUpdateException e)
{
logger.LogError("Une erreur est survenue avec la base de données" + e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur est survenue sur le serveur",
};
return StatusCode(erreur.Code.Value, erreur);
}
catch (Exception e)
{
logger.LogError("Une erreur inconnue est survenue :" + e.Message);
ErreurDTO erreur = new ErreurDTO
{
Code = 500,
Message = "Une erreur incconue est survenue",
};
return StatusCode(erreur.Code.Value, erreur);
}
return Ok(body);
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(200, default(ReferentEPDTO));
//TODO: Uncomment the next line to return response 401 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(401, default(ErreurDTO));
//TODO: Uncomment the next line to return response 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(403, default(ErreurDTO));
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(404, default(ErreurDTO));
//TODO: Uncomment the next line to return response 415 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(415, default(ErreurDTO));
//TODO: Uncomment the next line to return response 500 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode(500, default(ErreurDTO));
}
}
}

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,43 +21,49 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Note affiché dans un tableau
/// DTO concernant l&#x27;affichage d&#x27;une note dans un tableau.
/// </summary>
[DataContract]
public partial class AffichageNoteDTO : IEquatable<AffichageNoteDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de la note
/// </summary>
/// <value>Id de la note</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Titre
/// Titre de la note
/// </summary>
/// <value>Titre de la note</value>
[Required]
[DataMember(Name="titre")]
public string Titre { get; set; }
/// <summary>
/// Gets or Sets IdCollaborateur
/// Id du collaborateur concerné par la note
/// </summary>
/// <value>Id du collaborateur concerné par la note</value>
[Required]
[DataMember(Name="idCollaborateur")]
public Guid? IdCollaborateur { get; set; }
/// <summary>
/// Gets or Sets Collaborateur
/// Nom et prénom du collaborateur concerné par la note
/// </summary>
[Required]
/// <value>Nom et prénom du collaborateur concerné par la note</value>
[DataMember(Name="collaborateur")]
public string Collaborateur { get; set; }
/// <summary>
/// Gets or Sets DateMiseAjour
/// Date à laquelle la note a été mise à jour pour la dernière fois
/// </summary>
[DataMember(Name="dateMiseAjour")]
public DateTime? DateMiseAjour { get; set; }
/// <value>Date à laquelle la note a été mise à jour pour la dernière fois</value>
[Required]
[DataMember(Name="dateMiseAJour")]
public DateTime? DateMiseAJour { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -71,7 +77,7 @@ namespace IO.Swagger.DTO
sb.Append(" Titre: ").Append(Titre).Append("\n");
sb.Append(" IdCollaborateur: ").Append(IdCollaborateur).Append("\n");
sb.Append(" Collaborateur: ").Append(Collaborateur).Append("\n");
sb.Append(" DateMiseAjour: ").Append(DateMiseAjour).Append("\n");
sb.Append(" DateMiseAJour: ").Append(DateMiseAJour).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -129,9 +135,9 @@ namespace IO.Swagger.DTO
Collaborateur.Equals(other.Collaborateur)
) &&
(
DateMiseAjour == other.DateMiseAjour ||
DateMiseAjour != null &&
DateMiseAjour.Equals(other.DateMiseAjour)
DateMiseAJour == other.DateMiseAJour ||
DateMiseAJour != null &&
DateMiseAJour.Equals(other.DateMiseAJour)
);
}
@ -153,8 +159,8 @@ namespace IO.Swagger.DTO
hashCode = hashCode * 59 + IdCollaborateur.GetHashCode();
if (Collaborateur != null)
hashCode = hashCode * 59 + Collaborateur.GetHashCode();
if (DateMiseAjour != null)
hashCode = hashCode * 59 + DateMiseAjour.GetHashCode();
if (DateMiseAJour != null)
hashCode = hashCode * 59 + DateMiseAJour.GetHashCode();
return hashCode;
}
}

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,21 +21,23 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Une agence de Apside
/// DTO contenant l’agence à laquelle appartient le collaborateur.
/// </summary>
[DataContract]
public partial class AgenceDTO : IEquatable<AgenceDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de l&#x27;agence
/// </summary>
/// <value>Id de l&#x27;agence</value>
[Required]
[DataMember(Name="id")]
public decimal? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Nom
/// Nom de l&#x27;agence
/// </summary>
/// <value>Nom de l&#x27;agence</value>
[Required]
[DataMember(Name="nom")]
public string Nom { get; set; }

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,34 +21,38 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Demande d&#x27;augmentation du salaire du collaborateur
/// DTO lié à la demande d&#x27;augmentation du salaire effectuée lors d&#x27;un EP.
/// </summary>
[DataContract]
public partial class AugmentationSalaireDTO : IEquatable<AugmentationSalaireDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de l&#x27;augmentation du salaire
/// </summary>
/// <value>Id de l&#x27;augmentation du salaire</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Augmentation
/// Pourcentage de l&#x27;augmentation du salaire
/// </summary>
/// <value>Pourcentage de l&#x27;augmentation du salaire</value>
[Required]
[DataMember(Name="augmentation")]
public decimal? Augmentation { get; set; }
public float? Augmentation { get; set; }
/// <summary>
/// Gets or Sets PrimeMission
/// Pourcentage de l&#x27;augmentation de la prime de mission
/// </summary>
[DataMember(Name="primeMission")]
public decimal? PrimeMission { get; set; }
/// <value>Pourcentage de l&#x27;augmentation de la prime de mission</value>
[DataMember(Name="augmentationPrimeMission")]
public float? AugmentationPrimeMission { get; set; }
/// <summary>
/// Gets or Sets Message
/// Message laissé par le référent suite à l&#x27;augmentation du salaire
/// </summary>
/// <value>Message laissé par le référent suite à l&#x27;augmentation du salaire</value>
[DataMember(Name="message")]
public string Message { get; set; }
@ -62,7 +66,7 @@ namespace IO.Swagger.DTO
sb.Append("class AugmentationSalaireDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Augmentation: ").Append(Augmentation).Append("\n");
sb.Append(" PrimeMission: ").Append(PrimeMission).Append("\n");
sb.Append(" AugmentationPrimeMission: ").Append(AugmentationPrimeMission).Append("\n");
sb.Append(" Message: ").Append(Message).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -111,9 +115,9 @@ namespace IO.Swagger.DTO
Augmentation.Equals(other.Augmentation)
) &&
(
PrimeMission == other.PrimeMission ||
PrimeMission != null &&
PrimeMission.Equals(other.PrimeMission)
AugmentationPrimeMission == other.AugmentationPrimeMission ||
AugmentationPrimeMission != null &&
AugmentationPrimeMission.Equals(other.AugmentationPrimeMission)
) &&
(
Message == other.Message ||
@ -136,8 +140,8 @@ namespace IO.Swagger.DTO
hashCode = hashCode * 59 + Id.GetHashCode();
if (Augmentation != null)
hashCode = hashCode * 59 + Augmentation.GetHashCode();
if (PrimeMission != null)
hashCode = hashCode * 59 + PrimeMission.GetHashCode();
if (AugmentationPrimeMission != null)
hashCode = hashCode * 59 + AugmentationPrimeMission.GetHashCode();
if (Message != null)
hashCode = hashCode * 59 + Message.GetHashCode();
return hashCode;

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,21 +21,23 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Une business unit d&#x27;une agence
/// DTO contenant la Business Unit à laquelle appartient le collaborateur.
/// </summary>
[DataContract]
public partial class BusinessUnitDTO : IEquatable<BusinessUnitDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de la Business Unit
/// </summary>
/// <value>Id de la Business Unit</value>
[Required]
[DataMember(Name="id")]
public decimal? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Nom
/// Nom de la Business Unit
/// </summary>
/// <value>Nom de la Business Unit</value>
[Required]
[DataMember(Name="nom")]
public string Nom { get; set; }
@ -43,7 +45,6 @@ namespace IO.Swagger.DTO
/// <summary>
/// Gets or Sets Agence
/// </summary>
[Required]
[DataMember(Name="agence")]
public AgenceDTO Agence { get; set; }

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,62 +17,68 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les champs d&#x27;un EP ou d&#x27;une évaluation à remplir
/// DTO concernant les champs des documents.
/// </summary>
[DataContract]
public partial class ChampDTO : IEquatable<ChampDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id du champ
/// </summary>
/// <value>Id du champ</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Texte
/// Texte du champ
/// </summary>
/// <value>Texte du champ</value>
[Required]
[DataMember(Name="texte")]
public string Texte { get; set; }
/// <summary>
/// Gets or Sets Section
/// Section à laquelle appartient le champ
/// </summary>
/// <value>Section à laquelle appartient le champ</value>
[Required]
[DataMember(Name="section")]
public string Section { get; set; }
/// <summary>
/// Gets or Sets Soussection
/// Sous-section à laquelle appartient le champ
/// </summary>
/// <value>Sous-section à laquelle appartient le champ</value>
[DataMember(Name="soussection")]
public string Soussection { get; set; }
/// <summary>
/// Gets or Sets Ordre
/// Ordre du champ dans sa section ou sous-section
/// </summary>
/// <value>Ordre du champ dans sa section ou sous-section</value>
[Required]
[DataMember(Name="ordre")]
public decimal? Ordre { get; set; }
public int? Ordre { get; set; }
/// <summary>
/// Gets or Sets TypeChamp
/// </summary>
[Required]
[DataMember(Name="typeChamp")]
public string TypeChamp { get; set; }
public TypeChamps TypeChamp { get; set; }
/// <summary>
/// Gets or Sets TypeSaisie
/// </summary>
[Required]
[DataMember(Name="typeSaisie")]
public string TypeSaisie { get; set; }
public TypeSaisie TypeSaisie { get; set; }
/// <summary>
/// Returns the string presentation of the object

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,49 +21,55 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les informations d&#x27;un collaborateur
/// DTO contenant les données du collaborateur.
/// </summary>
[DataContract]
public partial class CollaborateurDTO : IEquatable<CollaborateurDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id du collaborateur
/// </summary>
/// <value>Id du collaborateur</value>
[Required]
[DataMember(Name="id")]
public Guid? Id { get; set; }
/// <summary>
/// Gets or Sets Nom
/// Nom du collaborateur
/// </summary>
/// <value>Nom du collaborateur</value>
[Required]
[DataMember(Name="nom")]
public string Nom { get; set; }
/// <summary>
/// Gets or Sets Prenom
/// Prénom du collaborateur
/// </summary>
/// <value>Prénom du collaborateur</value>
[Required]
[DataMember(Name="prenom")]
public string Prenom { get; set; }
/// <summary>
/// Gets or Sets MailApside
/// Mail Apside du collaborateur
/// </summary>
/// <value>Mail Apside du collaborateur</value>
[Required]
[DataMember(Name="mailApside")]
public string MailApside { get; set; }
/// <summary>
/// Gets or Sets DateArrivee
/// Date à laquelle le collaborateur a été embauché
/// </summary>
/// <value>Date à laquelle le collaborateur a été embauché</value>
[Required]
[DataMember(Name="dateArrivee")]
public DateTime? DateArrivee { get; set; }
/// <summary>
/// Gets or Sets DateDepart
/// Date à laquelle le collaborateur a quitté l&#x27;entreprise
/// </summary>
/// <value>Date à laquelle le collaborateur a quitté l&#x27;entreprise</value>
[DataMember(Name="dateDepart")]
public DateTime? DateDepart { get; set; }
@ -77,7 +83,7 @@ namespace IO.Swagger.DTO
/// Gets or Sets Referent
/// </summary>
[DataMember(Name="referent")]
public ReferentDTO Referent { get; set; }
public CollaborateurDTO Referent { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -216,7 +222,12 @@ namespace IO.Swagger.DTO
return !Equals(left, right);
}
#pragma warning restore 1591
#endregion Operators
}
public static implicit operator CollaborateurDTO(Guid? v)
{
throw new NotImplementedException();
}
#pragma warning restore 1591
#endregion Operators
}
}

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.7
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -19,40 +19,41 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
{
/// <summary>
/// Objet à envoyer lors d&#x27;une demande de formation
/// DTO contenant le commentaire d&#x27;un assistant sur l&#x27;EP.
/// </summary>
[DataContract]
public partial class CreationDemandeFormationDTO : IEquatable<CreationDemandeFormationDTO>
{
public partial class CommentaireAssistantDTO : IEquatable<CommentaireAssistantDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id du commentaire assistant
/// </summary>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
/// <value>Id du commentaire assistant</value>
[DataMember(Name = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Libelle
/// Id de l&#x27;assistant qui a écrit le commentaire
/// </summary>
/// <value>Id de l&#x27;assistant qui a écrit le commentaire</value>
[Required]
[DataMember(Name="libelle")]
public string Libelle { get; set; }
[DataMember(Name = "idAssistant")]
public Guid? IdAssistant { get; set; }
/// <summary>
/// Gets or Sets Description
/// Gets or Sets Assistant
/// </summary>
[Required]
[DataMember(Name="description")]
public string Description { get; set; }
[DataMember(Name = "assistant")]
public string Assistant { get; set; }
/// <summary>
/// Gets or Sets Theme
/// Le commentaire de l’assistant
/// </summary>
/// <value>Le commentaire de l’assistant</value>
[Required]
[DataMember(Name="theme")]
public int? Theme { get; set; }
[DataMember(Name = "commentaire")]
public string Commentaire { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -61,11 +62,11 @@ namespace IO.Swagger.DTO
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class CreationDemandeFormationDTO {\n");
sb.Append("class CommentaireAssistantDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Libelle: ").Append(Libelle).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" Theme: ").Append(Theme).Append("\n");
sb.Append(" IdAssistant: ").Append(IdAssistant).Append("\n");
sb.Append(" Assistant: ").Append(Assistant).Append("\n");
sb.Append(" Commentaire: ").Append(Commentaire).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -88,39 +89,39 @@ namespace IO.Swagger.DTO
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((CreationDemandeFormationDTO)obj);
return obj.GetType() == GetType() && Equals((CommentaireAssistantDTO)obj);
}
/// <summary>
/// Returns true if CreationDemandeFormationDTO instances are equal
/// Returns true if CommentaireAssistantDTO instances are equal
/// </summary>
/// <param name="other">Instance of CreationDemandeFormationDTO to be compared</param>
/// <param name="other">Instance of CommentaireAssistantDTO to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(CreationDemandeFormationDTO other)
public bool Equals(CommentaireAssistantDTO other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return
return
(
Id == other.Id ||
Id != null &&
Id.Equals(other.Id)
) &&
) &&
(
Libelle == other.Libelle ||
Libelle != null &&
Libelle.Equals(other.Libelle)
) &&
IdAssistant == other.IdAssistant ||
IdAssistant != null &&
IdAssistant.Equals(other.IdAssistant)
) &&
(
Description == other.Description ||
Description != null &&
Description.Equals(other.Description)
) &&
Assistant == other.Assistant ||
Assistant != null &&
Assistant.Equals(other.Assistant)
) &&
(
Theme == other.Theme ||
Theme != null &&
Theme.Equals(other.Theme)
Commentaire == other.Commentaire ||
Commentaire != null &&
Commentaire.Equals(other.Commentaire)
);
}
@ -134,32 +135,32 @@ namespace IO.Swagger.DTO
{
var hashCode = 41;
// Suitable nullity checks etc, of course :)
if (Id != null)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (Libelle != null)
hashCode = hashCode * 59 + Libelle.GetHashCode();
if (Description != null)
hashCode = hashCode * 59 + Description.GetHashCode();
if (Theme != null)
hashCode = hashCode * 59 + Theme.GetHashCode();
if (IdAssistant != null)
hashCode = hashCode * 59 + IdAssistant.GetHashCode();
if (Assistant != null)
hashCode = hashCode * 59 + Assistant.GetHashCode();
if (Commentaire != null)
hashCode = hashCode * 59 + Commentaire.GetHashCode();
return hashCode;
}
}
#region Operators
#pragma warning disable 1591
#pragma warning disable 1591
public static bool operator ==(CreationDemandeFormationDTO left, CreationDemandeFormationDTO right)
public static bool operator ==(CommentaireAssistantDTO left, CommentaireAssistantDTO right)
{
return Equals(left, right);
}
public static bool operator !=(CreationDemandeFormationDTO left, CreationDemandeFormationDTO right)
public static bool operator !=(CommentaireAssistantDTO left, CommentaireAssistantDTO right)
{
return !Equals(left, right);
}
#pragma warning restore 1591
#pragma warning restore 1591
#endregion Operators
}
}

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,21 +17,29 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les détails d&#x27;une demande de délégation d&#x27;un EP
/// DTO pour la gestion des demandes de délégation.
/// </summary>
[DataContract]
public partial class DemandeDelegationDTO : IEquatable<DemandeDelegationDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de le demande de délégation
/// </summary>
[Required]
/// <value>Id de le demande de délégation</value>
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Referent
/// </summary>
[Required]
[DataMember(Name="referent")]
public CollaborateurDTO Referent { get; set; }
/// <summary>
/// Gets or Sets Ep
@ -41,27 +49,39 @@ namespace IO.Swagger.DTO
public EpInformationDTO Ep { get; set; }
/// <summary>
/// Gets or Sets DateDemande
/// Date à laquelle la demande de délégation a été effectuée
/// </summary>
/// <value>Date à laquelle la demande de délégation a été effectuée</value>
[Required]
[DataMember(Name="dateDemande")]
public DateTime? DateDemande { get; set; }
/// <summary>
/// Gets or Sets Reponse
/// Raison pour laquelle la demande a été effectuée
/// </summary>
/// <value>Raison pour laquelle la demande a été effectuée</value>
[Required]
[DataMember(Name="raisonDemande")]
public string RaisonDemande { get; set; }
/// <summary>
/// Gets or Sets EtatDemande
/// </summary>
[DataMember(Name="reponse")]
public bool? Reponse { get; set; }
[Required]
[DataMember(Name="etatDemande")]
public EtatDemande EtatDemande { get; set; }
/// <summary>
/// Gets or Sets DateReponse
/// Date à laquelle la réponse a été donnée
/// </summary>
/// <value>Date à laquelle la réponse a été donnée</value>
[DataMember(Name="dateReponse")]
public DateTime? DateReponse { get; set; }
/// <summary>
/// Gets or Sets RaisonRefus
/// Raison pour laquelle la demande a été refusée
/// </summary>
/// <value>Raison pour laquelle la demande a été refusée</value>
[DataMember(Name="raisonRefus")]
public string RaisonRefus { get; set; }
@ -74,9 +94,11 @@ namespace IO.Swagger.DTO
var sb = new StringBuilder();
sb.Append("class DemandeDelegationDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Referent: ").Append(Referent).Append("\n");
sb.Append(" Ep: ").Append(Ep).Append("\n");
sb.Append(" DateDemande: ").Append(DateDemande).Append("\n");
sb.Append(" Reponse: ").Append(Reponse).Append("\n");
sb.Append(" RaisonDemande: ").Append(RaisonDemande).Append("\n");
sb.Append(" EtatDemande: ").Append(EtatDemande).Append("\n");
sb.Append(" DateReponse: ").Append(DateReponse).Append("\n");
sb.Append(" RaisonRefus: ").Append(RaisonRefus).Append("\n");
sb.Append("}\n");
@ -120,6 +142,11 @@ namespace IO.Swagger.DTO
Id != null &&
Id.Equals(other.Id)
) &&
(
Referent == other.Referent ||
Referent != null &&
Referent.Equals(other.Referent)
) &&
(
Ep == other.Ep ||
Ep != null &&
@ -131,9 +158,14 @@ namespace IO.Swagger.DTO
DateDemande.Equals(other.DateDemande)
) &&
(
Reponse == other.Reponse ||
Reponse != null &&
Reponse.Equals(other.Reponse)
RaisonDemande == other.RaisonDemande ||
RaisonDemande != null &&
RaisonDemande.Equals(other.RaisonDemande)
) &&
(
EtatDemande == other.EtatDemande ||
EtatDemande != null &&
EtatDemande.Equals(other.EtatDemande)
) &&
(
DateReponse == other.DateReponse ||
@ -159,12 +191,16 @@ namespace IO.Swagger.DTO
// Suitable nullity checks etc, of course :)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (Referent != null)
hashCode = hashCode * 59 + Referent.GetHashCode();
if (Ep != null)
hashCode = hashCode * 59 + Ep.GetHashCode();
if (DateDemande != null)
hashCode = hashCode * 59 + DateDemande.GetHashCode();
if (Reponse != null)
hashCode = hashCode * 59 + Reponse.GetHashCode();
if (RaisonDemande != null)
hashCode = hashCode * 59 + RaisonDemande.GetHashCode();
if (EtatDemande != null)
hashCode = hashCode * 59 + EtatDemande.GetHashCode();
if (DateReponse != null)
hashCode = hashCode * 59 + DateReponse.GetHashCode();
if (RaisonRefus != null)

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,64 +17,62 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
/// <summary>
/// Demande d&#x27;EPI faite par un collaborateur
/// DTO pour afficher et gérer les demandes d&#x27;EPI.
/// </summary>
[DataContract]
public partial class DemandeEPIDTO : IEquatable<DemandeEPIDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de la demande d&#x27;EPI
/// </summary>
[Required]
/// <value>Id de la demande d&#x27;EPI</value>
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets IdCollaborateur
/// Gets or Sets Collaborateur
/// </summary>
[Required]
[DataMember(Name="idCollaborateur")]
public Guid? IdCollaborateur { get; set; }
[DataMember(Name="collaborateur")]
public CollaborateurDTO Collaborateur { get; set; }
/// <summary>
/// Gets or Sets IdReferent
/// Gets or Sets Referent
/// </summary>
[Required]
[DataMember(Name="idReferent")]
public Guid? IdReferent { get; set; }
[DataMember(Name="referent")]
public CollaborateurDTO Referent { get; set; }
/// <summary>
/// Gets or Sets DateDemande
/// Date à laquelle la demande d&#x27;EPI a été effectué
/// </summary>
/// <value>Date à laquelle la demande d&#x27;EPI a été effectué</value>
[Required]
[DataMember(Name="dateDemande")]
public DateTime? DateDemande { get; set; }
/// <summary>
/// Gets or Sets Etat
/// </summary>
[DataMember(Name="etat")]
public int? Etat { get; set; }
/// <summary>
/// Gets or Sets Reponse
/// Gets or Sets EtatDemande
/// </summary>
[DataMember(Name="reponse")]
public bool? Reponse { get; set; }
[Required]
[DataMember(Name="etatDemande")]
public EtatDemande EtatDemande { get; set; }
/// <summary>
/// Gets or Sets DateReponse
/// Date à laquelle le référent a répondu
/// </summary>
/// <value>Date à laquelle le référent a répondu</value>
[DataMember(Name="dateReponse")]
public DateTime? DateReponse { get; set; }
/// <summary>
/// Gets or Sets RaisonRefus
/// Raison pour laquelle la demande d&#x27;EPI a été rejeté
/// </summary>
/// <value>Raison pour laquelle la demande d&#x27;EPI a été rejeté</value>
[DataMember(Name="raisonRefus")]
public string RaisonRefus { get; set; }
@ -93,11 +91,10 @@ namespace IO.Swagger.DTO
var sb = new StringBuilder();
sb.Append("class DemandeEPIDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" IdCollaborateur: ").Append(IdCollaborateur).Append("\n");
sb.Append(" IdReferent: ").Append(IdReferent).Append("\n");
sb.Append(" Collaborateur: ").Append(Collaborateur).Append("\n");
sb.Append(" Referent: ").Append(Referent).Append("\n");
sb.Append(" DateDemande: ").Append(DateDemande).Append("\n");
sb.Append(" Etat: ").Append(Etat).Append("\n");
sb.Append(" Reponse: ").Append(Reponse).Append("\n");
sb.Append(" EtatDemande: ").Append(EtatDemande).Append("\n");
sb.Append(" DateReponse: ").Append(DateReponse).Append("\n");
sb.Append(" RaisonRefus: ").Append(RaisonRefus).Append("\n");
sb.Append(" Ep: ").Append(Ep).Append("\n");
@ -143,14 +140,14 @@ namespace IO.Swagger.DTO
Id.Equals(other.Id)
) &&
(
IdCollaborateur == other.IdCollaborateur ||
IdCollaborateur != null &&
IdCollaborateur.Equals(other.IdCollaborateur)
Collaborateur == other.Collaborateur ||
Collaborateur != null &&
Collaborateur.Equals(other.Collaborateur)
) &&
(
IdReferent == other.IdReferent ||
IdReferent != null &&
IdReferent.Equals(other.IdReferent)
Referent == other.Referent ||
Referent != null &&
Referent.Equals(other.Referent)
) &&
(
DateDemande == other.DateDemande ||
@ -158,14 +155,9 @@ namespace IO.Swagger.DTO
DateDemande.Equals(other.DateDemande)
) &&
(
Etat == other.Etat ||
Etat != null &&
Etat.Equals(other.Etat)
) &&
(
Reponse == other.Reponse ||
Reponse != null &&
Reponse.Equals(other.Reponse)
EtatDemande == other.EtatDemande ||
EtatDemande != null &&
EtatDemande.Equals(other.EtatDemande)
) &&
(
DateReponse == other.DateReponse ||
@ -196,16 +188,14 @@ namespace IO.Swagger.DTO
// Suitable nullity checks etc, of course :)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (IdCollaborateur != null)
hashCode = hashCode * 59 + IdCollaborateur.GetHashCode();
if (IdReferent != null)
hashCode = hashCode * 59 + IdReferent.GetHashCode();
if (Collaborateur != null)
hashCode = hashCode * 59 + Collaborateur.GetHashCode();
if (Referent != null)
hashCode = hashCode * 59 + Referent.GetHashCode();
if (DateDemande != null)
hashCode = hashCode * 59 + DateDemande.GetHashCode();
if (Etat != null)
hashCode = hashCode * 59 + Etat.GetHashCode();
if (Reponse != null)
hashCode = hashCode * 59 + Reponse.GetHashCode();
if (EtatDemande != null)
hashCode = hashCode * 59 + EtatDemande.GetHashCode();
if (DateReponse != null)
hashCode = hashCode * 59 + DateReponse.GetHashCode();
if (RaisonRefus != null)

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,82 +17,100 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les détails d&#x27;une demande de formation
/// DTO permettant de gérer les demandes de formation.
/// </summary>
[DataContract]
public partial class DemandeFormationDTO : IEquatable<DemandeFormationDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de la demande de formation
/// </summary>
[Required]
/// <value>Id de la demande de formation</value>
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Libelle
/// Libellé de la demande de formation
/// </summary>
/// <value>Libellé de la demande de formation</value>
[Required]
[DataMember(Name="libelle")]
public string Libelle { get; set; }
/// <summary>
/// Gets or Sets Description
/// Description détaillée de la demande de formation
/// </summary>
/// <value>Description détaillée de la demande de formation</value>
[Required]
[DataMember(Name="description")]
public string Description { get; set; }
/// <summary>
/// Gets or Sets DemandeRH
/// Indique s&#x27;il s&#x27;agit d&#x27;une demande de formation créée par une RH ou non
/// </summary>
/// <value>Indique s&#x27;il s&#x27;agit d&#x27;une demande de formation créée par une RH ou non</value>
[Required]
[DataMember(Name="demandeRH")]
public bool? DemandeRH { get; set; }
/// <summary>
/// Gets or Sets DateDemande
/// Date à laquelle la demande a été effectuée
/// </summary>
/// <value>Date à laquelle la demande a été effectuée</value>
[Required]
[DataMember(Name="dateDemande")]
public DateTime? DateDemande { get; set; }
/// <summary>
/// Gets or Sets Reponse
/// Gets or Sets EtatDemande
/// </summary>
[DataMember(Name="reponse")]
public bool? Reponse { get; set; }
[Required]
[DataMember(Name="etatDemande")]
public EtatDemande EtatDemande { get; set; }
/// <summary>
/// Gets or Sets CommentaireRefus
/// Commentaire expliquant la raison pour laquelle la demande de formation a été refusée
/// </summary>
/// <value>Commentaire expliquant la raison pour laquelle la demande de formation a été refusée</value>
[DataMember(Name="commentaireRefus")]
public string CommentaireRefus { get; set; }
/// <summary>
/// Gets or Sets DateDerniereReponse
/// Date à laquelle la demande de formation a reçu une réponse pour la dernière fois
/// </summary>
/// <value>Date à laquelle la demande de formation a reçu une réponse pour la dernière fois</value>
[DataMember(Name="dateDerniereReponse")]
public DateTime? DateDerniereReponse { get; set; }
/// <summary>
/// Gets or Sets Theme
/// Gets or Sets Origine
/// </summary>
[Required]
[DataMember(Name="theme")]
public ThemeDTO Theme { get; set; }
[DataMember(Name="origine")]
public OrigineDemandeFormationDTO Origine { get; set; }
/// <summary>
/// Gets or Sets Collaborateur
/// </summary>
[DataMember(Name="collaborateur")]
public CollaborateurDTO Collaborateur { get; set; }
/// <summary>
/// Gets or Sets Ep
/// </summary>
[Required]
[DataMember(Name="ep")]
public EpInformationDTO Ep { get; set; }
/// <summary>
/// Gets or Sets Formation
/// </summary>
[DataMember(Name="formation")]
public FormationDetailsDTO Formation { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
@ -106,11 +124,13 @@ namespace IO.Swagger.DTO
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" DemandeRH: ").Append(DemandeRH).Append("\n");
sb.Append(" DateDemande: ").Append(DateDemande).Append("\n");
sb.Append(" Reponse: ").Append(Reponse).Append("\n");
sb.Append(" EtatDemande: ").Append(EtatDemande).Append("\n");
sb.Append(" CommentaireRefus: ").Append(CommentaireRefus).Append("\n");
sb.Append(" DateDerniereReponse: ").Append(DateDerniereReponse).Append("\n");
sb.Append(" Theme: ").Append(Theme).Append("\n");
sb.Append(" Origine: ").Append(Origine).Append("\n");
sb.Append(" Collaborateur: ").Append(Collaborateur).Append("\n");
sb.Append(" Ep: ").Append(Ep).Append("\n");
sb.Append(" Formation: ").Append(Formation).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -173,9 +193,9 @@ namespace IO.Swagger.DTO
DateDemande.Equals(other.DateDemande)
) &&
(
Reponse == other.Reponse ||
Reponse != null &&
Reponse.Equals(other.Reponse)
EtatDemande == other.EtatDemande ||
EtatDemande != null &&
EtatDemande.Equals(other.EtatDemande)
) &&
(
CommentaireRefus == other.CommentaireRefus ||
@ -188,14 +208,24 @@ namespace IO.Swagger.DTO
DateDerniereReponse.Equals(other.DateDerniereReponse)
) &&
(
Theme == other.Theme ||
Theme != null &&
Theme.Equals(other.Theme)
Origine == other.Origine ||
Origine != null &&
Origine.Equals(other.Origine)
) &&
(
Collaborateur == other.Collaborateur ||
Collaborateur != null &&
Collaborateur.Equals(other.Collaborateur)
) &&
(
Ep == other.Ep ||
Ep != null &&
Ep.Equals(other.Ep)
) &&
(
Formation == other.Formation ||
Formation != null &&
Formation.Equals(other.Formation)
);
}
@ -219,16 +249,20 @@ namespace IO.Swagger.DTO
hashCode = hashCode * 59 + DemandeRH.GetHashCode();
if (DateDemande != null)
hashCode = hashCode * 59 + DateDemande.GetHashCode();
if (Reponse != null)
hashCode = hashCode * 59 + Reponse.GetHashCode();
if (EtatDemande != null)
hashCode = hashCode * 59 + EtatDemande.GetHashCode();
if (CommentaireRefus != null)
hashCode = hashCode * 59 + CommentaireRefus.GetHashCode();
if (DateDerniereReponse != null)
hashCode = hashCode * 59 + DateDerniereReponse.GetHashCode();
if (Theme != null)
hashCode = hashCode * 59 + Theme.GetHashCode();
if (Origine != null)
hashCode = hashCode * 59 + Origine.GetHashCode();
if (Collaborateur != null)
hashCode = hashCode * 59 + Collaborateur.GetHashCode();
if (Ep != null)
hashCode = hashCode * 59 + Ep.GetHashCode();
if (Formation != null)
hashCode = hashCode * 59 + Formation.GetHashCode();
return hashCode;
}
}

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,35 +21,38 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Détails d&#x27;une note que peut prendre un commercial, un delivery ou un RA sur un collaborateur
/// DTO contenant le détail complet d’une note.
/// </summary>
[DataContract]
public partial class DetailsNoteDTO : IEquatable<DetailsNoteDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de la note
/// </summary>
[Required]
/// <value>Id de la note</value>
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Titre
/// Titre de la note
/// </summary>
/// <value>Titre de la note</value>
[Required]
[DataMember(Name="titre")]
public string Titre { get; set; }
/// <summary>
/// Gets or Sets Texte
/// Contenu de la note
/// </summary>
/// <value>Contenu de la note</value>
[Required]
[DataMember(Name="texte")]
public string Texte { get; set; }
/// <summary>
/// Gets or Sets IdAuteur
/// Id du référent qui a écrit cette note
/// </summary>
/// <value>Id du référent qui a écrit cette note</value>
[Required]
[DataMember(Name="idAuteur")]
public Guid? IdAuteur { get; set; }
@ -62,14 +65,18 @@ namespace IO.Swagger.DTO
public CollaborateurDTO Collaborateur { get; set; }
/// <summary>
/// Gets or Sets DateCreation
/// Date à laquelle la note a été créée
/// </summary>
/// <value>Date à laquelle la note a été créée</value>
[Required]
[DataMember(Name="dateCreation")]
public DateTime? DateCreation { get; set; }
/// <summary>
/// Gets or Sets DateMiseAjour
/// Date à laquelle la note a été mise à jour pour la dernière fois
/// </summary>
/// <value>Date à laquelle la note a été mise à jour pour la dernière fois</value>
[Required]
[DataMember(Name="dateMiseAjour")]
public DateTime? DateMiseAjour { get; set; }

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,32 +17,35 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
/// <summary>
/// Un document pour récupérer les saisies et leur champ en fonction du type de l&#x27;EP qui peut être EPS, EPA ou EPASIXANS
/// DTO permettant de faire le lien entre les saisies (EPS ou EPA...) avec l&#x27;EP.
/// </summary>
[DataContract]
public partial class DocumentDTO : IEquatable<DocumentDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id du document
/// </summary>
/// <value>Id du document</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Type
/// Gets or Sets TypeDocument
/// </summary>
[Required]
[DataMember(Name="type")]
public string Type { get; set; }
[DataMember(Name="typeDocument")]
public TypeChamps TypeDocument { get; set; }
/// <summary>
/// Gets or Sets Saisies
/// </summary>
[Required]
[DataMember(Name="saisies")]
public List<SaisieDTO> Saisies { get; set; }
@ -55,7 +58,7 @@ namespace IO.Swagger.DTO
var sb = new StringBuilder();
sb.Append("class DocumentDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" TypeDocument: ").Append(TypeDocument).Append("\n");
sb.Append(" Saisies: ").Append(Saisies).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -99,9 +102,9 @@ namespace IO.Swagger.DTO
Id.Equals(other.Id)
) &&
(
Type == other.Type ||
Type != null &&
Type.Equals(other.Type)
TypeDocument == other.TypeDocument ||
TypeDocument != null &&
TypeDocument.Equals(other.TypeDocument)
) &&
(
Saisies == other.Saisies ||
@ -122,8 +125,8 @@ namespace IO.Swagger.DTO
// Suitable nullity checks etc, of course :)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (Type != null)
hashCode = hashCode * 59 + Type.GetHashCode();
if (TypeDocument != null)
hashCode = hashCode * 59 + TypeDocument.GetHashCode();
if (Saisies != null)
hashCode = hashCode * 59 + Saisies.GetHashCode();
return hashCode;

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,65 +17,66 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les détails d&#x27;un engagement pris par un référent pour un EP
/// DTO concernant les engagements pris par le référent lors de l&#x27;EP.
/// </summary>
[DataContract]
public partial class EngagementDTO : IEquatable<EngagementDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de l&#x27;engagement
/// </summary>
/// <value>Id de l&#x27;engagement</value>
[Required]
[DataMember(Name="id")]
public decimal? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Action
/// Action de l&#x27;engagement
/// </summary>
/// <value>Action de l&#x27;engagement</value>
[Required]
[DataMember(Name="action")]
public string Action { get; set; }
/// <summary>
/// Gets or Sets Modalite
/// </summary>
[Required]
[DataMember(Name="modalite")]
public string Modalite { get; set; }
/// <summary>
/// Gets or Sets Dispositif
/// Dispositif à mettre en place pour respecter l&#x27;engagement dans les temps
/// </summary>
/// <value>Dispositif à mettre en place pour respecter l&#x27;engagement dans les temps</value>
[Required]
[DataMember(Name="dispositif")]
public string Dispositif { get; set; }
/// <summary>
/// Gets or Sets DatePrevisionnelle
/// ”Sur temps de travail” ou ”Hors-temps”
/// </summary>
/// <value>”Sur temps de travail” ou ”Hors-temps”</value>
[Required]
[DataMember(Name="datePrevisionnelle")]
public DateTime? DatePrevisionnelle { get; set; }
[DataMember(Name="modalite")]
public string Modalite { get; set; }
/// <summary>
/// Gets or Sets Realisable
/// Date limite pour respecter l&#x27;engagement
/// </summary>
[DataMember(Name="realisable")]
public bool? Realisable { get; set; }
/// <value>Date limite pour respecter l&#x27;engagement</value>
[Required]
[DataMember(Name="dateLimite")]
public DateTime? DateLimite { get; set; }
/// <summary>
/// Gets or Sets Realise
/// Gets or Sets EtatEngagement
/// </summary>
[DataMember(Name="realise")]
public bool? Realise { get; set; }
[DataMember(Name="etatEngagement")]
public EtatEngagement EtatEngagement { get; set; }
/// <summary>
/// Gets or Sets RaisonNonRealisable
/// Raison pour laquelle l&#x27;engagement ne sera pas respecté
/// </summary>
/// <value>Raison pour laquelle l&#x27;engagement ne sera pas respecté</value>
[DataMember(Name="raisonNonRealisable")]
public string RaisonNonRealisable { get; set; }
@ -95,11 +96,10 @@ namespace IO.Swagger.DTO
sb.Append("class EngagementDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Action: ").Append(Action).Append("\n");
sb.Append(" Modalite: ").Append(Modalite).Append("\n");
sb.Append(" Dispositif: ").Append(Dispositif).Append("\n");
sb.Append(" DatePrevisionnelle: ").Append(DatePrevisionnelle).Append("\n");
sb.Append(" Realisable: ").Append(Realisable).Append("\n");
sb.Append(" Realise: ").Append(Realise).Append("\n");
sb.Append(" Modalite: ").Append(Modalite).Append("\n");
sb.Append(" DateLimite: ").Append(DateLimite).Append("\n");
sb.Append(" EtatEngagement: ").Append(EtatEngagement).Append("\n");
sb.Append(" RaisonNonRealisable: ").Append(RaisonNonRealisable).Append("\n");
sb.Append(" Ep: ").Append(Ep).Append("\n");
sb.Append("}\n");
@ -148,30 +148,25 @@ namespace IO.Swagger.DTO
Action != null &&
Action.Equals(other.Action)
) &&
(
Modalite == other.Modalite ||
Modalite != null &&
Modalite.Equals(other.Modalite)
) &&
(
Dispositif == other.Dispositif ||
Dispositif != null &&
Dispositif.Equals(other.Dispositif)
) &&
(
DatePrevisionnelle == other.DatePrevisionnelle ||
DatePrevisionnelle != null &&
DatePrevisionnelle.Equals(other.DatePrevisionnelle)
Modalite == other.Modalite ||
Modalite != null &&
Modalite.Equals(other.Modalite)
) &&
(
Realisable == other.Realisable ||
Realisable != null &&
Realisable.Equals(other.Realisable)
DateLimite == other.DateLimite ||
DateLimite != null &&
DateLimite.Equals(other.DateLimite)
) &&
(
Realise == other.Realise ||
Realise != null &&
Realise.Equals(other.Realise)
EtatEngagement == other.EtatEngagement ||
EtatEngagement != null &&
EtatEngagement.Equals(other.EtatEngagement)
) &&
(
RaisonNonRealisable == other.RaisonNonRealisable ||
@ -199,16 +194,14 @@ namespace IO.Swagger.DTO
hashCode = hashCode * 59 + Id.GetHashCode();
if (Action != null)
hashCode = hashCode * 59 + Action.GetHashCode();
if (Modalite != null)
hashCode = hashCode * 59 + Modalite.GetHashCode();
if (Dispositif != null)
hashCode = hashCode * 59 + Dispositif.GetHashCode();
if (DatePrevisionnelle != null)
hashCode = hashCode * 59 + DatePrevisionnelle.GetHashCode();
if (Realisable != null)
hashCode = hashCode * 59 + Realisable.GetHashCode();
if (Realise != null)
hashCode = hashCode * 59 + Realise.GetHashCode();
if (Modalite != null)
hashCode = hashCode * 59 + Modalite.GetHashCode();
if (DateLimite != null)
hashCode = hashCode * 59 + DateLimite.GetHashCode();
if (EtatEngagement != null)
hashCode = hashCode * 59 + EtatEngagement.GetHashCode();
if (RaisonNonRealisable != null)
hashCode = hashCode * 59 + RaisonNonRealisable.GetHashCode();
if (Ep != null)

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.7
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,163 +17,183 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
{
/// <summary>
/// Tous les détails d&#x27;un EP lorsqu&#x27;il est consulté
/// DTO contenant l&#x27;ensemble des informations d&#x27;un EP.
/// </summary>
[DataContract]
public partial class EpDTO : IEquatable<EpDTO>
{
{
/// <summary>
/// Gets or Sets Id
/// Id de l’EP
/// </summary>
/// <value>Id de l’EP</value>
[Required]
[DataMember(Name="id")]
public decimal? Id { get; set; }
[DataMember(Name = "id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[Required]
[DataMember(Name="type")]
public string Type { get; set; }
[DataMember(Name = "type")]
public TypeEp Type { get; set; }
/// <summary>
/// Gets or Sets DateDisponibilite
/// Date à partir de laquelle l&#x27;EP peut être saisi
/// </summary>
/// <value>Date à partir de laquelle l&#x27;EP peut être saisi</value>
[Required]
[DataMember(Name="dateDisponibilite")]
[DataMember(Name = "dateDisponibilite")]
public DateTime? DateDisponibilite { get; set; }
/// <summary>
/// Gets or Sets DatePrevisionnelle
/// Date à laquelle l&#x27;EP est prévu, la date par défaut est celle de l&#x27;anniversaire du collaborateur (+6 mois pour EPS)
/// </summary>
/// <value>Date à laquelle l&#x27;EP est prévu, la date par défaut est celle de l&#x27;anniversaire du collaborateur (+6 mois pour EPS)</value>
[Required]
[DataMember(Name="datePrevisionnelle")]
[DataMember(Name = "datePrevisionnelle")]
public DateTime? DatePrevisionnelle { get; set; }
/// <summary>
/// Gets or Sets DateSaisie
/// Date à laquelle le collaborateur a signé l&#x27;EP
/// </summary>
[DataMember(Name="dateSaisie")]
/// <value>Date à laquelle le collaborateur a signé l&#x27;EP</value>
[DataMember(Name = "dateSignatureCollaborateur")]
public DateTime? DateSignatureCollaborateur { get; set; }
/// <summary>
/// Date à laquelle le référent a signé l&#x27;EP
/// </summary>
/// <value>Date à laquelle le référent a signé l&#x27;EP</value>
[DataMember(Name = "dateSignatureReferent")]
public DateTime? DateSignatureReferent { get; set; }
/// <summary>
/// Date à laquelle l’EP a été saisi par le collaborateur
/// </summary>
/// <value>Date à laquelle l’EP a été saisi par le collaborateur</value>
[DataMember(Name = "dateSaisie")]
public DateTime? DateSaisie { get; set; }
/// <summary>
/// Gets or Sets Statut
/// </summary>
[Required]
[DataMember(Name="statut")]
public decimal? Statut { get; set; }
[DataMember(Name = "statut")]
public StatutEp Statut { get; set; }
/// <summary>
/// Gets or Sets Cv
/// Nom du CV Apside du collaborateur
/// </summary>
/// <value>Nom du CV Apside du collaborateur</value>
[Required]
[DataMember(Name="cv")]
[DataMember(Name = "cv")]
public string Cv { get; set; }
/// <summary>
/// Gets or Sets PropositionsEntretien
/// </summary>
[DataMember(Name="propositionsEntretien")]
[DataMember(Name = "propositionsEntretien")]
public List<RDVEntretienDTO> PropositionsEntretien { get; set; }
/// <summary>
/// Gets or Sets RdvEntretien
/// </summary>
[DataMember(Name="rdvEntretien")]
[DataMember(Name = "rdvEntretien")]
public RDVEntretienDTO RdvEntretien { get; set; }
/// <summary>
/// Gets or Sets ChoixTypeEntretien
/// </summary>
[DataMember(Name="choixTypeEntretien")]
public TypeEntretienDTO ChoixTypeEntretien { get; set; }
[DataMember(Name = "choixTypeEntretien")]
public List<TypeEntretienDTO> ChoixTypeEntretien { get; set; }
/// <summary>
/// Gets or Sets Obligatoire
/// Indique si oui ou non l&#x27;EP doit obligatoirement être effectué
/// </summary>
/// <value>Indique si oui ou non l&#x27;EP doit obligatoirement être effectué</value>
[Required]
[DataMember(Name="obligatoire")]
[DataMember(Name = "obligatoire")]
public bool? Obligatoire { get; set; }
/// <summary>
/// Gets or Sets Objectif
/// </summary>
[DataMember(Name="objectif")]
public List<ObjectifDTO> Objectif { get; set; }
/// <summary>
/// Gets or Sets ObjectifPrecedent
/// Gets or Sets Objectifs
/// </summary>
[DataMember(Name="objectifPrecedent")]
public List<ObjectifPrecedentDTO> ObjectifPrecedent { get; set; }
/// <summary>
/// Gets or Sets CommentaireAssistant
/// </summary>
[DataMember(Name="commentaireAssistant")]
public string CommentaireAssistant { get; set; }
[Required]
[DataMember(Name = "objectifs")]
public List<ObjectifDTO> Objectifs { get; set; }
/// <summary>
/// Gets or Sets CommentaireCommercial
/// Gets or Sets ObjectifsPrecedent
/// </summary>
[DataMember(Name="commentaireCommercial")]
public string CommentaireCommercial { get; set; }
[DataMember(Name = "objectifsPrecedent")]
public List<ObjectifPrecedentDTO> ObjectifsPrecedent { get; set; }
/// <summary>
/// Gets or Sets Collaborateur
/// </summary>
[Required]
[DataMember(Name="collaborateur")]
[DataMember(Name = "collaborateur")]
public CollaborateurDTO Collaborateur { get; set; }
/// <summary>
/// Gets or Sets Referent
/// </summary>
[Required]
[DataMember(Name="referent")]
[DataMember(Name = "referent")]
public CollaborateurDTO Referent { get; set; }
/// <summary>
/// Gets or Sets DemandesFormation
/// </summary>
[DataMember(Name="demandesFormation")]
[DataMember(Name = "demandesFormation")]
public List<DemandeFormationDTO> DemandesFormation { get; set; }
/// <summary>
/// Gets or Sets Participants
/// </summary>
[DataMember(Name="participants")]
[DataMember(Name = "participants")]
public List<ParticipationEPDTO> Participants { get; set; }
/// <summary>
/// Gets or Sets Engagements
/// </summary>
[DataMember(Name="engagements")]
[DataMember(Name = "engagements")]
public List<EngagementDTO> Engagements { get; set; }
/// <summary>
/// Gets or Sets AugmentationSalaire
/// </summary>
[DataMember(Name="augmentationSalaire")]
[DataMember(Name = "augmentationSalaire")]
public AugmentationSalaireDTO AugmentationSalaire { get; set; }
/// <summary>
/// Gets or Sets DemandesDelegation
/// </summary>
[DataMember(Name="demandesDelegation")]
public List<DemandeDelegationDTO> DemandesDelegation { get; set; }
[DataMember(Name = "demandesDelegation")]
public DemandeDelegationDTO DemandesDelegation { get; set; }
/// <summary>
/// Gets or Sets DemandeEPI
/// </summary>
[DataMember(Name = "demandeEPI")]
public DemandeEPIDTO DemandeEPI { get; set; }
/// <summary>
/// Gets or Sets Documents
/// </summary>
[Required]
[DataMember(Name="documents")]
[DataMember(Name = "documents")]
public List<DocumentDTO> Documents { get; set; }
/// <summary>
/// Gets or Sets CommentairesAssistant
/// </summary>
[DataMember(Name = "commentairesAssistant")]
public List<CommentaireAssistantDTO> CommentairesAssistant { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
@ -186,6 +206,8 @@ namespace IO.Swagger.DTO
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" DateDisponibilite: ").Append(DateDisponibilite).Append("\n");
sb.Append(" DatePrevisionnelle: ").Append(DatePrevisionnelle).Append("\n");
sb.Append(" DateSignatureCollaborateur: ").Append(DateSignatureCollaborateur).Append("\n");
sb.Append(" DateSignatureReferent: ").Append(DateSignatureReferent).Append("\n");
sb.Append(" DateSaisie: ").Append(DateSaisie).Append("\n");
sb.Append(" Statut: ").Append(Statut).Append("\n");
sb.Append(" Cv: ").Append(Cv).Append("\n");
@ -193,10 +215,8 @@ namespace IO.Swagger.DTO
sb.Append(" RdvEntretien: ").Append(RdvEntretien).Append("\n");
sb.Append(" ChoixTypeEntretien: ").Append(ChoixTypeEntretien).Append("\n");
sb.Append(" Obligatoire: ").Append(Obligatoire).Append("\n");
sb.Append(" Objectif: ").Append(Objectif).Append("\n");
sb.Append(" ObjectifPrecedent: ").Append(ObjectifPrecedent).Append("\n");
sb.Append(" CommentaireAssistant: ").Append(CommentaireAssistant).Append("\n");
sb.Append(" CommentaireCommercial: ").Append(CommentaireCommercial).Append("\n");
sb.Append(" Objectifs: ").Append(Objectifs).Append("\n");
sb.Append(" ObjectifsPrecedent: ").Append(ObjectifsPrecedent).Append("\n");
sb.Append(" Collaborateur: ").Append(Collaborateur).Append("\n");
sb.Append(" Referent: ").Append(Referent).Append("\n");
sb.Append(" DemandesFormation: ").Append(DemandesFormation).Append("\n");
@ -204,7 +224,9 @@ namespace IO.Swagger.DTO
sb.Append(" Engagements: ").Append(Engagements).Append("\n");
sb.Append(" AugmentationSalaire: ").Append(AugmentationSalaire).Append("\n");
sb.Append(" DemandesDelegation: ").Append(DemandesDelegation).Append("\n");
sb.Append(" DemandeEPI: ").Append(DemandeEPI).Append("\n");
sb.Append(" Documents: ").Append(Documents).Append("\n");
sb.Append(" CommentairesAssistant: ").Append(CommentairesAssistant).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -240,121 +262,131 @@ namespace IO.Swagger.DTO
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return
return
(
Id == other.Id ||
Id != null &&
Id.Equals(other.Id)
) &&
) &&
(
Type == other.Type ||
Type != null &&
Type.Equals(other.Type)
) &&
) &&
(
DateDisponibilite == other.DateDisponibilite ||
DateDisponibilite != null &&
DateDisponibilite.Equals(other.DateDisponibilite)
) &&
) &&
(
DatePrevisionnelle == other.DatePrevisionnelle ||
DatePrevisionnelle != null &&
DatePrevisionnelle.Equals(other.DatePrevisionnelle)
) &&
) &&
(
DateSignatureCollaborateur == other.DateSignatureCollaborateur ||
DateSignatureCollaborateur != null &&
DateSignatureCollaborateur.Equals(other.DateSignatureCollaborateur)
) &&
(
DateSignatureReferent == other.DateSignatureReferent ||
DateSignatureReferent != null &&
DateSignatureReferent.Equals(other.DateSignatureReferent)
) &&
(
DateSaisie == other.DateSaisie ||
DateSaisie != null &&
DateSaisie.Equals(other.DateSaisie)
) &&
) &&
(
Statut == other.Statut ||
Statut != null &&
Statut.Equals(other.Statut)
) &&
) &&
(
Cv == other.Cv ||
Cv != null &&
Cv.Equals(other.Cv)
) &&
) &&
(
PropositionsEntretien == other.PropositionsEntretien ||
PropositionsEntretien != null &&
PropositionsEntretien.SequenceEqual(other.PropositionsEntretien)
) &&
) &&
(
RdvEntretien == other.RdvEntretien ||
RdvEntretien != null &&
RdvEntretien.Equals(other.RdvEntretien)
) &&
) &&
(
ChoixTypeEntretien == other.ChoixTypeEntretien ||
ChoixTypeEntretien != null &&
ChoixTypeEntretien.Equals(other.ChoixTypeEntretien)
) &&
ChoixTypeEntretien.SequenceEqual(other.ChoixTypeEntretien)
) &&
(
Obligatoire == other.Obligatoire ||
Obligatoire != null &&
Obligatoire.Equals(other.Obligatoire)
) &&
(
Objectif == other.Objectif ||
Objectif != null &&
Objectif.SequenceEqual(other.Objectif)
) &&
) &&
(
ObjectifPrecedent == other.ObjectifPrecedent ||
ObjectifPrecedent != null &&
ObjectifPrecedent.SequenceEqual(other.ObjectifPrecedent)
) &&
Objectifs == other.Objectifs ||
Objectifs != null &&
Objectifs.SequenceEqual(other.Objectifs)
) &&
(
CommentaireAssistant == other.CommentaireAssistant ||
CommentaireAssistant != null &&
CommentaireAssistant.Equals(other.CommentaireAssistant)
) &&
(
CommentaireCommercial == other.CommentaireCommercial ||
CommentaireCommercial != null &&
CommentaireCommercial.Equals(other.CommentaireCommercial)
) &&
ObjectifsPrecedent == other.ObjectifsPrecedent ||
ObjectifsPrecedent != null &&
ObjectifsPrecedent.SequenceEqual(other.ObjectifsPrecedent)
) &&
(
Collaborateur == other.Collaborateur ||
Collaborateur != null &&
Collaborateur.Equals(other.Collaborateur)
) &&
) &&
(
Referent == other.Referent ||
Referent != null &&
Referent.Equals(other.Referent)
) &&
) &&
(
DemandesFormation == other.DemandesFormation ||
DemandesFormation != null &&
DemandesFormation.SequenceEqual(other.DemandesFormation)
) &&
) &&
(
Participants == other.Participants ||
Participants != null &&
Participants.SequenceEqual(other.Participants)
) &&
) &&
(
Engagements == other.Engagements ||
Engagements != null &&
Engagements.SequenceEqual(other.Engagements)
) &&
) &&
(
AugmentationSalaire == other.AugmentationSalaire ||
AugmentationSalaire != null &&
AugmentationSalaire.Equals(other.AugmentationSalaire)
) &&
) &&
(
DemandesDelegation == other.DemandesDelegation ||
DemandesDelegation != null &&
DemandesDelegation.SequenceEqual(other.DemandesDelegation)
) &&
DemandesDelegation.Equals(other.DemandesDelegation)
) &&
(
DemandeEPI == other.DemandeEPI ||
DemandeEPI != null &&
DemandeEPI.Equals(other.DemandeEPI)
) &&
(
Documents == other.Documents ||
Documents != null &&
Documents.SequenceEqual(other.Documents)
) &&
(
CommentairesAssistant == other.CommentairesAssistant ||
CommentairesAssistant != null &&
CommentairesAssistant.SequenceEqual(other.CommentairesAssistant)
);
}
@ -368,58 +400,62 @@ namespace IO.Swagger.DTO
{
var hashCode = 41;
// Suitable nullity checks etc, of course :)
if (Id != null)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (Type != null)
if (Type != null)
hashCode = hashCode * 59 + Type.GetHashCode();
if (DateDisponibilite != null)
if (DateDisponibilite != null)
hashCode = hashCode * 59 + DateDisponibilite.GetHashCode();
if (DatePrevisionnelle != null)
if (DatePrevisionnelle != null)
hashCode = hashCode * 59 + DatePrevisionnelle.GetHashCode();
if (DateSaisie != null)
if (DateSignatureCollaborateur != null)
hashCode = hashCode * 59 + DateSignatureCollaborateur.GetHashCode();
if (DateSignatureReferent != null)
hashCode = hashCode * 59 + DateSignatureReferent.GetHashCode();
if (DateSaisie != null)
hashCode = hashCode * 59 + DateSaisie.GetHashCode();
if (Statut != null)
if (Statut != null)
hashCode = hashCode * 59 + Statut.GetHashCode();
if (Cv != null)
if (Cv != null)
hashCode = hashCode * 59 + Cv.GetHashCode();
if (PropositionsEntretien != null)
if (PropositionsEntretien != null)
hashCode = hashCode * 59 + PropositionsEntretien.GetHashCode();
if (RdvEntretien != null)
if (RdvEntretien != null)
hashCode = hashCode * 59 + RdvEntretien.GetHashCode();
if (ChoixTypeEntretien != null)
if (ChoixTypeEntretien != null)
hashCode = hashCode * 59 + ChoixTypeEntretien.GetHashCode();
if (Obligatoire != null)
if (Obligatoire != null)
hashCode = hashCode * 59 + Obligatoire.GetHashCode();
if (Objectif != null)
hashCode = hashCode * 59 + Objectif.GetHashCode();
if (ObjectifPrecedent != null)
hashCode = hashCode * 59 + ObjectifPrecedent.GetHashCode();
if (CommentaireAssistant != null)
hashCode = hashCode * 59 + CommentaireAssistant.GetHashCode();
if (CommentaireCommercial != null)
hashCode = hashCode * 59 + CommentaireCommercial.GetHashCode();
if (Collaborateur != null)
if (Objectifs != null)
hashCode = hashCode * 59 + Objectifs.GetHashCode();
if (ObjectifsPrecedent != null)
hashCode = hashCode * 59 + ObjectifsPrecedent.GetHashCode();
if (Collaborateur != null)
hashCode = hashCode * 59 + Collaborateur.GetHashCode();
if (Referent != null)
if (Referent != null)
hashCode = hashCode * 59 + Referent.GetHashCode();
if (DemandesFormation != null)
if (DemandesFormation != null)
hashCode = hashCode * 59 + DemandesFormation.GetHashCode();
if (Participants != null)
if (Participants != null)
hashCode = hashCode * 59 + Participants.GetHashCode();
if (Engagements != null)
if (Engagements != null)
hashCode = hashCode * 59 + Engagements.GetHashCode();
if (AugmentationSalaire != null)
if (AugmentationSalaire != null)
hashCode = hashCode * 59 + AugmentationSalaire.GetHashCode();
if (DemandesDelegation != null)
if (DemandesDelegation != null)
hashCode = hashCode * 59 + DemandesDelegation.GetHashCode();
if (Documents != null)
if (DemandeEPI != null)
hashCode = hashCode * 59 + DemandeEPI.GetHashCode();
if (Documents != null)
hashCode = hashCode * 59 + Documents.GetHashCode();
if (CommentairesAssistant != null)
hashCode = hashCode * 59 + CommentairesAssistant.GetHashCode();
return hashCode;
}
}
#region Operators
#pragma warning disable 1591
#pragma warning disable 1591
public static bool operator ==(EpDTO left, EpDTO right)
{
@ -431,7 +467,7 @@ namespace IO.Swagger.DTO
return !Equals(left, right);
}
#pragma warning restore 1591
#pragma warning restore 1591
#endregion Operators
}
}

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,53 +17,58 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les informations de base d&#x27;un EP
/// DTO permettant d&#x27;afficher les informations utiles d&#x27;un EP dans un tableau.
/// </summary>
[DataContract]
public partial class EpInformationDTO : IEquatable<EpInformationDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de l&#x27;EP
/// </summary>
/// <value>Id de l&#x27;EP</value>
[Required]
[DataMember(Name="id")]
public decimal? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[Required]
[DataMember(Name="type")]
public int? Type { get; set; }
public TypeEp Type { get; set; }
/// <summary>
/// Gets or Sets Statut
/// </summary>
[Required]
[DataMember(Name="statut")]
public decimal? Statut { get; set; }
public StatutEp Statut { get; set; }
/// <summary>
/// Gets or Sets DateDisponibilite
/// Date à partir de laquelle l&#x27;EP peut être saisi
/// </summary>
/// <value>Date à partir de laquelle l&#x27;EP peut être saisi</value>
[Required]
[DataMember(Name="dateDisponibilite")]
public DateTime? DateDisponibilite { get; set; }
/// <summary>
/// Gets or Sets DatePrevisionnelle
/// Date à laquelle l&#x27;EP est prévu, la date par défaut est celle de l&#x27;anniversaire du collaborateur (+6 mois pour EPS)
/// </summary>
/// <value>Date à laquelle l&#x27;EP est prévu, la date par défaut est celle de l&#x27;anniversaire du collaborateur (+6 mois pour EPS)</value>
[Required]
[DataMember(Name="datePrevisionnelle")]
public DateTime? DatePrevisionnelle { get; set; }
/// <summary>
/// Gets or Sets Obligatoire
/// Indique si oui ou non l&#x27;EP doit obligatoirement être effectué
/// </summary>
/// <value>Indique si oui ou non l&#x27;EP doit obligatoirement être effectué</value>
[Required]
[DataMember(Name="obligatoire")]
public bool? Obligatoire { get; set; }
@ -71,14 +76,12 @@ namespace IO.Swagger.DTO
/// <summary>
/// Gets or Sets Collaborateur
/// </summary>
[Required]
[DataMember(Name="collaborateur")]
public CollaborateurDTO Collaborateur { get; set; }
/// <summary>
/// Gets or Sets Referent
/// </summary>
[Required]
[DataMember(Name="referent")]
public CollaborateurDTO Referent { get; set; }

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,39 +17,35 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
/// <summary>
/// Objet de l&#x27;EP au moment de la saisie du collaborateur
/// DTO utilisé lors de la saisie du collaborateur ou du référent.
/// </summary>
[DataContract]
public partial class EpSaisieDTO : IEquatable<EpSaisieDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de l’EP
/// </summary>
/// <value>Id de l’EP</value>
[Required]
[DataMember(Name="id")]
public decimal? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[Required]
[DataMember(Name="type")]
public string Type { get; set; }
public TypeEp Type { get; set; }
/// <summary>
/// Gets or Sets DatePrevisionnelle
/// </summary>
[Required]
[DataMember(Name="datePrevisionnelle")]
public DateTime? DatePrevisionnelle { get; set; }
/// <summary>
/// Gets or Sets Cv
/// Nom du CV Apside du collaborateur
/// </summary>
/// <value>Nom du CV Apside du collaborateur</value>
[DataMember(Name="cv")]
public string Cv { get; set; }
@ -60,23 +56,50 @@ namespace IO.Swagger.DTO
public TypeEntretienDTO ChoixEntretien { get; set; }
/// <summary>
/// Gets or Sets Obligatoire
/// Indique si oui ou non l&#x27;EP doit obligatoirement être effectué
/// </summary>
/// <value>Indique si oui ou non l&#x27;EP doit obligatoirement être effectué</value>
[Required]
[DataMember(Name="obligatoire")]
public bool? Obligatoire { get; set; }
/// <summary>
/// Gets or Sets Objectif
/// Gets or Sets Objectifs
/// </summary>
[DataMember(Name="objectifs")]
public List<ObjectifDTO> Objectifs { get; set; }
/// <summary>
/// Gets or Sets ObjectifsPrecedent
/// </summary>
[DataMember(Name="objectifsPrecedent")]
public List<ObjectifPrecedentDTO> ObjectifsPrecedent { get; set; }
/// <summary>
/// Id du collaborateur qui passe son EP
/// </summary>
/// <value>Id du collaborateur qui passe son EP</value>
[DataMember(Name="idCollaborateur")]
public Guid? IdCollaborateur { get; set; }
/// <summary>
/// Id du référent actuel de l&#x27;EP
/// </summary>
[DataMember(Name="objectif")]
public List<ObjectifDTO> Objectif { get; set; }
/// <value>Id du référent actuel de l&#x27;EP</value>
[DataMember(Name="idReferent")]
public Guid? IdReferent { get; set; }
/// <summary>
/// Gets or Sets ObjectifPrecedent
/// Gets or Sets Engagements
/// </summary>
[DataMember(Name="objectifPrecedent")]
public List<ObjectifPrecedentDTO> ObjectifPrecedent { get; set; }
[DataMember(Name="engagements")]
public List<EngagementDTO> Engagements { get; set; }
/// <summary>
/// Gets or Sets AugmentationSalaire
/// </summary>
[DataMember(Name="augmentationSalaire")]
public AugmentationSalaireDTO AugmentationSalaire { get; set; }
/// <summary>
/// Gets or Sets Documents
@ -95,12 +118,15 @@ namespace IO.Swagger.DTO
sb.Append("class EpSaisieDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" DatePrevisionnelle: ").Append(DatePrevisionnelle).Append("\n");
sb.Append(" Cv: ").Append(Cv).Append("\n");
sb.Append(" ChoixEntretien: ").Append(ChoixEntretien).Append("\n");
sb.Append(" Obligatoire: ").Append(Obligatoire).Append("\n");
sb.Append(" Objectif: ").Append(Objectif).Append("\n");
sb.Append(" ObjectifPrecedent: ").Append(ObjectifPrecedent).Append("\n");
sb.Append(" Objectifs: ").Append(Objectifs).Append("\n");
sb.Append(" ObjectifsPrecedent: ").Append(ObjectifsPrecedent).Append("\n");
sb.Append(" IdCollaborateur: ").Append(IdCollaborateur).Append("\n");
sb.Append(" IdReferent: ").Append(IdReferent).Append("\n");
sb.Append(" Engagements: ").Append(Engagements).Append("\n");
sb.Append(" AugmentationSalaire: ").Append(AugmentationSalaire).Append("\n");
sb.Append(" Documents: ").Append(Documents).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -148,11 +174,6 @@ namespace IO.Swagger.DTO
Type != null &&
Type.Equals(other.Type)
) &&
(
DatePrevisionnelle == other.DatePrevisionnelle ||
DatePrevisionnelle != null &&
DatePrevisionnelle.Equals(other.DatePrevisionnelle)
) &&
(
Cv == other.Cv ||
Cv != null &&
@ -169,14 +190,34 @@ namespace IO.Swagger.DTO
Obligatoire.Equals(other.Obligatoire)
) &&
(
Objectif == other.Objectif ||
Objectif != null &&
Objectif.SequenceEqual(other.Objectif)
Objectifs == other.Objectifs ||
Objectifs != null &&
Objectifs.SequenceEqual(other.Objectifs)
) &&
(
ObjectifsPrecedent == other.ObjectifsPrecedent ||
ObjectifsPrecedent != null &&
ObjectifsPrecedent.SequenceEqual(other.ObjectifsPrecedent)
) &&
(
IdCollaborateur == other.IdCollaborateur ||
IdCollaborateur != null &&
IdCollaborateur.Equals(other.IdCollaborateur)
) &&
(
IdReferent == other.IdReferent ||
IdReferent != null &&
IdReferent.Equals(other.IdReferent)
) &&
(
Engagements == other.Engagements ||
Engagements != null &&
Engagements.SequenceEqual(other.Engagements)
) &&
(
ObjectifPrecedent == other.ObjectifPrecedent ||
ObjectifPrecedent != null &&
ObjectifPrecedent.SequenceEqual(other.ObjectifPrecedent)
AugmentationSalaire == other.AugmentationSalaire ||
AugmentationSalaire != null &&
AugmentationSalaire.Equals(other.AugmentationSalaire)
) &&
(
Documents == other.Documents ||
@ -199,18 +240,24 @@ namespace IO.Swagger.DTO
hashCode = hashCode * 59 + Id.GetHashCode();
if (Type != null)
hashCode = hashCode * 59 + Type.GetHashCode();
if (DatePrevisionnelle != null)
hashCode = hashCode * 59 + DatePrevisionnelle.GetHashCode();
if (Cv != null)
hashCode = hashCode * 59 + Cv.GetHashCode();
if (ChoixEntretien != null)
hashCode = hashCode * 59 + ChoixEntretien.GetHashCode();
if (Obligatoire != null)
hashCode = hashCode * 59 + Obligatoire.GetHashCode();
if (Objectif != null)
hashCode = hashCode * 59 + Objectif.GetHashCode();
if (ObjectifPrecedent != null)
hashCode = hashCode * 59 + ObjectifPrecedent.GetHashCode();
if (Objectifs != null)
hashCode = hashCode * 59 + Objectifs.GetHashCode();
if (ObjectifsPrecedent != null)
hashCode = hashCode * 59 + ObjectifsPrecedent.GetHashCode();
if (IdCollaborateur != null)
hashCode = hashCode * 59 + IdCollaborateur.GetHashCode();
if (IdReferent != null)
hashCode = hashCode * 59 + IdReferent.GetHashCode();
if (Engagements != null)
hashCode = hashCode * 59 + Engagements.GetHashCode();
if (AugmentationSalaire != null)
hashCode = hashCode * 59 + AugmentationSalaire.GetHashCode();
if (Documents != null)
hashCode = hashCode * 59 + Documents.GetHashCode();
return hashCode;

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,21 +21,23 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Objet pour la gestion des erreurs
/// Classe pour la gestion et l&#x27;affichage des erreurs.
/// </summary>
[DataContract]
public partial class ErreurDTO : IEquatable<ErreurDTO>
{
/// <summary>
/// Gets or Sets Code
/// Code Erreur
/// </summary>
/// <value>Code Erreur</value>
[Required]
[DataMember(Name="code")]
public string Code { get; set; }
public int? Code { get; set; }
/// <summary>
/// Gets or Sets Message
/// Message d&#x27;erreur
/// </summary>
/// <value>Message d&#x27;erreur</value>
[Required]
[DataMember(Name="message")]
public string Message { get; set; }

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.2
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,54 +17,54 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using EPAServeur.Attributes;
namespace IO.Swagger.DTO
{
/// <summary>
/// Information utile à avoir lorsqu&#x27;un utilisateur se connecte
/// DTO pour les évaluations concernant les formations.
/// </summary>
[DataContract]
public partial class ProfilDTO : IEquatable<ProfilDTO>
public partial class EvaluationDTO : IEquatable<EvaluationDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de la participation à la formation
/// </summary>
/// <value>Id de la participation à la formation</value>
[Required]
[DataMember(Name="id")]
public Guid? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Nom
/// Intitulé de la formation
/// </summary>
/// <value>Intitulé de la formation</value>
[Required]
[DataMember(Name="nom")]
public string Nom { get; set; }
[DataMember(Name="intitule")]
public string Intitule { get; set; }
/// <summary>
/// Gets or Sets Prenom
/// Date de début de la formation
/// </summary>
/// <value>Date de début de la formation</value>
[Required]
[DataMember(Name="prenom")]
public string Prenom { get; set; }
[DataMember(Name="dateDebut")]
public DateTime? DateDebut { get; set; }
/// <summary>
/// Gets or Sets MailApside
/// Indique si la formation est certifiée ou non
/// </summary>
/// <value>Indique si la formation est certifiée ou non</value>
[Required]
[DataMember(Name="mailApside")]
public string MailApside { get; set; }
[DataMember(Name="estCertifiee")]
public bool? EstCertifiee { get; set; }
/// <summary>
/// Gets or Sets DateArrivee
/// Gets or Sets Saisies
/// </summary>
[DataMember(Name="dateArrivee")]
public DateTime? DateArrivee { get; set; }
/// <summary>
/// Gets or Sets BusinessUnit
/// </summary>
[DataMember(Name="businessUnit")]
public BusinessUnitDTO BusinessUnit { get; set; }
[CannotBeEmpty]
[DataMember(Name="saisies")]
public List<SaisieDTO> Saisies { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -73,13 +73,12 @@ namespace IO.Swagger.DTO
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class ProfilDTO {\n");
sb.Append("class EvaluationDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Nom: ").Append(Nom).Append("\n");
sb.Append(" Prenom: ").Append(Prenom).Append("\n");
sb.Append(" MailApside: ").Append(MailApside).Append("\n");
sb.Append(" DateArrivee: ").Append(DateArrivee).Append("\n");
sb.Append(" BusinessUnit: ").Append(BusinessUnit).Append("\n");
sb.Append(" Intitule: ").Append(Intitule).Append("\n");
sb.Append(" DateDebut: ").Append(DateDebut).Append("\n");
sb.Append(" EstCertifie: ").Append(EstCertifiee).Append("\n");
sb.Append(" Saisies: ").Append(Saisies).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -102,15 +101,15 @@ namespace IO.Swagger.DTO
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((ProfilDTO)obj);
return obj.GetType() == GetType() && Equals((EvaluationDTO)obj);
}
/// <summary>
/// Returns true if ProfilDTO instances are equal
/// Returns true if EvaluationDTO instances are equal
/// </summary>
/// <param name="other">Instance of ProfilDTO to be compared</param>
/// <param name="other">Instance of EvaluationDTO to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(ProfilDTO other)
public bool Equals(EvaluationDTO other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
@ -122,29 +121,24 @@ namespace IO.Swagger.DTO
Id.Equals(other.Id)
) &&
(
Nom == other.Nom ||
Nom != null &&
Nom.Equals(other.Nom)
) &&
(
Prenom == other.Prenom ||
Prenom != null &&
Prenom.Equals(other.Prenom)
Intitule == other.Intitule ||
Intitule != null &&
Intitule.Equals(other.Intitule)
) &&
(
MailApside == other.MailApside ||
MailApside != null &&
MailApside.Equals(other.MailApside)
DateDebut == other.DateDebut ||
DateDebut != null &&
DateDebut.Equals(other.DateDebut)
) &&
(
DateArrivee == other.DateArrivee ||
DateArrivee != null &&
DateArrivee.Equals(other.DateArrivee)
EstCertifiee == other.EstCertifiee ||
EstCertifiee != null &&
EstCertifiee.Equals(other.EstCertifiee)
) &&
(
BusinessUnit == other.BusinessUnit ||
BusinessUnit != null &&
BusinessUnit.Equals(other.BusinessUnit)
Saisies == other.Saisies ||
Saisies != null &&
Saisies.SequenceEqual(other.Saisies)
);
}
@ -160,16 +154,14 @@ namespace IO.Swagger.DTO
// Suitable nullity checks etc, of course :)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (Nom != null)
hashCode = hashCode * 59 + Nom.GetHashCode();
if (Prenom != null)
hashCode = hashCode * 59 + Prenom.GetHashCode();
if (MailApside != null)
hashCode = hashCode * 59 + MailApside.GetHashCode();
if (DateArrivee != null)
hashCode = hashCode * 59 + DateArrivee.GetHashCode();
if (BusinessUnit != null)
hashCode = hashCode * 59 + BusinessUnit.GetHashCode();
if (Intitule != null)
hashCode = hashCode * 59 + Intitule.GetHashCode();
if (DateDebut != null)
hashCode = hashCode * 59 + DateDebut.GetHashCode();
if (EstCertifiee != null)
hashCode = hashCode * 59 + EstCertifiee.GetHashCode();
if (Saisies != null)
hashCode = hashCode * 59 + Saisies.GetHashCode();
return hashCode;
}
}
@ -177,12 +169,12 @@ namespace IO.Swagger.DTO
#region Operators
#pragma warning disable 1591
public static bool operator ==(ProfilDTO left, ProfilDTO right)
public static bool operator ==(EvaluationDTO left, EvaluationDTO right)
{
return Equals(left, right);
}
public static bool operator !=(ProfilDTO left, ProfilDTO right)
public static bool operator !=(EvaluationDTO left, EvaluationDTO right)
{
return !Equals(left, right);
}

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.2
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -19,107 +19,125 @@ using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
{
/// <summary>
/// Toutes les informations d&#x27;une formation
/// DTO pour la gestion des formations.
/// </summary>
[DataContract]
public partial class FormationDTO : IEquatable<FormationDTO>
{
{
/// <summary>
/// Gets or Sets Id
/// Id de la formation
/// </summary>
[Required]
[DataMember(Name = "id")]
public int? Id { get; set; }
/// <value>Id de la formation</value>
[DataMember(Name="id")]
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Intitule
/// Intitulé de la formation
/// </summary>
/// <value>Intitulé de la formation</value>
[Required]
[DataMember(Name = "intitule")]
[DataMember(Name="intitule")]
public string Intitule { get; set; }
/// <summary>
/// Gets or Sets Origine
/// </summary>
[Required]
[DataMember(Name = "origine")]
[DataMember(Name="origine")]
public OrigineFormationDTO Origine { get; set; }
/// <summary>
/// Gets or Sets Statut
/// </summary>
[DataMember(Name = "statut")]
[Required]
[DataMember(Name="statut")]
public StatutFormationDTO Statut { get; set; }
/// <summary>
/// Gets or Sets IdAgence
/// Id de l&#x27;agence de la RH qui a créé la formation
/// </summary>
[DataMember(Name = "idAgence")]
public int? IdAgence { get; set; }
/// <value>Id de l&#x27;agence de la RH qui a créé la formation</value>
[Required]
[DataMember(Name="idAgence")]
public long? IdAgence { get; set; }
/// <summary>
/// Gets or Sets DateDebut
/// Date de la première séance de la formation
/// </summary>
/// <value>Date de la première séance de la formation</value>
[Required]
[DataMember(Name = "dateDebut")]
[DataMember(Name="dateDebut")]
public DateTime? DateDebut { get; set; }
/// <summary>
/// Gets or Sets DateFin
/// Date de la dernière séance de la formation
/// </summary>
/// <value>Date de la dernière séance de la formation</value>
[Required]
[DataMember(Name = "dateFin")]
[DataMember(Name="dateFin")]
public DateTime? DateFin { get; set; }
/// <summary>
/// Gets or Sets Heure
/// Nombre d&#x27;heures total de formation
/// </summary>
/// <value>Nombre d&#x27;heures total de formation</value>
[Required]
[DataMember(Name = "heure")]
public decimal? Heure { get; set; }
[DataMember(Name="heure")]
public int? Heure { get; set; }
/// <summary>
/// Gets or Sets Jour
/// Nombre de jours total de formation
/// </summary>
/// <value>Nombre de jours total de formation</value>
[Required]
[DataMember(Name = "jour")]
public decimal? Jour { get; set; }
[DataMember(Name="jour")]
public int? Jour { get; set; }
/// <summary>
/// Gets or Sets Organisme
/// Organisme en charge d&#x27;effectuer la formation
/// </summary>
/// <value>Organisme en charge d&#x27;effectuer la formation</value>
[Required]
[DataMember(Name = "organisme")]
[DataMember(Name="organisme")]
public string Organisme { get; set; }
/// <summary>
/// Gets or Sets Mode
/// </summary>
[Required]
[DataMember(Name = "mode")]
[DataMember(Name="mode")]
public ModeFormationDTO Mode { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[Required]
[DataMember(Name = "type")]
[DataMember(Name="type")]
public TypeFormationDTO Type { get; set; }
/// <summary>
/// Gets or Sets EstCertifie
/// Indique s&#x27;il s&#x27;agit d&#x27;une formation certifiée ou non
/// </summary>
/// <value>Indique s&#x27;il s&#x27;agit d&#x27;une formation certifiée ou non</value>
[Required]
[DataMember(Name="estCertifiee")]
public bool? EstCertifiee { get; set; }
/// <summary>
/// Indique que la formation a bien été effectuée ou non
/// </summary>
/// <value>Indique que la formation a bien été effectuée ou non</value>
[Required]
[DataMember(Name = "estCertifie")]
public bool? EstCertifie { get; set; }
[DataMember(Name="estRealisee")]
public bool? EstRealisee { get; set; }
/// <summary>
/// Gets or Sets ParticipantsFormation
/// Gets or Sets Participations
/// </summary>
[DataMember(Name = "participantsFormation")]
public List<FormationDTOParticipantsFormation> ParticipantsFormation { get; set; }
[DataMember(Name="participations")]
public List<ParticipationFormationDTO> Participations { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -141,8 +159,9 @@ namespace IO.Swagger.DTO
sb.Append(" Organisme: ").Append(Organisme).Append("\n");
sb.Append(" Mode: ").Append(Mode).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" EstCertifie: ").Append(EstCertifie).Append("\n");
sb.Append(" ParticipantsFormation: ").Append(ParticipantsFormation).Append("\n");
sb.Append(" EstCertifiee: ").Append(EstCertifiee).Append("\n");
sb.Append(" EstRealisee: ").Append(EstRealisee).Append("\n");
sb.Append(" Participations: ").Append(Participations).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -178,76 +197,81 @@ namespace IO.Swagger.DTO
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return
return
(
Id == other.Id ||
Id != null &&
Id.Equals(other.Id)
) &&
) &&
(
Intitule == other.Intitule ||
Intitule != null &&
Intitule.Equals(other.Intitule)
) &&
) &&
(
Origine == other.Origine ||
Origine != null &&
Origine.Equals(other.Origine)
) &&
) &&
(
Statut == other.Statut ||
Statut != null &&
Statut.Equals(other.Statut)
) &&
) &&
(
IdAgence == other.IdAgence ||
IdAgence != null &&
IdAgence.Equals(other.IdAgence)
) &&
) &&
(
DateDebut == other.DateDebut ||
DateDebut != null &&
DateDebut.Equals(other.DateDebut)
) &&
) &&
(
DateFin == other.DateFin ||
DateFin != null &&
DateFin.Equals(other.DateFin)
) &&
) &&
(
Heure == other.Heure ||
Heure != null &&
Heure.Equals(other.Heure)
) &&
) &&
(
Jour == other.Jour ||
Jour != null &&
Jour.Equals(other.Jour)
) &&
) &&
(
Organisme == other.Organisme ||
Organisme != null &&
Organisme.Equals(other.Organisme)
) &&
) &&
(
Mode == other.Mode ||
Mode != null &&
Mode.Equals(other.Mode)
) &&
) &&
(
Type == other.Type ||
Type != null &&
Type.Equals(other.Type)
) &&
) &&
(
EstCertifiee == other.EstCertifiee ||
EstCertifiee != null &&
EstCertifiee.Equals(other.EstCertifiee)
) &&
(
EstCertifie == other.EstCertifie ||
EstCertifie != null &&
EstCertifie.Equals(other.EstCertifie)
) &&
EstRealisee == other.EstRealisee ||
EstRealisee != null &&
EstRealisee.Equals(other.EstRealisee)
) &&
(
ParticipantsFormation == other.ParticipantsFormation ||
ParticipantsFormation != null &&
ParticipantsFormation.SequenceEqual(other.ParticipantsFormation)
Participations == other.Participations ||
Participations != null &&
Participations.SequenceEqual(other.Participations)
);
}
@ -261,40 +285,42 @@ namespace IO.Swagger.DTO
{
var hashCode = 41;
// Suitable nullity checks etc, of course :)
if (Id != null)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (Intitule != null)
if (Intitule != null)
hashCode = hashCode * 59 + Intitule.GetHashCode();
if (Origine != null)
if (Origine != null)
hashCode = hashCode * 59 + Origine.GetHashCode();
if (Statut != null)
if (Statut != null)
hashCode = hashCode * 59 + Statut.GetHashCode();
if (IdAgence != null)
if (IdAgence != null)
hashCode = hashCode * 59 + IdAgence.GetHashCode();
if (DateDebut != null)
if (DateDebut != null)
hashCode = hashCode * 59 + DateDebut.GetHashCode();
if (DateFin != null)
if (DateFin != null)
hashCode = hashCode * 59 + DateFin.GetHashCode();
if (Heure != null)
if (Heure != null)
hashCode = hashCode * 59 + Heure.GetHashCode();
if (Jour != null)
if (Jour != null)
hashCode = hashCode * 59 + Jour.GetHashCode();
if (Organisme != null)
if (Organisme != null)
hashCode = hashCode * 59 + Organisme.GetHashCode();
if (Mode != null)
if (Mode != null)
hashCode = hashCode * 59 + Mode.GetHashCode();
if (Type != null)
if (Type != null)
hashCode = hashCode * 59 + Type.GetHashCode();
if (EstCertifie != null)
hashCode = hashCode * 59 + EstCertifie.GetHashCode();
if (ParticipantsFormation != null)
hashCode = hashCode * 59 + ParticipantsFormation.GetHashCode();
if (EstCertifiee != null)
hashCode = hashCode * 59 + EstCertifiee.GetHashCode();
if (EstRealisee != null)
hashCode = hashCode * 59 + EstRealisee.GetHashCode();
if (Participations != null)
hashCode = hashCode * 59 + Participations.GetHashCode();
return hashCode;
}
}
#region Operators
#pragma warning disable 1591
#pragma warning disable 1591
public static bool operator ==(FormationDTO left, FormationDTO right)
{
@ -306,7 +332,7 @@ namespace IO.Swagger.DTO
return !Equals(left, right);
}
#pragma warning restore 1591
#pragma warning restore 1591
#endregion Operators
}
}

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,20 +21,23 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les détails d&#x27;une formation
/// DTO pour l&#x27;affichage des détails d&#x27;une formation.
/// </summary>
[DataContract]
public partial class FormationDetailsDTO : IEquatable<FormationDetailsDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de la formation
/// </summary>
/// <value>Id de la formation</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Intitule
/// Intitulé de la formation
/// </summary>
/// <value>Intitulé de la formation</value>
[Required]
[DataMember(Name="intitule")]
public string Intitule { get; set; }
@ -42,50 +45,55 @@ namespace IO.Swagger.DTO
/// <summary>
/// Gets or Sets Statut
/// </summary>
[Required]
[DataMember(Name="statut")]
public StatutFormationDTO Statut { get; set; }
/// <summary>
/// Gets or Sets DateDebut
/// Date de début de la formation
/// </summary>
/// <value>Date de début de la formation</value>
[Required]
[DataMember(Name="dateDebut")]
public DateTime? DateDebut { get; set; }
/// <summary>
/// Gets or Sets DateFin
/// Date de la dernière séance de la formation
/// </summary>
/// <value>Date de la dernière séance de la formation</value>
[Required]
[DataMember(Name="dateFin")]
public DateTime? DateFin { get; set; }
/// <summary>
/// Gets or Sets NbPartitipants
/// Organisme en charge d&#x27;effectuer la formation
/// </summary>
[Required]
[DataMember(Name="nbPartitipants")]
public int? NbPartitipants { get; set; }
/// <value>Organisme en charge d&#x27;effectuer la formation</value>
[DataMember(Name="organisme")]
public string Organisme { get; set; }
/// <summary>
/// Gets or Sets Mode
/// Nombre de participants de la formation
/// </summary>
/// <value>Nombre de participants de la formation</value>
[Required]
[DataMember(Name="mode")]
public ModeFormationDTO Mode { get; set; }
[DataMember(Name="nbParticipations")]
public int? NbParticipations { get; set; }
/// <summary>
/// Gets or Sets Type
/// Gets or Sets Origine
/// </summary>
[Required]
[DataMember(Name="type")]
public TypeFormationDTO Type { get; set; }
[DataMember(Name="origine")]
public OrigineFormationDTO Origine { get; set; }
/// <summary>
/// Gets or Sets EstCertifie
/// Indique si la formation est certifiée ou non
/// </summary>
/// <value>Indique si la formation est certifiée ou non</value>
[Required]
[DataMember(Name="estCertifie")]
public bool? EstCertifie { get; set; }
[DataMember(Name="estCertifiee")]
public bool? EstCertifiee { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -100,10 +108,10 @@ namespace IO.Swagger.DTO
sb.Append(" Statut: ").Append(Statut).Append("\n");
sb.Append(" DateDebut: ").Append(DateDebut).Append("\n");
sb.Append(" DateFin: ").Append(DateFin).Append("\n");
sb.Append(" NbPartitipants: ").Append(NbPartitipants).Append("\n");
sb.Append(" Mode: ").Append(Mode).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" EstCertifie: ").Append(EstCertifie).Append("\n");
sb.Append(" Organisme: ").Append(Organisme).Append("\n");
sb.Append(" NbParticipations: ").Append(NbParticipations).Append("\n");
sb.Append(" Origine: ").Append(Origine).Append("\n");
sb.Append(" EstCertifie: ").Append(EstCertifiee).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -166,24 +174,24 @@ namespace IO.Swagger.DTO
DateFin.Equals(other.DateFin)
) &&
(
NbPartitipants == other.NbPartitipants ||
NbPartitipants != null &&
NbPartitipants.Equals(other.NbPartitipants)
Organisme == other.Organisme ||
Organisme != null &&
Organisme.Equals(other.Organisme)
) &&
(
Mode == other.Mode ||
Mode != null &&
Mode.Equals(other.Mode)
NbParticipations == other.NbParticipations ||
NbParticipations != null &&
NbParticipations.Equals(other.NbParticipations)
) &&
(
Type == other.Type ||
Type != null &&
Type.Equals(other.Type)
Origine == other.Origine ||
Origine != null &&
Origine.Equals(other.Origine)
) &&
(
EstCertifie == other.EstCertifie ||
EstCertifie != null &&
EstCertifie.Equals(other.EstCertifie)
EstCertifiee == other.EstCertifiee ||
EstCertifiee != null &&
EstCertifiee.Equals(other.EstCertifiee)
);
}
@ -207,14 +215,14 @@ namespace IO.Swagger.DTO
hashCode = hashCode * 59 + DateDebut.GetHashCode();
if (DateFin != null)
hashCode = hashCode * 59 + DateFin.GetHashCode();
if (NbPartitipants != null)
hashCode = hashCode * 59 + NbPartitipants.GetHashCode();
if (Mode != null)
hashCode = hashCode * 59 + Mode.GetHashCode();
if (Type != null)
hashCode = hashCode * 59 + Type.GetHashCode();
if (EstCertifie != null)
hashCode = hashCode * 59 + EstCertifie.GetHashCode();
if (Organisme != null)
hashCode = hashCode * 59 + Organisme.GetHashCode();
if (NbParticipations != null)
hashCode = hashCode * 59 + NbParticipations.GetHashCode();
if (Origine != null)
hashCode = hashCode * 59 + Origine.GetHashCode();
if (EstCertifiee != null)
hashCode = hashCode * 59 + EstCertifiee.GetHashCode();
return hashCode;
}
}

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,21 +21,23 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Mode d&#x27;une formation
/// DTO concernant le mode d&#x27;une formation.
/// </summary>
[DataContract]
public partial class ModeFormationDTO : IEquatable<ModeFormationDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id du mode de formation
/// </summary>
/// <value>Id du mode de formation</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
/// <summary>
/// Gets or Sets Libelle
/// Libellé du mode de formation
/// </summary>
/// <value>Libellé du mode de formation</value>
[Required]
[DataMember(Name="libelle")]
public string Libelle { get; set; }

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,21 +21,23 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les objectifs pris par le collaborateur
/// DTO concernant un objectif du collaborateur.
/// </summary>
[DataContract]
public partial class ObjectifDTO : IEquatable<ObjectifDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de l&#x27;objectif
/// </summary>
/// <value>Id de l&#x27;objectif</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Libelle
/// Objectif du collaborateur
/// </summary>
/// <value>Objectif du collaborateur</value>
[Required]
[DataMember(Name="libelle")]
public string Libelle { get; set; }

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -17,40 +17,42 @@ using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using IO.Swagger.Enum;
namespace IO.Swagger.DTO
{
/// <summary>
/// Les objectifs pris par le collaborateur durant le précédent EP
/// DTO concernant un objectif du dernier EP effectué par le collaborateur.
/// </summary>
[DataContract]
public partial class ObjectifPrecedentDTO : IEquatable<ObjectifPrecedentDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de l&#x27;objectif précédent
/// </summary>
/// <value>Id de l&#x27;objectif précédent</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets Libelle
/// Objectif précédent du collaborateur
/// </summary>
/// <value>Objectif précédent du collaborateur</value>
[Required]
[DataMember(Name="libelle")]
public string Libelle { get; set; }
/// <summary>
/// Gets or Sets Atteint
/// Gets or Sets StatutObjectif
/// </summary>
[Required]
[DataMember(Name="atteint")]
public bool? Atteint { get; set; }
[DataMember(Name="statutObjectif")]
public StatutObjectif StatutObjectif { get; set; }
/// <summary>
/// Gets or Sets Commentaire
/// Commentaire du collaborateur sur l&#x27;objectif
/// </summary>
[Required]
/// <value>Commentaire du collaborateur sur l&#x27;objectif</value>
[DataMember(Name="commentaire")]
public string Commentaire { get; set; }
@ -64,7 +66,7 @@ namespace IO.Swagger.DTO
sb.Append("class ObjectifPrecedentDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Libelle: ").Append(Libelle).Append("\n");
sb.Append(" Atteint: ").Append(Atteint).Append("\n");
sb.Append(" StatutObjectif: ").Append(StatutObjectif).Append("\n");
sb.Append(" Commentaire: ").Append(Commentaire).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -113,9 +115,9 @@ namespace IO.Swagger.DTO
Libelle.Equals(other.Libelle)
) &&
(
Atteint == other.Atteint ||
Atteint != null &&
Atteint.Equals(other.Atteint)
StatutObjectif == other.StatutObjectif ||
StatutObjectif != null &&
StatutObjectif.Equals(other.StatutObjectif)
) &&
(
Commentaire == other.Commentaire ||
@ -138,8 +140,8 @@ namespace IO.Swagger.DTO
hashCode = hashCode * 59 + Id.GetHashCode();
if (Libelle != null)
hashCode = hashCode * 59 + Libelle.GetHashCode();
if (Atteint != null)
hashCode = hashCode * 59 + Atteint.GetHashCode();
if (StatutObjectif != null)
hashCode = hashCode * 59 + StatutObjectif.GetHashCode();
if (Commentaire != null)
hashCode = hashCode * 59 + Commentaire.GetHashCode();
return hashCode;

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,21 +21,23 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Origine d&#x27;une demande de formation
/// DTO concernant l&#x27;origine de la demande de formation.
/// </summary>
[DataContract]
public partial class OrigineDemandeFormationDTO : IEquatable<OrigineDemandeFormationDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de l&#x27;origine de la demande de formation
/// </summary>
/// <value>Id de l&#x27;origine de la demande de formation</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
/// <summary>
/// Gets or Sets Libelle
/// Libellé de l&#x27;origine de la demande de formation
/// </summary>
/// <value>Libellé de l&#x27;origine de la demande de formation</value>
[Required]
[DataMember(Name="libelle")]
public string Libelle { get; set; }

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,21 +21,23 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Origine d&#x27;une formation
/// DTO concernant l&#x27;origine d&#x27;une formation.
/// </summary>
[DataContract]
public partial class OrigineFormationDTO : IEquatable<OrigineFormationDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de l&#x27;origine de la formation
/// </summary>
/// <value>Id de l&#x27;origine de la formation</value>
[Required]
[DataMember(Name="id")]
public int? Id { get; set; }
/// <summary>
/// Gets or Sets Libelle
/// Libellé de l&#x27;origine de la formation
/// </summary>
/// <value>Libellé de l&#x27;origine de la formation</value>
[Required]
[DataMember(Name="libelle")]
public string Libelle { get; set; }

@ -3,7 +3,7 @@
*
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.1
* OpenAPI spec version: 1.3.6
*
* Generated by: https://github.com/swagger-api/swagger-codegen.git
*/
@ -21,31 +21,41 @@ using Newtonsoft.Json;
namespace IO.Swagger.DTO
{
/// <summary>
/// Information des participants d&#x27;un EP (autre que le référent et le collaborateur)
/// DTO concernant les participants supplémentaires d’un EP en dehors du collaborateur et du référent.
/// </summary>
[DataContract]
public partial class ParticipationEPDTO : IEquatable<ParticipationEPDTO>
{
/// <summary>
/// Gets or Sets Id
/// Id de la participation
/// </summary>
[Required]
/// <value>Id de la participation</value>
[DataMember(Name="id")]
public int? Id { get; set; }
public long? Id { get; set; }
/// <summary>
/// Gets or Sets IdCollaborateur
/// Id du participant
/// </summary>
/// <value>Id du participant</value>
[Required]
[DataMember(Name="idCollaborateur")]
public Guid? IdCollaborateur { get; set; }
[DataMember(Name="idParticipant")]
public Guid? IdParticipant { get; set; }
/// <summary>
/// Gets or Sets Collaborateur
/// Indique si la participation est juste une participation d&#x27;un EP en cours ou des prochains EP en plus
/// </summary>
/// <value>Indique si la participation est juste une participation d&#x27;un EP en cours ou des prochains EP en plus</value>
[Required]
[DataMember(Name="collaborateur")]
public string Collaborateur { get; set; }
[DataMember(Name="estPermanente")]
public bool? EstPermanente { get; set; }
/// <summary>
/// Nom et prénom du participant
/// </summary>
/// <value>Nom et prénom du participant</value>
[Required]
[DataMember(Name="participant")]
public string Participant { get; set; }
/// <summary>
/// Returns the string presentation of the object
@ -56,8 +66,9 @@ namespace IO.Swagger.DTO
var sb = new StringBuilder();
sb.Append("class ParticipationEPDTO {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" IdCollaborateur: ").Append(IdCollaborateur).Append("\n");
sb.Append(" Collaborateur: ").Append(Collaborateur).Append("\n");
sb.Append(" IdParticipant: ").Append(IdParticipant).Append("\n");
sb.Append(" EstPermanente: ").Append(EstPermanente).Append("\n");
sb.Append(" Participant: ").Append(Participant).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -100,14 +111,19 @@ namespace IO.Swagger.DTO
Id.Equals(other.Id)
) &&
(
IdCollaborateur == other.IdCollaborateur ||
IdCollaborateur != null &&
IdCollaborateur.Equals(other.IdCollaborateur)
IdParticipant == other.IdParticipant ||
IdParticipant != null &&
IdParticipant.Equals(other.IdParticipant)
) &&
(
EstPermanente == other.EstPermanente ||
EstPermanente != null &&
EstPermanente.Equals(other.EstPermanente)
) &&
(
Collaborateur == other.Collaborateur ||
Collaborateur != null &&
Collaborateur.Equals(other.Collaborateur)
Participant == other.Participant ||
Participant != null &&
Participant.Equals(other.Participant)
);
}
@ -123,10 +139,12 @@ namespace IO.Swagger.DTO
// Suitable nullity checks etc, of course :)
if (Id != null)
hashCode = hashCode * 59 + Id.GetHashCode();
if (IdCollaborateur != null)
hashCode = hashCode * 59 + IdCollaborateur.GetHashCode();
if (Collaborateur != null)
hashCode = hashCode * 59 + Collaborateur.GetHashCode();
if (IdParticipant != null)
hashCode = hashCode * 59 + IdParticipant.GetHashCode();
if (EstPermanente != null)
hashCode = hashCode * 59 + EstPermanente.GetHashCode();
if (Participant != null)
hashCode = hashCode * 59 + Participant.GetHashCode();
return hashCode;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save