Ajout du DTO du référent

master
Yanaël GRETTE 4 years ago
parent b0ff800c46
commit 3f7aea1062
  1. 30
      Controllers/ReferentsApi.cs
  2. 2
      DTO/CollaborateurDTO.cs
  3. 193
      DTO/ReferentDTO.cs

@ -45,13 +45,13 @@ namespace IO.Swagger.Controllers
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetReferentByCollaborateur")]
[SwaggerResponse(statusCode: 200, type: typeof(List<CollaborateurDTO>), description: "OK")]
[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<CollaborateurDTO>));
// 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));
@ -59,11 +59,11 @@ namespace IO.Swagger.Controllers
//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} ]";
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<CollaborateurDTO>>(exampleJson)
: default(List<CollaborateurDTO>); //TODO: Change the data returned
? JsonConvert.DeserializeObject<List<ReferentDTO>>(exampleJson)
: default(List<ReferentDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
@ -80,13 +80,13 @@ namespace IO.Swagger.Controllers
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetReferentById")]
[SwaggerResponse(statusCode: 200, type: typeof(CollaborateurDTO), description: "OK")]
[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(CollaborateurDTO));
// 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));
@ -94,11 +94,11 @@ namespace IO.Swagger.Controllers
//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}";
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<CollaborateurDTO>(exampleJson)
: default(CollaborateurDTO); //TODO: Change the data returned
? JsonConvert.DeserializeObject<ReferentDTO>(exampleJson)
: default(ReferentDTO); //TODO: Change the data returned
return new ObjectResult(example);
}
@ -121,21 +121,21 @@ namespace IO.Swagger.Controllers
[Authorize(AuthenticationSchemes = BearerAuthenticationHandler.SchemeName)]
[ValidateModelState]
[SwaggerOperation("GetReferents")]
[SwaggerResponse(statusCode: 200, type: typeof(List<CollaborateurDTO>), description: "OK")]
[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<CollaborateurDTO>));
// 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 \"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} ]";
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<CollaborateurDTO>>(exampleJson)
: default(List<CollaborateurDTO>); //TODO: Change the data returned
? JsonConvert.DeserializeObject<List<ReferentDTO>>(exampleJson)
: default(List<ReferentDTO>); //TODO: Change the data returned
return new ObjectResult(example);
}
}

@ -77,7 +77,7 @@ namespace IO.Swagger.DTO
/// Gets or Sets Referent
/// </summary>
[DataMember(Name="referent")]
public CollaborateurDTO Referent { get; set; }
public ReferentDTO Referent { get; set; }
/// <summary>
/// Returns the string presentation of the object

@ -0,0 +1,193 @@
/*
* 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
}
}
Loading…
Cancel
Save