Avancement Controller et Services Collaborateur

pull/2/head
Clement FERRERE 3 years ago
parent 15d9b039fa
commit e8beae3b90
  1. 62
      Collaborateur_Epa_Back/espacecollab.backend.api/Controllers/CollaborateursController.cs
  2. 8
      Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/CollaborateurApiDto.cs
  3. 61
      Collaborateur_Epa_Back/espacecollab.backend.appservices/CollaborateursServices.cs
  4. 2
      Collaborateur_Epa_Back/espacecollab.backend.appservices/GenericsServices.cs
  5. 2
      Collaborateur_Epa_Back/espacecollab.backend.appservices/IGenericsServices.cs
  6. 4
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs
  7. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs
  8. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurAppartientBusinessUnitSqlDto.cs
  9. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurCollaboreProjetSqlDto.cs
  10. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurEstFonctionSqlDto.cs
  11. 8
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs
  12. 4
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs
  13. 2
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/IGenericSqlDto.cs
  14. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs
  15. 4
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs
  16. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetUtiliseTechnologieSqlDto.cs
  17. 8
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs
  18. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteDeveloppeProjetSqlDto.cs
  19. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs
  20. 4
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs
  21. 18
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/FakeRepo/FakeCollaborateurRepository.cs
  22. 4
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/CollaborateurRepository.cs
  23. 2
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/GenericRepository.cs
  24. 6
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/ICollaborateurRepository.cs
  25. 2
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IGenericRepository.cs
  26. 2
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IReferencementRepository.cs

@ -17,9 +17,67 @@ namespace espacecollab.backend.api.Controllers
// GET: api/collaborateurs // GET: api/collaborateurs
[HttpGet] [HttpGet]
public IEnumerable<CollaborateurApiDto> GetCollaborateurs() public ActionResult<IEnumerable<CollaborateurApiDto>> GetCollaborateurs()
{ {
return CollaborateursServices.GetCollaborateurs(); IEnumerable<CollaborateurApiDto> collaborateurs = CollaborateursServices.GetCollaborateurs();
if (!collaborateurs.Any())
{
return NotFound();
}
return Ok(collaborateurs);
} }
[HttpGet("{collaborateurId}")]
public ActionResult<CollaborateurApiDto> GetCollaborateurById(int collaborateurId)
{
CollaborateurApiDto? collaborateur = CollaborateursServices.GetCollaborateurById(collaborateurId);
if (collaborateur == null)
return NotFound();
return Ok(collaborateur);
}
//public CollaborateurApiDto? AddCollaborateur(CollaborateurApiDto collaborateurApi)
//{
// CollaborateurSqlDto collaborateurSql = collaborateurApi.ToSql();
// if (collaborateurSql == null)
// return null;
// CollaborateurRepository.Add(collaborateurSql);
// return collaborateurApi;
//}
//public CollaborateurApiDto? DeleteCollaborateur(CollaborateurApiDto collaborateurApi)
//{
// CollaborateurSqlDto collaborateurSql = collaborateurApi.ToSql();
// if (collaborateurSql == null)
// return null;
// CollaborateurRepository.Delete(collaborateurSql);
// return collaborateurApi;
//}
//public CollaborateurApiDto? UpdateCollaborateur(CollaborateurApiDto collaborateurApi)
//{
// CollaborateurSqlDto collaborateurSql = collaborateurApi.ToSql();
// if (collaborateurSql == null)
// return null;
// CollaborateurRepository.Update(collaborateurSql);
// return collaborateurApi;
//}
//public IEnumerable<CollaborateurApiDto> GetCollaborateursByBusinessUnit(int businessUnitId)
//{
// return CollaborateurRepository.GetCollaborateursByBusinessUnit(businessUnitId).Select(collaborateurSql => collaborateurSql.ToApi());
//}
//public IEnumerable<CollaborateurApiDto> GetCollaborateursByReferrer(int referrerId)
//{
// return CollaborateurRepository.GetCollaborateursByReferrer(referrerId).Select(collaborateurSql => collaborateurSql.ToApi());
//}
//public CollaborateurApiDto? GetCollaborateurByApsideMail(string apsideMail)
//{
// if (string.IsNullOrEmpty(apsideMail))
// return null;
// return CollaborateurRepository.GetCollaborateurByApsideMail(apsideMail).ToApi();
//}
} }
} }

