diff --git a/Collaborateur_Epa_Back/espacecollab.backend.api/Controllers/TechnologiesController.cs b/Collaborateur_Epa_Back/espacecollab.backend.api/Controllers/TechnologiesController.cs new file mode 100644 index 0000000..cfd482e --- /dev/null +++ b/Collaborateur_Epa_Back/espacecollab.backend.api/Controllers/TechnologiesController.cs @@ -0,0 +1,12 @@ +using espacecollab.backend.appservices; +using espacecollab.backend.appservices.dtos; + +namespace espacecollab.backend.api.Controllers +{ + public class TechnologiesController : BaseController + { + public TechnologiesController(TechnologieServices technologieServices) : base(technologieServices) + { + } + } +} diff --git a/Collaborateur_Epa_Back/espacecollab.backend.api/Register.cs b/Collaborateur_Epa_Back/espacecollab.backend.api/Register.cs index 8012c98..97fbefd 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.api/Register.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.api/Register.cs @@ -16,6 +16,7 @@ internal static class Register services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); if (contextOptions.LoadFake) { @@ -29,6 +30,7 @@ internal static class Register services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); } } } \ No newline at end of file diff --git a/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/Mappers/TechnologieMapper.cs b/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/Mappers/TechnologieMapper.cs new file mode 100644 index 0000000..333fbdf --- /dev/null +++ b/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/Mappers/TechnologieMapper.cs @@ -0,0 +1,15 @@ +using espacecollab.backend.infrastructure.sql.dtos; + +namespace espacecollab.backend.appservices.dtos.Mappers; + +public static class TechnologieMapper +{ + public static TechnologieApiDto ToApi(this TechnologieSqlDto technologieSqlDto) + { + return new TechnologieApiDto((uint)technologieSqlDto.Id, technologieSqlDto.Name); + } + public static TechnologieSqlDto ToSql(this TechnologieApiDto technologieApiDto) + { + return new TechnologieSqlDto((int)technologieApiDto.Id, technologieApiDto.Name); + } +} \ No newline at end of file diff --git a/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/TechnologieApiDto.cs b/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/TechnologieApiDto.cs new file mode 100644 index 0000000..812cfe2 --- /dev/null +++ b/Collaborateur_Epa_Back/espacecollab.backend.appservices.dtos/TechnologieApiDto.cs @@ -0,0 +1,8 @@ +using espacecollab.backend.appservices.dtos.Interfaces; + +namespace espacecollab.backend.appservices.dtos; + +public record TechnologieApiDto(uint Id, string Name) : IGenericIdApiDto +{ + public uint Id { get; set; } = Id; +} \ No newline at end of file diff --git a/Collaborateur_Epa_Back/espacecollab.backend.appservices/TechnologieServices.cs b/Collaborateur_Epa_Back/espacecollab.backend.appservices/TechnologieServices.cs new file mode 100644 index 0000000..4c32415 --- /dev/null +++ b/Collaborateur_Epa_Back/espacecollab.backend.appservices/TechnologieServices.cs @@ -0,0 +1,14 @@ +using espacecollab.backend.appservices.dtos; +using espacecollab.backend.appservices.dtos.Mappers; +using espacecollab.backend.infrastructure.interfaces; +using espacecollab.backend.infrastructure.sql.dtos; + +namespace espacecollab.backend.appservices; + +public class TechnologieServices : GenericsServices +{ + public TechnologieServices(ITechnologieRepository technologieRepository) + :base(technologieRepository, TechnologieMapper.ToApi, TechnologieMapper.ToSql) + { + } +} \ No newline at end of file diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.interfaces/ITechnologieRepository.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.interfaces/ITechnologieRepository.cs new file mode 100644 index 0000000..1424cce --- /dev/null +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.interfaces/ITechnologieRepository.cs @@ -0,0 +1,8 @@ +using espacecollab.backend.infrastructure.sql.dtos; + +namespace espacecollab.backend.infrastructure.interfaces +{ + public interface ITechnologieRepository : IGenericRepository + { + } +} \ No newline at end of file diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/MainDbContext.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/MainDbContext.cs index ceb2e44..fed8d61 100644 --- a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/MainDbContext.cs +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/MainDbContext.cs @@ -11,6 +11,7 @@ namespace espacecollab.backend.infrastructure.sql private DbSet? Agence { get; set; } private DbSet? BusinessUnit { get; set; } private DbSet? Fonction { get; set; } + private DbSet? Technologie { get; set; } public MainDbContext(IOptions sqlSettings) { @@ -29,6 +30,7 @@ namespace espacecollab.backend.infrastructure.sql modelBuilder.Entity().Property(p => p.Id).UseMySqlIdentityColumn(); modelBuilder.Entity().Property(p => p.Id).UseMySqlIdentityColumn(); modelBuilder.Entity().Property(p => p.Id).UseMySqlIdentityColumn(); + modelBuilder.Entity().Property(p => p.Id).UseMySqlIdentityColumn(); modelBuilder.Entity().Property(p=> p.Id).UseMySqlIdentityColumn(); modelBuilder .Entity() diff --git a/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/Repository/TechnologieSqlRepository.cs b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/Repository/TechnologieSqlRepository.cs new file mode 100644 index 0000000..3a48499 --- /dev/null +++ b/Collaborateur_Epa_Back/espacecollab.backend.infrastructure.sql/Repository/TechnologieSqlRepository.cs @@ -0,0 +1,11 @@ +using espacecollab.backend.infrastructure.interfaces; +using espacecollab.backend.infrastructure.sql.dtos; + +namespace espacecollab.backend.infrastructure.sql.Repository; + +public class TechnologieSqlRepository : GenericSqlRepository, ITechnologieRepository +{ + public TechnologieSqlRepository(MainDbContext context) : base(context) + { + } +} \ No newline at end of file