|
|
|
@ -24,6 +24,7 @@ using EPAServeur.Exceptions; |
|
|
|
|
using IO.Swagger.ClientCollaborateur; |
|
|
|
|
using Microsoft.AspNetCore.Server.Kestrel.Core; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
|
|
|
|
|
|
|
|
namespace IO.Swagger.Controllers |
|
|
|
|
{ |
|
|
|
@ -50,7 +51,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/collaborateurs/{idCollaborateur}")] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH,Assistante,Commercial")] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetCollaborateurById")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(CollaborateurDTO), description: "OK")] |
|
|
|
@ -72,7 +73,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
} |
|
|
|
|
catch (CollaborateurNotFoundException) |
|
|
|
|
{ |
|
|
|
|
logger.LogError("Le ccollaborateur {id} est introuvable", idCollaborateur); |
|
|
|
|
logger.LogError("Le collaborateur {id} est introuvable", idCollaborateur); |
|
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
@ -98,7 +99,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/collaborateurs/mail/{mail}")] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH,Assistante,Commercial")] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetCollaborateurByMail")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(CollaborateurDTO), description: "OK")] |
|
|
|
@ -116,7 +117,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
} |
|
|
|
|
catch (CollaborateurNotFoundException) |
|
|
|
|
{ |
|
|
|
|
logger.LogError("Le ccollaborateur {mail} est introuvable", mail); |
|
|
|
|
logger.LogError("Le collaborateur {mail} est introuvable", mail); |
|
|
|
|
ErreurDTO erreurDTO = new ErreurDTO() |
|
|
|
|
{ |
|
|
|
|
Code = "404", |
|
|
|
@ -152,7 +153,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="403">Acces interdit</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/collaborateurs")] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH,Assistante,Commercial")] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetCollaborateurs")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<CollaborateurDTO>), description: "OK")] |
|
|
|
@ -195,7 +196,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/collaborateurs/referent/{idReferent}")] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH,Assistante,Commercial")] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetCollaborateursByReferent")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(List<CollaborateurDTO>), description: "OK")] |
|
|
|
@ -242,7 +243,7 @@ namespace IO.Swagger.Controllers |
|
|
|
|
/// <response code="404">Ressource n'a pas été trouvée</response> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("/api/collaborateurs/profil/{mail}/")] |
|
|
|
|
//[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)] |
|
|
|
|
//[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme, Roles = "RH,Assistante,Commercial")] |
|
|
|
|
[ValidateModelState] |
|
|
|
|
[SwaggerOperation("GetProfilCollaborateurByMail")] |
|
|
|
|
[SwaggerResponse(statusCode: 200, type: typeof(ProfilDTO), description: "OK")] |
|
|
|
|