pull/13/head
Clement FERRERE 3 years ago
parent fc255f0709
commit a97d30e3d8
  1. 4
      Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/CollaborateurApiDto.cs
  2. 8
      Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/Mappers/CollaborateurMapper.cs
  3. 4
      Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/Mappers/ReferencementMapper.cs
  4. 2
      Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/ReferencementApiDto.cs
  5. 12
      Collaborateur_Epa_Back/espacecollab.backend.infrastructure.fake/FakeCollaborateurRepository.cs

@ -3,8 +3,8 @@ using espacecollab.backend.appservices.dtos.Values;
namespace espacecollab.backend.appservices.dtos; namespace espacecollab.backend.appservices.dtos;
public record CollaborateurApiDto(uint Id, string Name, string FirstName, DateTime BirthDate, EnumGenreApi Gender, EnumStatutApi Status, int ChildrenNumber, string Address, public record CollaborateurApiDto(uint Id, string Name, string FirstName, DateTime BirthDate, EnumGenreApi Gender, EnumStatutApi Status, uint ChildrenNumber, string Address,
string Telephone, string PersonalMail, string ApsideMail, DateTime? ResignationDate, int BusinessUnitId) : IGenericIdApiDto string Telephone, string PersonalMail, string ApsideMail, DateTime? ResignationDate, uint BusinessUnitId) : IGenericIdApiDto
{ {
public uint Id { get; set; } = Id; public uint Id { get; set; } = Id;
} }

@ -7,16 +7,16 @@ public static class CollaborateurMapper
public static CollaborateurApiDto ToApi(this CollaborateurSqlDto collaborateurSql) public static CollaborateurApiDto ToApi(this CollaborateurSqlDto collaborateurSql)
{ {
return new CollaborateurApiDto((uint)collaborateurSql.Id, collaborateurSql.Name, collaborateurSql.FirstName, return new CollaborateurApiDto((uint)collaborateurSql.Id, collaborateurSql.Name, collaborateurSql.FirstName,
collaborateurSql.BirthDate, collaborateurSql.Gender.ToEnumGenreApi(), collaborateurSql.Status.ToEnumStatutApi(), collaborateurSql.ChildrenNumber, collaborateurSql.BirthDate, collaborateurSql.Gender.ToEnumGenreApi(), collaborateurSql.Status.ToEnumStatutApi(), (uint)collaborateurSql.ChildrenNumber,
collaborateurSql.Address, collaborateurSql.Telephone, collaborateurSql.PersonalMail, collaborateurSql.ApsideMail, collaborateurSql.Address, collaborateurSql.Telephone, collaborateurSql.PersonalMail, collaborateurSql.ApsideMail,
collaborateurSql.ResignationDate, collaborateurSql.BusinessUnitId); collaborateurSql.ResignationDate, (uint)collaborateurSql.BusinessUnitId);
} }
public static CollaborateurSqlDto ToSql(this CollaborateurApiDto collaborateurApi) public static CollaborateurSqlDto ToSql(this CollaborateurApiDto collaborateurApi)
{ {
return new CollaborateurSqlDto((int)collaborateurApi.Id, collaborateurApi.Name, collaborateurApi.FirstName, return new CollaborateurSqlDto((int)collaborateurApi.Id, collaborateurApi.Name, collaborateurApi.FirstName,
collaborateurApi.BirthDate, collaborateurApi.Gender.ToEnumGenreSql(), collaborateurApi.Status.ToEnumStatutSql(), collaborateurApi.ChildrenNumber, collaborateurApi.BirthDate, collaborateurApi.Gender.ToEnumGenreSql(), collaborateurApi.Status.ToEnumStatutSql(), (int)collaborateurApi.ChildrenNumber,
collaborateurApi.Address, collaborateurApi.Telephone, collaborateurApi.PersonalMail, collaborateurApi.ApsideMail, collaborateurApi.Address, collaborateurApi.Telephone, collaborateurApi.PersonalMail, collaborateurApi.ApsideMail,
collaborateurApi.ResignationDate, collaborateurApi.BusinessUnitId); collaborateurApi.ResignationDate, (int)collaborateurApi.BusinessUnitId);
} }
} }

@ -6,10 +6,10 @@ public static class ReferencementMapper
{ {
public static ReferencementApiDto ToApi(this ReferencementSqlDto referencementSqlDto) public static ReferencementApiDto ToApi(this ReferencementSqlDto referencementSqlDto)
{ {
return new ReferencementApiDto((uint)referencementSqlDto.Id, referencementSqlDto.StartingDate,referencementSqlDto.EndingDate,referencementSqlDto.ReferredId, referencementSqlDto.ReferrerId); return new ReferencementApiDto((uint)referencementSqlDto.Id, referencementSqlDto.StartingDate,referencementSqlDto.EndingDate,(uint)referencementSqlDto.ReferredId, (uint)referencementSqlDto.ReferrerId);
} }
public static ReferencementSqlDto ToSql(this ReferencementApiDto referencementApiDto) public static ReferencementSqlDto ToSql(this ReferencementApiDto referencementApiDto)
{ {
return new ReferencementSqlDto((int)referencementApiDto.Id, referencementApiDto.StartingDate, referencementApiDto.EndingDate, referencementApiDto.ReferredId, referencementApiDto.ReferrerId); return new ReferencementSqlDto((int)referencementApiDto.Id, referencementApiDto.StartingDate, referencementApiDto.EndingDate, (int)referencementApiDto.ReferredId, (int)referencementApiDto.ReferrerId);
} }
} }

@ -6,7 +6,7 @@ using espacecollab.backend.infrastructure.sql.dtos.Interfaces;
namespace espacecollab.backend.appservices.dtos; namespace espacecollab.backend.appservices.dtos;
public record ReferencementApiDto(uint Id, DateTime StartingDate, DateTime? EndingDate, int ReferredId, int ReferrerId) : IGenericIdApiDto public record ReferencementApiDto(uint Id, DateTime StartingDate, DateTime? EndingDate, uint ReferredId, uint ReferrerId) : IGenericIdApiDto
{ {
public uint Id { get; set; } = Id; public uint Id { get; set; } = Id;
} }

@ -10,12 +10,12 @@ public class FakeCollaborateurRepository : GenericFakeRepository<CollaborateurSq
{ {
Context = new List<CollaborateurSqlDto> Context = new List<CollaborateurSqlDto>
{ {
//new(1, "Dupont", "Jean", new DateTime(1980, 12, 10), new(1, "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), 2, 1), "jean.dupont@gmail.com", "jean.dupont@apside-groupe.com", new DateTime(2023, 12, 17), 1),
//new(2, "Michel", "Laura", new DateTime(1985, 08, 12), new(2, "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), 1, 1) "laura.michel@gmail.com", "laura.michel@apside-groupe.com", new DateTime(2023, 12, 17), 1)
}; };
} }

Loading…
Cancel
Save