diff --git a/Collaborateur_Epa_Back/espacecollab.backend.api/Controllers/CollaborateursController.cs b/Collaborateur_Epa_Back/espacecollab.backend.api/Controllers/CollaborateursController.cs index 426c042..a5a0caf 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.api/Controllers/CollaborateursController.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.api/Controllers/CollaborateursController.cs @@ -17,9 +17,67 @@ namespace espacecollab.backend.api.Controllers // GET: api/collaborateurs [HttpGet] - public IEnumerable GetCollaborateurs() + public ActionResult> GetCollaborateurs() { - return CollaborateursServices.GetCollaborateurs(); + IEnumerable collaborateurs = CollaborateursServices.GetCollaborateurs(); + if (!collaborateurs.Any()) + { + return NotFound(); + } + return Ok(collaborateurs); } + + [HttpGet("{collaborateurId}")] + public ActionResult 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 GetCollaborateursByBusinessUnit(int businessUnitId) + //{ + // return CollaborateurRepository.GetCollaborateursByBusinessUnit(businessUnitId).Select(collaborateurSql => collaborateurSql.ToApi()); + //} + + //public IEnumerable 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(); + //} } } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/CollaborateurApiDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/CollaborateurApiDto.cs index eae4f66..aabbb3a 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/CollaborateurApiDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/CollaborateurApiDto.cs @@ -5,7 +5,7 @@ namespace espacecollab.backend.appservices.dtos { public class CollaborateurApiDto { - public Guid Id { get; set; } + public int Id { get; set; } public string Name { get; set; } public string FirstName { get; set; } public DateTime BirthDate { get; set; } @@ -17,15 +17,15 @@ namespace espacecollab.backend.appservices.dtos public string PersonalMail { get; set; } public string ApsideMail { get; set; } public DateTime ResignationDate { get; set; } - public Guid ReferrerId { get; set; } - public Guid BusinessUnitId { get; set; } + public int ReferrerId { get; set; } + public int BusinessUnitId { get; set; } 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; Name = name; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.appservices/CollaborateursServices.cs b/Collaborateur_Epa_Back/espacecollab.backend.appservices/CollaborateursServices.cs index df4d4b3..3eff512 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.appservices/CollaborateursServices.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.appservices/CollaborateursServices.cs @@ -21,7 +21,7 @@ namespace espacecollab.backend.appservices return CollaborateurRepository.GetAll().Select(collaborateurSql => collaborateurSql.ToApi()); } - public CollaborateurApiDto? GetCollaborateurById(Guid id) + public CollaborateurApiDto? GetCollaborateurById(int id) { return CollaborateurRepository.GetById(id)?.ToApi(); } @@ -44,45 +44,30 @@ namespace espacecollab.backend.appservices return collaborateurApi; } - //public new CollaborateurSqlDto? Delete(CollaborateurSqlDto entity) - //{ - // Collaborateurs.Remove(entity); - // return entity; - //} - - //public new IEnumerable GetAll() - //{ - // 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? GetCollaborateursByBusinessUnit(Guid businessUnitId) - //{ - // return Collaborateurs.Where(entity => entity.BusinessUnitId == businessUnitId).ToList(); - //} + public CollaborateurApiDto? UpdateCollaborateur(CollaborateurApiDto collaborateurApi) + { + CollaborateurSqlDto collaborateurSql = collaborateurApi.ToSql(); + if (collaborateurSql == null) + return null; + CollaborateurRepository.Update(collaborateurSql); + return collaborateurApi; + } + public IEnumerable GetCollaborateursByBusinessUnit(int businessUnitId) + { + return CollaborateurRepository.GetCollaborateursByBusinessUnit(businessUnitId).Select(collaborateurSql => collaborateurSql.ToApi()); + } - //public IList? GetCollaborateursByReferrer(Guid referrerId) - //{ - // return Collaborateurs.Where(entity => entity.ReferrerId == referrerId).ToList(); - //} + public IEnumerable GetCollaborateursByReferrer(int referrerId) + { + return CollaborateurRepository.GetCollaborateursByReferrer(referrerId).Select(collaborateurSql => collaborateurSql.ToApi()); + } - //public CollaborateurSqlDto? GetCollaborateurByApsideMail(string apsideMail) - //{ - // return Collaborateurs.FirstOrDefault(entity => entity.ApsideMail == apsideMail); - //} + public CollaborateurApiDto? GetCollaborateurByApsideMail(string apsideMail) + { + if (string.IsNullOrEmpty(apsideMail)) + return null; + return CollaborateurRepository.GetCollaborateurByApsideMail(apsideMail).ToApi(); + } } } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.appservices/GenericsServices.cs b/Collaborateur_Epa_Back/espacecollab.backend.appservices/GenericsServices.cs index 494ce31..99a4385 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.appservices/GenericsServices.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.appservices/GenericsServices.cs @@ -28,7 +28,7 @@ namespace espacecollab.backend.appservices // return GenericRepository.GetAll(); // } - // public To? GetById(Guid id) where T : class, IGenericSqlDto + // public To? GetById(int id) where T : class, IGenericSqlDto // { // T? entity = GenericRepository.GetById(id); // if (entity == null) diff --git a/Collaborateur_Epa_Back/espacecollab.backend.appservices/IGenericsServices.cs b/Collaborateur_Epa_Back/espacecollab.backend.appservices/IGenericsServices.cs index 90cff2b..443a80c 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.appservices/IGenericsServices.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.appservices/IGenericsServices.cs @@ -8,7 +8,7 @@ namespace espacecollab.backend.appservices IEnumerable GetAll(); - To? GetById(Guid id); + To? GetById(int id); To? Update(T entity); } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs index 42de69b..cbe1ccc 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/AgenceSqlDto.cs @@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class AgenceSqlDto : IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } public string Name { get; set; } [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; Name = name; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs index 0b055ff..4b20d4a 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/BusinessUnitSqlDto.cs @@ -4,9 +4,9 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class BusinessUnitSqlDto : IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } public string Name { get; set; } - public Guid AgenceId { get; set; } + public int AgenceId { get; set; } [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; Name = name; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurAppartientBusinessUnitSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurAppartientBusinessUnitSqlDto.cs index ff4beed..8eb40da 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurAppartientBusinessUnitSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurAppartientBusinessUnitSqlDto.cs @@ -4,8 +4,8 @@ namespace espacecollab.backend.infrastructure.sql.dtos.Associations { public class CollaborateurAppartientBusinessUnitSqlDto { - public Guid CollaborateurId { get; set; } - public Guid BusinessUnitId { get; set; } + public int CollaborateurId { get; set; } + public int BusinessUnitId { get; set; } [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; BusinessUnitId = businessUnitId; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurCollaboreProjetSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurCollaboreProjetSqlDto.cs index 2f9d323..0c61504 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurCollaboreProjetSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurCollaboreProjetSqlDto.cs @@ -4,8 +4,8 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class CollaborateurCollaboreProjetSqlDto { - public Guid CollaborateurId { get; set; } - public Guid ProjetId { get; set; } + public int CollaborateurId { get; set; } + public int ProjetId { get; set; } public bool IsManager { get; set; } [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; ProjetId = projetId; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurEstFonctionSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurEstFonctionSqlDto.cs index 705427d..a3cdd1a 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurEstFonctionSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurEstFonctionSqlDto.cs @@ -4,15 +4,15 @@ namespace espacecollab.backend.infrastructure.sql.dtos.Associations { public class CollaborateurEstFonctionSqlDto { - public Guid CollaborateurId { get; set; } - public Guid FonctionId { get; set; } + public int CollaborateurId { get; set; } + public int FonctionId { get; set; } [ExcludeFromCodeCoverage] private CollaborateurEstFonctionSqlDto() { } - public CollaborateurEstFonctionSqlDto(Guid collaborateurId, Guid fonctionId) + public CollaborateurEstFonctionSqlDto(int collaborateurId, int fonctionId) { CollaborateurId = collaborateurId; FonctionId = fonctionId; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs index 04dd16c..1ecd821 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/CollaborateurSqlDto.cs @@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class CollaborateurSqlDto : IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } public string Name { get; set; } public string FirstName { get; set; } public DateTime BirthDate { get; set; } @@ -16,15 +16,15 @@ namespace espacecollab.backend.infrastructure.sql.dtos public string PersonalMail { get; set; } public string ApsideMail { get; set; } public DateTime ResignationDate { get; set; } - public Guid ReferrerId { get; set; } - public Guid BusinessUnitId { get; set; } + public int ReferrerId { get; set; } + public int BusinessUnitId { get; set; } [ExcludeFromCodeCoverage] 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; Name = name; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs index 066eafe..db63bc9 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/FonctionSqlDto.cs @@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class FonctionSqlDto : IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } public string Name { get; set; } [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; Name = name; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/IGenericSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/IGenericSqlDto.cs index 6d34bb2..93547ed 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/IGenericSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/IGenericSqlDto.cs @@ -2,7 +2,7 @@ { public interface IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } } } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs index 7d0482a..110ccf7 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/PeriodeEssaiSqlDto.cs @@ -4,20 +4,20 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class PeriodeEssaiSqlDto : IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } public DateTime StartingDate { get; set; } public DateTime PlannedEndingDate { get; set; } public DateTime RealEndingDate { get; set; } public string Comment { get; set; } public EnumIssueSql Issue { get; set; } - public Guid CollaborateurId { get; set; } + public int CollaborateurId { get; set; } [ExcludeFromCodeCoverage] 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; StartingDate = startingDate; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs index 2ba06aa..2e93a0c 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetSqlDto.cs @@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class ProjetSqlDto : IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } public string Name { get; set; } public string Client { 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; Name = name; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetUtiliseTechnologieSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetUtiliseTechnologieSqlDto.cs index 513ce2d..b3ef497 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetUtiliseTechnologieSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ProjetUtiliseTechnologieSqlDto.cs @@ -4,15 +4,15 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class ProjetUtiliseTechnologieSqlDto { - public Guid ProjetId { get; set; } - public Guid TechnologieId { get; set; } + public int ProjetId { get; set; } + public int TechnologieId { get; set; } [ExcludeFromCodeCoverage] private ProjetUtiliseTechnologieSqlDto() { } - public ProjetUtiliseTechnologieSqlDto(Guid projetId, Guid technologieId) + public ProjetUtiliseTechnologieSqlDto(int projetId, int technologieId) { ProjetId = projetId; TechnologieId = technologieId; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs index a6fb391..d69163d 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/ReferencementSqlDto.cs @@ -4,18 +4,18 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class ReferencementSqlDto : IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } public DateTime StartingDate { get; set; } public DateTime EndingDate { get; set; } - public Guid ReferredId { get; set; } - public Guid ReferrerId { get; set; } + public int ReferredId { get; set; } + public int ReferrerId { get; set; } [ExcludeFromCodeCoverage] 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; StartingDate = startingDate; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteDeveloppeProjetSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteDeveloppeProjetSqlDto.cs index 1fe9942..44e4828 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteDeveloppeProjetSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteDeveloppeProjetSqlDto.cs @@ -4,15 +4,15 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class SiteDeveloppeProjetSqlDto { - public Guid SiteId { get; set; } - public Guid ProjetId { get; set; } + public int SiteId { get; set; } + public int ProjetId { get; set; } [ExcludeFromCodeCoverage] private SiteDeveloppeProjetSqlDto() { } - public SiteDeveloppeProjetSqlDto(Guid siteId, Guid projetId) + public SiteDeveloppeProjetSqlDto(int siteId, int projetId) { SiteId = siteId; ProjetId = projetId; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs index 08088fc..a59f867 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/SiteSqlDto.cs @@ -4,17 +4,17 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class SiteSqlDto : IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } public string Name { get; set; } public string Address { get; set; } - public Guid BusinessUnitId { get; set; } + public int BusinessUnitId { get; set; } [ExcludeFromCodeCoverage] private SiteSqlDto() { } - public SiteSqlDto(Guid id, string name, string address, Guid businessUnitId) + public SiteSqlDto(int id, string name, string address, int businessUnitId) { Id = id; Name = name; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs index e37f529..cf38ed6 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql.dtos/TechnologieSqlDto.cs @@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.dtos { public class TechnologieSqlDto : IGenericSqlDto { - public Guid Id { get; set; } + public int Id { get; set; } public string Name { get; set; } [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; Name = name; diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/FakeRepo/FakeCollaborateurRepository.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/FakeRepo/FakeCollaborateurRepository.cs index 99edec0..2a67ee1 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/FakeRepo/FakeCollaborateurRepository.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/FakeRepo/FakeCollaborateurRepository.cs @@ -16,17 +16,17 @@ namespace espacecollab.backend.infrastructure.sql.FakeRepo Collaborateurs = new List { - 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", - "jean.dupont@gmail.com", "jean.dupont@apside-groupe.com", new DateTime(2023, 12, 17), new Guid(), new Guid()), - new CollaborateurSqlDto(new Guid(), "Michel", "Laura", new DateTime(1985, 08, 12), + "jean.dupont@gmail.com", "jean.dupont@apside-groupe.com", new DateTime(2023, 12, 17), new int(), new int()), + new CollaborateurSqlDto(new int(), "Michel", "Laura", new DateTime(1985, 08, 12), 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 - public new CollaborateurSqlDto? GetById(Guid id) + public new CollaborateurSqlDto? GetById(int 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 - public IList? GetCollaborateursByBusinessUnit(Guid businessUnitId) + public IList GetCollaborateursByBusinessUnit(int businessUnitId) { return Collaborateurs.Where(entity => entity.BusinessUnitId == businessUnitId).ToList(); } - public IList? GetCollaborateursByReferrer(Guid referrerId) + public IList GetCollaborateursByReferrer(int referrerId) { 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); } } } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/CollaborateurRepository.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/CollaborateurRepository.cs index 2221b72..6c3f20f 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/CollaborateurRepository.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/CollaborateurRepository.cs @@ -12,10 +12,10 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo Context = context; } - public IList? GetCollaborateursByBusinessUnit(Guid businessUnitId) + public IList GetCollaborateursByBusinessUnit(int businessUnitId) => Context.Set().Where(collaborateur => collaborateur.BusinessUnitId == businessUnitId).ToList(); - public IList? GetCollaborateursByReferrer(Guid referrerId) + public IList GetCollaborateursByReferrer(int referrerId) => Context.Set().Where(collaborateur => collaborateur.ReferrerId == referrerId).ToList(); public CollaborateurSqlDto? GetCollaborateurByApsideMail(string apsideMail) diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/GenericRepository.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/GenericRepository.cs index 3ecb794..373b35d 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/GenericRepository.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/GenericRepository.cs @@ -32,7 +32,7 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo return Context.Set().ToList(); } - public virtual T? GetById(Guid id) + public virtual T? GetById(int id) { return Context.Set().FirstOrDefault(entity => entity.Id == id); } diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/ICollaborateurRepository.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/ICollaborateurRepository.cs index e3b0a26..3fef7b3 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/ICollaborateurRepository.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/ICollaborateurRepository.cs @@ -4,8 +4,8 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo.Interface { public interface ICollaborateurRepository : IGenericRepository { - CollaborateurSqlDto? GetCollaborateurByApsideMail(string apsideMail); - IList? GetCollaborateursByBusinessUnit(Guid businessUnitId); - IList? GetCollaborateursByReferrer(Guid referrerId); + CollaborateurSqlDto GetCollaborateurByApsideMail(string apsideMail); + IList GetCollaborateursByBusinessUnit(int businessUnitId); + IList GetCollaborateursByReferrer(int referrerId); } } \ No newline at end of file diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IGenericRepository.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IGenericRepository.cs index 56c76e1..d97622c 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IGenericRepository.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IGenericRepository.cs @@ -7,7 +7,7 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo.Interface T? Add(T entity); T? Delete(T entity); IEnumerable GetAll(); - T? GetById(Guid id); + T? GetById(int id); T? Update(T entity); diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IReferencementRepository.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IReferencementRepository.cs index 43810f3..28926ce 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IReferencementRepository.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/SqlRepo/Interface/IReferencementRepository.cs @@ -4,7 +4,7 @@ namespace espacecollab.backend.infrastructure.sql.SqlRepo.Interface { public interface IReferencementRepository { - IList? GetReferrersByCollaborateurId(Guid collaborateurId); + IList? GetReferrersByCollaborateurId(int collaborateurId); IList? GetReferrersByCollaborateurApsideMail(string apsideMail); //TODO Voir les attentes concernant "le référent ayant le plus suivi depuis une date"