Compare commits
No commits in common. "77d5d388bc9bc5f7091f20b09fe8a09977efe275" and "365bc98215a35f51ea326a2e9596428269480162" have entirely different histories.
77d5d388bc
...
365bc98215
18
.idea/.idea.ldap-cesi/.idea/dataSources.xml
generated
18
.idea/.idea.ldap-cesi/.idea/dataSources.xml
generated
@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
|
||||||
<data-source source="LOCAL" name="ldap@192.168.1.196" uuid="4416cc9a-9c84-4a37-8ec1-70323890f91e">
|
|
||||||
<driver-ref>postgresql</driver-ref>
|
|
||||||
<synchronize>true</synchronize>
|
|
||||||
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
|
|
||||||
<jdbc-url>jdbc:postgresql://192.168.1.196:5432/ldap</jdbc-url>
|
|
||||||
<jdbc-additional-properties>
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
|
||||||
</jdbc-additional-properties>
|
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
|
||||||
</data-source>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,19 +0,0 @@
|
|||||||
using ldap_cesi.Context;
|
|
||||||
using ldap_cesi.Entities;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace ldap_cesi.Configurations;
|
|
||||||
|
|
||||||
public static class Conf
|
|
||||||
{
|
|
||||||
public static void BuildConf(this WebApplicationBuilder builder)
|
|
||||||
{
|
|
||||||
builder.AddEFCoreConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddEFCoreConfiguration(this WebApplicationBuilder builder)
|
|
||||||
{
|
|
||||||
string connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
|
||||||
builder.Services.AddDbContext<PgContext>(options => options.UseNpgsql(connectionString));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,135 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using ldap_cesi.Entities;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace ldap_cesi.Context;
|
|
||||||
|
|
||||||
public partial class PgContext : DbContext
|
|
||||||
{
|
|
||||||
public PgContext()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public PgContext(DbContextOptions<PgContext> options)
|
|
||||||
: base(options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual DbSet<Role> Roles { get; set; }
|
|
||||||
|
|
||||||
public virtual DbSet<Salarie> Salaries { get; set; }
|
|
||||||
|
|
||||||
public virtual DbSet<Service> Services { get; set; }
|
|
||||||
|
|
||||||
public virtual DbSet<Site> Sites { get; set; }
|
|
||||||
|
|
||||||
public virtual DbSet<Utilisateur> Utilisateurs { get; set; }
|
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
||||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
|
||||||
=> optionsBuilder.UseNpgsql("Host=192.168.1.196;Database=ldap;Username=postgres;Password=pimer0-buzz");
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
modelBuilder.Entity<Role>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasKey(e => e.Id).HasName("role_pk");
|
|
||||||
|
|
||||||
entity.ToTable("role");
|
|
||||||
|
|
||||||
entity.Property(e => e.Id).HasColumnName("id");
|
|
||||||
entity.Property(e => e.Nom)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("nom");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<Salarie>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasKey(e => e.Id).HasName("salarie_pk");
|
|
||||||
|
|
||||||
entity.ToTable("salarie");
|
|
||||||
|
|
||||||
entity.Property(e => e.Id).HasColumnName("id");
|
|
||||||
entity.Property(e => e.Email)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("email");
|
|
||||||
entity.Property(e => e.IdService).HasColumnName("id_service");
|
|
||||||
entity.Property(e => e.IdSite).HasColumnName("id_site");
|
|
||||||
entity.Property(e => e.Nom)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("nom");
|
|
||||||
entity.Property(e => e.Prenom)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("prenom");
|
|
||||||
entity.Property(e => e.TelephoneFixe)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("telephone_fixe");
|
|
||||||
entity.Property(e => e.TelephonePortable)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("telephone_portable");
|
|
||||||
|
|
||||||
entity.HasOne(d => d.IdServiceNavigation).WithMany(p => p.Salaries)
|
|
||||||
.HasForeignKey(d => d.IdService)
|
|
||||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
|
||||||
.HasConstraintName("salarie_service0_fk");
|
|
||||||
|
|
||||||
entity.HasOne(d => d.IdSiteNavigation).WithMany(p => p.Salaries)
|
|
||||||
.HasForeignKey(d => d.IdSite)
|
|
||||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
|
||||||
.HasConstraintName("salarie_site_fk");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<Service>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasKey(e => e.Id).HasName("service_pk");
|
|
||||||
|
|
||||||
entity.ToTable("service");
|
|
||||||
|
|
||||||
entity.Property(e => e.Id).HasColumnName("id");
|
|
||||||
entity.Property(e => e.Nom)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("nom");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<Site>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasKey(e => e.Id).HasName("site_pk");
|
|
||||||
|
|
||||||
entity.ToTable("site");
|
|
||||||
|
|
||||||
entity.Property(e => e.Id).HasColumnName("id");
|
|
||||||
entity.Property(e => e.Ville)
|
|
||||||
.HasMaxLength(150)
|
|
||||||
.HasColumnName("ville");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity<Utilisateur>(entity =>
|
|
||||||
{
|
|
||||||
entity.HasKey(e => e.Id).HasName("utilisateur_pk");
|
|
||||||
|
|
||||||
entity.ToTable("utilisateur");
|
|
||||||
|
|
||||||
entity.Property(e => e.Id).HasColumnName("id");
|
|
||||||
entity.Property(e => e.IdRole).HasColumnName("id_role");
|
|
||||||
entity.Property(e => e.MotDePasse)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("mot_de_passe");
|
|
||||||
entity.Property(e => e.Nom)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("nom");
|
|
||||||
entity.Property(e => e.Prenom)
|
|
||||||
.HasMaxLength(50)
|
|
||||||
.HasColumnName("prenom");
|
|
||||||
|
|
||||||
entity.HasOne(d => d.IdRoleNavigation).WithMany(p => p.Utilisateurs)
|
|
||||||
.HasForeignKey(d => d.IdRole)
|
|
||||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
|
||||||
.HasConstraintName("utilisateur_role_fk");
|
|
||||||
});
|
|
||||||
|
|
||||||
OnModelCreatingPartial(modelBuilder);
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace ldap_cesi.Entities;
|
|
||||||
|
|
||||||
public partial class Role
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public string Nom { get; set; } = null!;
|
|
||||||
|
|
||||||
public virtual ICollection<Utilisateur> Utilisateurs { get; set; } = new List<Utilisateur>();
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace ldap_cesi.Entities;
|
|
||||||
|
|
||||||
public partial class Salarie
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public string Nom { get; set; } = null!;
|
|
||||||
|
|
||||||
public string Prenom { get; set; } = null!;
|
|
||||||
|
|
||||||
public string TelephoneFixe { get; set; } = null!;
|
|
||||||
|
|
||||||
public string TelephonePortable { get; set; } = null!;
|
|
||||||
|
|
||||||
public string Email { get; set; } = null!;
|
|
||||||
|
|
||||||
public int IdSite { get; set; }
|
|
||||||
|
|
||||||
public int IdService { get; set; }
|
|
||||||
|
|
||||||
public virtual Service IdServiceNavigation { get; set; } = null!;
|
|
||||||
|
|
||||||
public virtual Site IdSiteNavigation { get; set; } = null!;
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace ldap_cesi.Entities;
|
|
||||||
|
|
||||||
public partial class Service
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public string Nom { get; set; } = null!;
|
|
||||||
|
|
||||||
public virtual ICollection<Salarie> Salaries { get; set; } = new List<Salarie>();
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace ldap_cesi.Entities;
|
|
||||||
|
|
||||||
public partial class Site
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public string? Ville { get; set; }
|
|
||||||
|
|
||||||
public virtual ICollection<Salarie> Salaries { get; set; } = new List<Salarie>();
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace ldap_cesi.Entities;
|
|
||||||
|
|
||||||
public partial class Utilisateur
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public string? Nom { get; set; }
|
|
||||||
|
|
||||||
public string? Prenom { get; set; }
|
|
||||||
|
|
||||||
public string? MotDePasse { get; set; }
|
|
||||||
|
|
||||||
public int IdRole { get; set; }
|
|
||||||
|
|
||||||
public virtual Role IdRoleNavigation { get; set; } = null!;
|
|
||||||
}
|
|
@ -1,8 +1,7 @@
|
|||||||
using ldap_cesi.Configurations;
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
builder.BuildConf();
|
// Add services to the container.
|
||||||
|
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
||||||
builder.Services.AddOpenApi();
|
builder.Services.AddOpenApi();
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
@ -15,4 +14,28 @@ if (app.Environment.IsDevelopment())
|
|||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
var summaries = new[]
|
||||||
|
{
|
||||||
|
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||||
|
};
|
||||||
|
|
||||||
|
app.MapGet("/weatherforecast", () =>
|
||||||
|
{
|
||||||
|
var forecast = Enumerable.Range(1, 5).Select(index =>
|
||||||
|
new WeatherForecast
|
||||||
|
(
|
||||||
|
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||||
|
Random.Shared.Next(-20, 55),
|
||||||
|
summaries[Random.Shared.Next(summaries.Length)]
|
||||||
|
))
|
||||||
|
.ToArray();
|
||||||
|
return forecast;
|
||||||
|
})
|
||||||
|
.WithName("GetWeatherForecast");
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
|
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
|
||||||
|
{
|
||||||
|
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||||
|
}
|
@ -8,28 +8,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
|
||||||
<PackageReference Include="BCrypt" Version="1.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.2"/>
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.2"/>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.2">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.0-preview.1.25081.1">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
|
|
||||||
<PackageReference Include="OpenAI" Version="2.2.0-beta.2" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Controllers\" />
|
|
||||||
<Folder Include="Entities\" />
|
|
||||||
<Folder Include="Mapper\" />
|
|
||||||
<Folder Include="Repository\" />
|
|
||||||
<Folder Include="Services\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user