@ -5,7 +5,7 @@ namespace espacecollab.backend.appservices.dtos
{ {
public class CollaborateurApiDto public class CollaborateurApiDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string FirstName { get; set; } public string FirstName { get; set; }
public DateTime BirthDate { get; set; } public DateTime BirthDate { get; set; }
@ -17,15 +17,15 @@ namespace espacecollab.backend.appservices.dtos
public string PersonalMail { get; set; } public string PersonalMail { get; set; }
public string ApsideMail { get; set; } public string ApsideMail { get; set; }
public DateTime ResignationDate { get; set; } public DateTime ResignationDate { get; set; }
public Guid ReferrerId { get; set; } public int ReferrerId { get; set; }
public Guid BusinessUnitId { get; set; } public int BusinessUnitId { get; set; }
public CollaborateurApiDto() public CollaborateurApiDto()
{ {
} }
public CollaborateurApiDto(Guid id, string name, string firstName, DateTime birthDate, EnumGenreApi gender, EnumStatutApi status, int childrenNumber, string address, string telephone, string personalMail, string apsideMail, DateTime resignationDate, Guid referrerId, Guid businessUnitId) public CollaborateurApiDto(int id, string name, string firstName, DateTime birthDate, EnumGenreApi gender, EnumStatutApi status, int childrenNumber, string address, string telephone, string personalMail, string apsideMail, DateTime resignationDate, int referrerId, int businessUnitId)
{ {
Id = id; Id = id;
Name = name; Name = name;

@ -21,7 +21,7 @@ namespace espacecollab.backend.appservices
return CollaborateurRepository.GetAll().Select(collaborateurSql => collaborateurSql.ToApi()); return CollaborateurRepository.GetAll().Select(collaborateurSql => collaborateurSql.ToApi());
} }
public CollaborateurApiDto? GetCollaborateurById(Guid id) public CollaborateurApiDto? GetCollaborateurById(int id)
{ {
return CollaborateurRepository.GetById(id)?.ToApi(); return CollaborateurRepository.GetById(id)?.ToApi();
} }
@ -44,45 +44,30 @@ namespace espacecollab.backend.appservices
return collaborateurApi; return collaborateurApi;
} }
//public new CollaborateurSqlDto? Delete(CollaborateurSqlDto entity) public CollaborateurApiDto? UpdateCollaborateur(CollaborateurApiDto collaborateurApi)
//{ {
// Collaborateurs.Remove(entity); CollaborateurSqlDto collaborateurSql = collaborateurApi.ToSql();
// return entity; if (collaborateurSql == null)
//} return null;
CollaborateurRepository.Update(collaborateurSql);
//public new IEnumerable<CollaborateurSqlDto> GetAll() return collaborateurApi;
//{ }
// return Collaborateurs;
//}
//public new CollaborateurSqlDto? Update(CollaborateurSqlDto collaborateur)
//{
// CollaborateurSqlDto? oldCollab = Collaborateurs.FirstOrDefault(entity => entity.Id == collaborateur.Id);
// if (oldCollab == null)
// {
// Collaborateurs.Add(collaborateur);
// return collaborateur;
// }
// Collaborateurs.Remove(oldCollab);
// Collaborateurs.Add(collaborateur);
// return collaborateur;
//}
////méthodes spécifiques à l'interface ICollaborateurRepository
//public IList<CollaborateurSqlDto>? GetCollaborateursByBusinessUnit(Guid businessUnitId)
//{
// return Collaborateurs.Where(entity => entity.BusinessUnitId == businessUnitId).ToList();
//}
public IEnumerable<CollaborateurApiDto> GetCollaborateursByBusinessUnit(int businessUnitId)
{
return CollaborateurRepository.GetCollaborateursByBusinessUnit(businessUnitId).Select(collaborateurSql => collaborateurSql.ToApi());
}
//public IList<CollaborateurSqlDto>? GetCollaborateursByReferrer(Guid referrerId) public IEnumerable<CollaborateurApiDto> GetCollaborateursByReferrer(int referrerId)
//{ {
// return Collaborateurs.Where(entity => entity.ReferrerId == referrerId).ToList(); return CollaborateurRepository.GetCollaborateursByReferrer(referrerId).Select(collaborateurSql => collaborateurSql.ToApi());
//} }
//public CollaborateurSqlDto? GetCollaborateurByApsideMail(string apsideMail) public CollaborateurApiDto? GetCollaborateurByApsideMail(string apsideMail)
//{ {
// return Collaborateurs.FirstOrDefault(entity => entity.ApsideMail == apsideMail); if (string.IsNullOrEmpty(apsideMail))
//} return null;
return CollaborateurRepository.GetCollaborateurByApsideMail(apsideMail).ToApi();
}
} }
} }

