|
|
|
@ -2,47 +2,44 @@ |
|
|
|
|
using espacecollab.backend.appservices.dtos; |
|
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
|
|
|
|
|
namespace espacecollab.backend.api.Controllers |
|
|
|
|
namespace espacecollab.backend.api.Controllers; |
|
|
|
|
|
|
|
|
|
public class CollaborateursController : BaseController<CollaborateurApiDto> |
|
|
|
|
{ |
|
|
|
|
//[Route("api/[controller]")] |
|
|
|
|
//[ApiController] |
|
|
|
|
public class CollaborateursController : BaseController<CollaborateurApiDto> |
|
|
|
|
private CollaborateursService CollaborateursServices { get; } |
|
|
|
|
|
|
|
|
|
public CollaborateursController(CollaborateursService collaborateursServices) : base(collaborateursServices) |
|
|
|
|
{ |
|
|
|
|
CollaborateursServices = collaborateursServices; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpGet("businessunit/{businessUnitId:int:min(1)}")] |
|
|
|
|
public ActionResult<IEnumerable<CollaborateurApiDto>> GetCollaborateursByBusinessUnit(uint businessUnitId) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<CollaborateurApiDto> collaborateurs = CollaborateursServices.GetCollaborateursByBusinessUnit(businessUnitId); |
|
|
|
|
if (!collaborateurs.Any()) |
|
|
|
|
return NotFound(); |
|
|
|
|
|
|
|
|
|
return Ok(collaborateurs); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpGet("referrer/{referrerId:int:min(1)}")] |
|
|
|
|
public ActionResult<IEnumerable<CollaborateurApiDto>> GetCollaborateursByReferrer(uint referrerId) |
|
|
|
|
{ |
|
|
|
|
private CollaborateursService CollaborateursServices { get; } |
|
|
|
|
|
|
|
|
|
public CollaborateursController(CollaborateursService collaborateursServices) : base(collaborateursServices) |
|
|
|
|
{ |
|
|
|
|
CollaborateursServices = collaborateursServices; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpGet("businessunit/{businessUnitId:int:min(1)}")] |
|
|
|
|
public ActionResult<IEnumerable<CollaborateurApiDto>> GetCollaborateursByBusinessUnit(uint businessUnitId) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<CollaborateurApiDto> collaborateurs = CollaborateursServices.GetCollaborateursByBusinessUnit(businessUnitId); |
|
|
|
|
if (!collaborateurs.Any()) |
|
|
|
|
return NotFound(); |
|
|
|
|
|
|
|
|
|
return Ok(collaborateurs); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpGet("referrer/{referrerId:int:min(1)}")] |
|
|
|
|
public ActionResult<IEnumerable<CollaborateurApiDto>> GetCollaborateursByReferrer(uint referrerId) |
|
|
|
|
{ |
|
|
|
|
IEnumerable<CollaborateurApiDto> collaborateurs = CollaborateursServices.GetCollaborateursByReferrer(referrerId); |
|
|
|
|
if (!collaborateurs.Any()) |
|
|
|
|
return NotFound(); |
|
|
|
|
|
|
|
|
|
return Ok(collaborateurs); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpGet("apsidemail/{apsideMail:minlength(1):regex(^\\S.*)}")] |
|
|
|
|
public ActionResult<CollaborateurApiDto> GetCollaborateurByApsideMail(string apsideMail) |
|
|
|
|
{ |
|
|
|
|
CollaborateurApiDto? collaborateur = CollaborateursServices.GetCollaborateurByApsideMail(apsideMail); |
|
|
|
|
if (collaborateur == null) |
|
|
|
|
return NotFound(); |
|
|
|
|
|
|
|
|
|
return Ok(collaborateur); |
|
|
|
|
} |
|
|
|
|
IEnumerable<CollaborateurApiDto> collaborateurs = CollaborateursServices.GetCollaborateursByReferrer(referrerId); |
|
|
|
|
if (!collaborateurs.Any()) |
|
|
|
|
return NotFound(); |
|
|
|
|
|
|
|
|
|
return Ok(collaborateurs); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpGet("apsidemail/{apsideMail:minlength(1):regex(^\\S.*)}")] |
|
|
|
|
public ActionResult<CollaborateurApiDto> GetCollaborateurByApsideMail(string apsideMail) |
|
|
|
|
{ |
|
|
|
|
CollaborateurApiDto? collaborateur = CollaborateursServices.GetCollaborateurByApsideMail(apsideMail); |
|
|
|
|
if (collaborateur == null) |
|
|
|
|
return NotFound(); |
|
|
|
|
|
|
|
|
|
return Ok(collaborateur); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |