|
|
|
@ -23,6 +23,7 @@ using Microsoft.Extensions.Logging; |
|
|
|
|
using EPAServeur.Exceptions; |
|
|
|
|
using IO.Swagger.ClientCollaborateur; |
|
|
|
|
using Microsoft.AspNetCore.Server.Kestrel.Core; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
|
{ |
|
|
|
@ -55,7 +56,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[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'a pas été trouvée")] |
|
|
|
|
public virtual IActionResult GetCollaborateurById([FromRoute][Required]Guid? idCollaborateur) |
|
|
|
|
public virtual async Task<IActionResult> GetCollaborateurById([FromRoute][Required]Guid? idCollaborateur) |
|
|
|
|
{ |
|
|
|
|
//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)); |
|
|
|
@ -63,7 +64,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
CollaborateurDTO collaborateurDTO = null; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
collaborateurDTO = collaborateurService.GetCollaborateurById(idCollaborateur); |
|
|
|
|
collaborateurDTO = await collaborateurService.GetCollaborateurByIdAsync(idCollaborateur); |
|
|
|
|
} |
|
|
|
|
catch (ApiException) |
|
|
|
|
{ |
|
|
|
@ -103,7 +104,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[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'a pas été trouvée")] |
|
|
|
|
public virtual IActionResult GetCollaborateurByMail([FromRoute][Required]string mail) |
|
|
|
|
public virtual async Task<IActionResult> GetCollaborateurByMail([FromRoute][Required]string mail) |
|
|
|
|
{ |
|
|
|
|
//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)); |
|
|
|
@ -111,7 +112,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
CollaborateurDTO collaborateurDTO = null; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
collaborateurDTO = collaborateurService.GetCollaborateurByMail(mail); |
|
|
|
|
collaborateurDTO = await collaborateurService.GetCollaborateurByMailAsync(mail); |
|
|
|
|
} |
|
|
|
|
catch (CollaborateurNotFoundException) |
|
|
|
|
{ |
|
|
|
@ -156,7 +157,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[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]long? idAgence, [FromQuery]long? idBU, [FromQuery]string texte, [FromQuery]string tri) |
|
|
|
|
public virtual async Task<IActionResult> GetCollaborateurs([FromQuery][Required()]bool? asc, [FromQuery][Required()]int? numPage, [FromQuery][Required()]int? parPAge, [FromQuery]List<string> fonctions, [FromQuery]long? idAgence, [FromQuery]long? idBU, [FromQuery]string texte, [FromQuery]string tri) |
|
|
|
|
{ |
|
|
|
|
//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)); |
|
|
|
@ -164,7 +165,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurs = null; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
collaborateurs = collaborateurService.GetCollaborateurs(asc, numPage, parPAge, fonctions, idAgence, idBU, texte, tri); |
|
|
|
|
collaborateurs = await collaborateurService.GetCollaborateursAsync(asc, numPage, parPAge, fonctions, idAgence, idBU, texte, tri); |
|
|
|
|
} |
|
|
|
|
catch(ApiException) |
|
|
|
|
{ |
|
|
|
@ -200,12 +201,12 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[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'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) |
|
|
|
|
public virtual async Task<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 403 or use other options such as return this.NotFound(), return this.BadRequest(..), ... |
|
|
|
|
// return StatusCode(403, default(ErreurDTO)); |
|
|
|
|
logger.LogInformation("Récupération de la liste des collaborateurs du référent {idReferent}",idReferent); |
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurs = collaborateurService.GetCollaborateursByReferent(idReferent, asc, numPage, parPAge, texte, tri); |
|
|
|
|
IEnumerable<CollaborateurDTO> collaborateurs = await collaborateurService.GetCollaborateursByReferentAsync(idReferent, asc, numPage, parPAge, texte, tri); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
collaborateurs = collaborateurService.GetCollaborateursByReferent(idReferent, asc, numPage, parPAge, texte, tri); |
|
|
|
@ -247,7 +248,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
[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'a pas été trouvée")] |
|
|
|
|
public virtual IActionResult GetProfilCollaborateurByMail([FromRoute][Required]string mail) |
|
|
|
|
public virtual async Task<IActionResult> GetProfilCollaborateurByMailAsync([FromRoute][Required]string mail) |
|
|
|
|
{ |
|
|
|
|
//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)); |
|
|
|
@ -255,7 +256,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
ProfilDTO collaborateurDTO = null; |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
collaborateurDTO = collaborateurService.GetProfilByMail(mail); |
|
|
|
|
collaborateurDTO = await collaborateurService.GetProfilByMailAsync(mail); |
|
|
|
|
} |
|
|
|
|
catch (ApiException) |
|
|
|
|
{ |
|
|
|
|