@ -28,7 +28,7 @@ namespace espacecollab.backend.appservices
// return GenericRepository.GetAll<T>(); // return GenericRepository.GetAll<T>();
// } // }
// public To? GetById<T>(Guid id) where T : class, IGenericSqlDto // public To? GetById<T>(int id) where T : class, IGenericSqlDto
// { // {
// T? entity = GenericRepository.GetById<T>(id); // T? entity = GenericRepository.GetById<T>(id);
// if (entity == null) // if (entity == null)

@ -8,7 +8,7 @@ namespace espacecollab.backend.appservices
IEnumerable<To> GetAll(); IEnumerable<To> GetAll();
To? GetById(Guid id); To? GetById(int id);
To? Update(T entity); To? Update(T entity);
} }

@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class AgenceSqlDto : IGenericSqlDto public class AgenceSqlDto : IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
@ -13,7 +13,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
} }
public AgenceSqlDto(Guid id, string name) public AgenceSqlDto(int id, string name)
{ {
Id = id; Id = id;
Name = name; Name = name;

@ -4,9 +4,9 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class BusinessUnitSqlDto : IGenericSqlDto public class BusinessUnitSqlDto : IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public Guid AgenceId { get; set; } public int AgenceId { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
@ -14,7 +14,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
} }
public BusinessUnitSqlDto(Guid id, string name, Guid agenceId) public BusinessUnitSqlDto(int id, string name, int agenceId)
{ {
Id = id; Id = id;
Name = name; Name = name;

@ -4,8 +4,8 @@ namespace espacecollab.backend.infrastructure.sql.dtos.Associations
{ {
public class CollaborateurAppartientBusinessUnitSqlDto public class CollaborateurAppartientBusinessUnitSqlDto
{ {
public Guid CollaborateurId { get; set; } public int CollaborateurId { get; set; }
public Guid BusinessUnitId { get; set; } public int BusinessUnitId { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
@ -13,7 +13,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos.Associations
{ {
} }
public CollaborateurAppartientBusinessUnitSqlDto(Guid collaborateurId, Guid businessUnitId) public CollaborateurAppartientBusinessUnitSqlDto(int collaborateurId, int businessUnitId)
{ {
CollaborateurId = collaborateurId; CollaborateurId = collaborateurId;
BusinessUnitId = businessUnitId; BusinessUnitId = businessUnitId;

@ -4,8 +4,8 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class CollaborateurCollaboreProjetSqlDto public class CollaborateurCollaboreProjetSqlDto
{ {
public Guid CollaborateurId { get; set; } public int CollaborateurId { get; set; }
public Guid ProjetId { get; set; } public int ProjetId { get; set; }
public bool IsManager { get; set; } public bool IsManager { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
@ -13,7 +13,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
} }
public CollaborateurCollaboreProjetSqlDto(Guid collaborateurId, Guid projetId, bool isManager) public CollaborateurCollaboreProjetSqlDto(int collaborateurId, int projetId, bool isManager)
{ {
CollaborateurId = collaborateurId; CollaborateurId = collaborateurId;
ProjetId = projetId; ProjetId = projetId;

@ -4,15 +4,15 @@ namespace espacecollab.backend.infrastructure.sql.dtos.Associations
{ {
public class CollaborateurEstFonctionSqlDto public class CollaborateurEstFonctionSqlDto
{ {
public Guid CollaborateurId { get; set; } public int CollaborateurId { get; set; }
public Guid FonctionId { get; set; } public int FonctionId { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
private CollaborateurEstFonctionSqlDto() private CollaborateurEstFonctionSqlDto()
{ {
} }
public CollaborateurEstFonctionSqlDto(Guid collaborateurId, Guid fonctionId) public CollaborateurEstFonctionSqlDto(int collaborateurId, int fonctionId)
{ {
CollaborateurId = collaborateurId; CollaborateurId = collaborateurId;
FonctionId = fonctionId; FonctionId = fonctionId;

@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class CollaborateurSqlDto : IGenericSqlDto public class CollaborateurSqlDto : IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string FirstName { get; set; } public string FirstName { get; set; }
public DateTime BirthDate { get; set; } public DateTime BirthDate { get; set; }
@ -16,15 +16,15 @@ namespace espacecollab.backend.infrastructure.sql.dtos
public string PersonalMail { get; set; } public string PersonalMail { get; set; }
public string ApsideMail { get; set; } public string ApsideMail { get; set; }
public DateTime ResignationDate { get; set; } public DateTime ResignationDate { get; set; }
public Guid ReferrerId { get; set; } public int ReferrerId { get; set; }
public Guid BusinessUnitId { get; set; } public int BusinessUnitId { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
private CollaborateurSqlDto() private CollaborateurSqlDto()
{ {
} }
public CollaborateurSqlDto(Guid id, string name, string firstName, DateTime birthDate, EnumGenreSql gender, EnumStatutSql status, int childrenNumber, string address, string telephone, string personalMail, string apsideMail, DateTime resignationDate, Guid referrerId, Guid businessUnitId) public CollaborateurSqlDto(int id, string name, string firstName, DateTime birthDate, EnumGenreSql gender, EnumStatutSql status, int childrenNumber, string address, string telephone, string personalMail, string apsideMail, DateTime resignationDate, int referrerId, int businessUnitId)
{ {
Id = id; Id = id;
Name = name; Name = name;

@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class FonctionSqlDto : IGenericSqlDto public class FonctionSqlDto : IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
@ -12,7 +12,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
} }
public FonctionSqlDto(Guid id, string name) public FonctionSqlDto(int id, string name)
{ {
Id = id; Id = id;
Name = name; Name = name;

@ -2,7 +2,7 @@
{ {
public interface IGenericSqlDto public interface IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
} }
} }

@ -4,20 +4,20 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class PeriodeEssaiSqlDto : IGenericSqlDto public class PeriodeEssaiSqlDto : IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public DateTime StartingDate { get; set; } public DateTime StartingDate { get; set; }
public DateTime PlannedEndingDate { get; set; } public DateTime PlannedEndingDate { get; set; }
public DateTime RealEndingDate { get; set; } public DateTime RealEndingDate { get; set; }
public string Comment { get; set; } public string Comment { get; set; }
public EnumIssueSql Issue { get; set; } public EnumIssueSql Issue { get; set; }
public Guid CollaborateurId { get; set; } public int CollaborateurId { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
private PeriodeEssaiSqlDto() private PeriodeEssaiSqlDto()
{ {
} }
public PeriodeEssaiSqlDto(Guid id, DateTime startingDate, DateTime plannedEndingDate, DateTime realEndingDate, string comment, EnumIssueSql issue, Guid collaborateurId) public PeriodeEssaiSqlDto(int id, DateTime startingDate, DateTime plannedEndingDate, DateTime realEndingDate, string comment, EnumIssueSql issue, int collaborateurId)
{ {
Id = id; Id = id;
StartingDate = startingDate; StartingDate = startingDate;

@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class ProjetSqlDto : IGenericSqlDto public class ProjetSqlDto : IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Client { get; set; } public string Client { get; set; }
public string Description { get; set; } public string Description { get; set; }
@ -16,7 +16,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
} }
public ProjetSqlDto(Guid id, string name, string client, string description, DateTime startingDate, DateTime endingDate) public ProjetSqlDto(int id, string name, string client, string description, DateTime startingDate, DateTime endingDate)
{ {
Id = id; Id = id;
Name = name; Name = name;

@ -4,15 +4,15 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class ProjetUtiliseTechnologieSqlDto public class ProjetUtiliseTechnologieSqlDto
{ {
public Guid ProjetId { get; set; } public int ProjetId { get; set; }
public Guid TechnologieId { get; set; } public int TechnologieId { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
private ProjetUtiliseTechnologieSqlDto() private ProjetUtiliseTechnologieSqlDto()
{ {
} }
public ProjetUtiliseTechnologieSqlDto(Guid projetId, Guid technologieId) public ProjetUtiliseTechnologieSqlDto(int projetId, int technologieId)
{ {
ProjetId = projetId; ProjetId = projetId;
TechnologieId = technologieId; TechnologieId = technologieId;

@ -4,18 +4,18 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class ReferencementSqlDto : IGenericSqlDto public class ReferencementSqlDto : IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public DateTime StartingDate { get; set; } public DateTime StartingDate { get; set; }
public DateTime EndingDate { get; set; } public DateTime EndingDate { get; set; }
public Guid ReferredId { get; set; } public int ReferredId { get; set; }
public Guid ReferrerId { get; set; } public int ReferrerId { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
private ReferencementSqlDto() private ReferencementSqlDto()
{ {
} }
public ReferencementSqlDto(Guid id, DateTime startingDate, DateTime endingDate, Guid referredId, Guid referrerId) public ReferencementSqlDto(int id, DateTime startingDate, DateTime endingDate, int referredId, int referrerId)
{ {
Id = id; Id = id;
StartingDate = startingDate; StartingDate = startingDate;

@ -4,15 +4,15 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class SiteDeveloppeProjetSqlDto public class SiteDeveloppeProjetSqlDto
{ {
public Guid SiteId { get; set; } public int SiteId { get; set; }
public Guid ProjetId { get; set; } public int ProjetId { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
private SiteDeveloppeProjetSqlDto() private SiteDeveloppeProjetSqlDto()
{ {
} }
public SiteDeveloppeProjetSqlDto(Guid siteId, Guid projetId) public SiteDeveloppeProjetSqlDto(int siteId, int projetId)
{ {
SiteId = siteId; SiteId = siteId;
ProjetId = projetId; ProjetId = projetId;

@ -4,17 +4,17 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class SiteSqlDto : IGenericSqlDto public class SiteSqlDto : IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string Address { get; set; } public string Address { get; set; }
public Guid BusinessUnitId { get; set; } public int BusinessUnitId { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
private SiteSqlDto() private SiteSqlDto()
{ {
} }
public SiteSqlDto(Guid id, string name, string address, Guid businessUnitId) public SiteSqlDto(int id, string name, string address, int businessUnitId)
{ {
Id = id; Id = id;
Name = name; Name = name;

@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
public class TechnologieSqlDto : IGenericSqlDto public class TechnologieSqlDto : IGenericSqlDto
{ {
public Guid Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
[ExcludeFromCodeCoverage] [ExcludeFromCodeCoverage]
@ -12,7 +12,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos
{ {
} }
public TechnologieSqlDto(Guid id, string name) public TechnologieSqlDto(int id, string name)
{ {
Id = id; Id = id;
Name = name; Name = name;

@ -16,17 +16,17 @@ namespace espacecollab.backend.infrastructure.sql.FakeRepo
Collaborateurs = new List<CollaborateurSqlDto> Collaborateurs = new List<CollaborateurSqlDto>
{ {
new CollaborateurSqlDto(new Guid(), "Dupont", "Jean", new DateTime(1980, 12, 10), new CollaborateurSqlDto(new int(), "Dupont", "Jean", new DateTime(1980, 12, 10),
EnumGenreSql.MASCULIN, EnumStatutSql.NONCADRE, 0, "1 rue du Louvre, 63000, Clermont-Ferrand", "0660258644", EnumGenreSql.MASCULIN, EnumStatutSql.NONCADRE, 0, "1 rue du Louvre, 63000, Clermont-Ferrand", "0660258644",
"jean.dupont@gmail.com", "jean.dupont@apside-groupe.com", new DateTime(2023, 12, 17), new Guid(), new Guid()), "jean.dupont@gmail.com", "jean.dupont@apside-groupe.com", new DateTime(2023, 12, 17), new int(), new int()),
new CollaborateurSqlDto(new Guid(), "Michel", "Laura", new DateTime(1985, 08, 12), new CollaborateurSqlDto(new int(), "Michel", "Laura", new DateTime(1985, 08, 12),
EnumGenreSql.FEMININ, EnumStatutSql.NONCADRE, 0, "5 rue du Louvre, 63000, Clermont-Ferrand", "0660258644", EnumGenreSql.FEMININ, EnumStatutSql.NONCADRE, 0, "5 rue du Louvre, 63000, Clermont-Ferrand", "0660258644",
"laura.michel@gmail.com", "laura.michel@apside-groupe.com", new DateTime(2023, 12, 17), new Guid(), new Guid()) "laura.michel@gmail.com", "laura.michel@apside-groupe.com", new DateTime(2023, 12, 17), new int(), new int())
}; };
} }
//redéfinition des méthodes du GenericRepository pour fonctionner avec Fake //redéfinition des méthodes du GenericRepository pour fonctionner avec Fake
public new CollaborateurSqlDto? GetById(Guid id) public new CollaborateurSqlDto? GetById(int id)
{ {
return Collaborateurs.FirstOrDefault(entity => entity.Id == id); return Collaborateurs.FirstOrDefault(entity => entity.Id == id);
} }
@ -62,20 +62,20 @@ namespace espacecollab.backend.infrastructure.sql.FakeRepo
} }
//méthodes spécifiques à l'interface ICollaborateurRepository //méthodes spécifiques à l'interface ICollaborateurRepository
public IList<CollaborateurSqlDto>? GetCollaborateursByBusinessUnit(Guid businessUnitId) public IList<CollaborateurSqlDto> GetCollaborateursByBusinessUnit(int businessUnitId)
{ {
return Collaborateurs.Where(entity => entity.BusinessUnitId == businessUnitId).ToList(); return Collaborateurs.Where(entity => entity.BusinessUnitId == businessUnitId).ToList();
} }
public IList<CollaborateurSqlDto>? GetCollaborateursByReferrer(Guid referrerId) public IList<CollaborateurSqlDto> GetCollaborateursByReferrer(int referrerId)
{ {
return Collaborateurs.Where(entity => entity.ReferrerId == referrerId).ToList(); return Collaborateurs.Where(entity => entity.ReferrerId == referrerId).ToList();
} }
public CollaborateurSqlDto? GetCollaborateurByApsideMail(string apsideMail) public CollaborateurSqlDto GetCollaborateurByApsideMail(string apsideMail)
{ {
return Collaborateurs.FirstOrDefault(entity => entity.ApsideMail == apsideMail); return Collaborateurs.First(entity => entity.ApsideMail == apsideMail);
} }
} }
} }

@ -12,10 +12,10 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo
Context = context; Context = context;
} }
public IList<CollaborateurSqlDto>? GetCollaborateursByBusinessUnit(Guid businessUnitId) public IList<CollaborateurSqlDto> GetCollaborateursByBusinessUnit(int businessUnitId)
=> Context.Set<CollaborateurSqlDto>().Where(collaborateur => collaborateur.BusinessUnitId == businessUnitId).ToList(); => Context.Set<CollaborateurSqlDto>().Where(collaborateur => collaborateur.BusinessUnitId == businessUnitId).ToList();
public IList<CollaborateurSqlDto>? GetCollaborateursByReferrer(Guid referrerId) public IList<CollaborateurSqlDto> GetCollaborateursByReferrer(int referrerId)
=> Context.Set<CollaborateurSqlDto>().Where(collaborateur => collaborateur.ReferrerId == referrerId).ToList(); => Context.Set<CollaborateurSqlDto>().Where(collaborateur => collaborateur.ReferrerId == referrerId).ToList();
public CollaborateurSqlDto? GetCollaborateurByApsideMail(string apsideMail) public CollaborateurSqlDto? GetCollaborateurByApsideMail(string apsideMail)

@ -32,7 +32,7 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo
return Context.Set<T>().ToList(); return Context.Set<T>().ToList();
} }
public virtual T? GetById(Guid id) public virtual T? GetById(int id)
{ {
return Context.Set<T>().FirstOrDefault(entity => entity.Id == id); return Context.Set<T>().FirstOrDefault(entity => entity.Id == id);
} }

@ -4,8 +4,8 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo.Interface
{ {
public interface ICollaborateurRepository : IGenericRepository<CollaborateurSqlDto> public interface ICollaborateurRepository : IGenericRepository<CollaborateurSqlDto>
{ {
CollaborateurSqlDto? GetCollaborateurByApsideMail(string apsideMail); CollaborateurSqlDto GetCollaborateurByApsideMail(string apsideMail);
IList<CollaborateurSqlDto>? GetCollaborateursByBusinessUnit(Guid businessUnitId); IList<CollaborateurSqlDto> GetCollaborateursByBusinessUnit(int businessUnitId);
IList<CollaborateurSqlDto>? GetCollaborateursByReferrer(Guid referrerId); IList<CollaborateurSqlDto> GetCollaborateursByReferrer(int referrerId);
} }
} }

@ -7,7 +7,7 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo.Interface
T? Add(T entity); T? Add(T entity);
T? Delete(T entity); T? Delete(T entity);
IEnumerable<T> GetAll(); IEnumerable<T> GetAll();
T? GetById(Guid id); T? GetById(int id);
T? Update(T entity); T? Update(T entity);

@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo.Interface
{ {
public interface IReferencementRepository public interface IReferencementRepository
{ {
IList<CollaborateurSqlDto>? GetReferrersByCollaborateurId(Guid collaborateurId); IList<CollaborateurSqlDto>? GetReferrersByCollaborateurId(int collaborateurId);
IList<CollaborateurSqlDto>? GetReferrersByCollaborateurApsideMail(string apsideMail); IList<CollaborateurSqlDto>? GetReferrersByCollaborateurApsideMail(string apsideMail);
//TODO Voir les attentes concernant "le référent ayant le plus suivi depuis une date" //TODO Voir les attentes concernant "le référent ayant le plus suivi depuis une date"

Loading…
Cancel
Save