You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
6.8 KiB
125 lines
6.8 KiB
/*
|
|
* 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'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'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'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'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'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'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();
|
|
}
|
|
}
|
|
}
|
|
|