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