SchotzIAD KM Tracker : suivi des trajets kilométriques (Angular + .NET 8)
Application complète de saisie et de suivi des trajets kilométriques avec calcul de distance routière (OpenRouteService), barème kilométrique, résumés et régularisation annuelle. Backend (ASP.NET Core .NET 8, EF Core, SQLite) : - Trajets (CRUD, réordonnancement, insertion), calcul de distance ORS avec fallback Haversine, géométrie d'itinéraire stockée par trajet, recalcul en masse. - Profil, véhicules (avec dénomination), carnet d'adresses nommées, cache d'adresses. - Barème kilométrique : tranches multiples par puissance fiscale, borne max exclusive avec 'illimité' (KmMax nullable), coefficient à 3 décimales, recopie du dernier barème connu. - Résumés mensuel/annuel, montants réglés, régularisation, export PDF. Frontend (Angular 22, zoneless + signals) : - Consultation par jour, navigation temporelle synchronisée, carte Leaflet, formulaire de trajet (adresses nommées, domicile, autocomplétion BAN). - Détection de changement zoneless (indépendante de zone.js). Hébergement : Docker Compose (nginx + backend), scripts run-dev.sh / run-docker.sh.
This commit is contained in:
+325
@@ -0,0 +1,325 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TrajetKmTracker.Api.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260913083053_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DerniereUtilisation")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Adresse")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdresseCache", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseNommee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DenominationNormalisee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("GeocodageReussi")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DenominationNormalisee" }, "UX_AdresseNommee_Denomination")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdressesNommees", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Mois")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Montant")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehiculeId");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "Mois", "VehiculeId" }, "UX_MontantsRegles_Periode_Vehicule")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MontantsRegles", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
||||
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Profil", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseDomicile")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("DomicileGeocode")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("DomicileLatitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("DomicileLongitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Matricule")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Prenom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Id" }, "UX_Profil_Singleton")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Profil", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseArrivee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("AdresseDepart")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Commentaire")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Distance")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Position")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Date" }, "IX_Trajets_Date");
|
||||
|
||||
b.HasIndex(new[] { "Date", "Position" }, "IX_Trajets_Date_Position");
|
||||
|
||||
b.HasIndex(new[] { "VehiculeId" }, "IX_Trajets_Vehicule");
|
||||
|
||||
b.ToTable("Trajets", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Trajets_Distance", "\"Distance\" > 0");
|
||||
|
||||
t.HasCheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.TrancheBareme", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Base")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Coefficient")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMax")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMin")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "PuissanceFiscale" }, "IX_TranchesBareme_Annee_PF");
|
||||
|
||||
b.ToTable("TranchesBareme", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_TranchesBareme_Km", "\"KmMin\" <= \"KmMax\"");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("DateEffet")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Plaque")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DateEffet" }, "IX_Vehicules_DateEffet");
|
||||
|
||||
b.ToTable("Vehicules", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany("Trajets")
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Navigation("Trajets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AdresseCache",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Adresse = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
||||
Latitude = table.Column<double>(type: "REAL", nullable: false),
|
||||
Longitude = table.Column<double>(type: "REAL", nullable: false),
|
||||
GeometrieJson = table.Column<string>(type: "TEXT", nullable: true),
|
||||
DerniereUtilisation = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AdresseCache", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AdressesNommees",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Denomination = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
||||
DenominationNormalisee = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
||||
Adresse = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
||||
Latitude = table.Column<double>(type: "REAL", nullable: true),
|
||||
Longitude = table.Column<double>(type: "REAL", nullable: true),
|
||||
GeocodageReussi = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AdressesNommees", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Profil",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Nom = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
||||
Prenom = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
||||
Matricule = table.Column<string>(type: "TEXT", maxLength: 8, nullable: true),
|
||||
AdresseDomicile = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
|
||||
DomicileLatitude = table.Column<double>(type: "REAL", nullable: true),
|
||||
DomicileLongitude = table.Column<double>(type: "REAL", nullable: true),
|
||||
DomicileGeocode = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Profil", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TranchesBareme",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Annee = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
PuissanceFiscale = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
KmMin = table.Column<decimal>(type: "TEXT", nullable: false),
|
||||
KmMax = table.Column<decimal>(type: "TEXT", nullable: false),
|
||||
Coefficient = table.Column<decimal>(type: "TEXT", nullable: false),
|
||||
Base = table.Column<decimal>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TranchesBareme", x => x.Id);
|
||||
table.CheckConstraint("CK_TranchesBareme_Km", "\"KmMin\" <= \"KmMax\"");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Vehicules",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Plaque = table.Column<string>(type: "TEXT", maxLength: 15, nullable: false),
|
||||
PuissanceFiscale = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
DateEffet = table.Column<DateOnly>(type: "TEXT", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Vehicules", x => x.Id);
|
||||
table.CheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MontantsRegles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Annee = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Mois = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
VehiculeId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Montant = table.Column<decimal>(type: "TEXT", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MontantsRegles", x => x.Id);
|
||||
table.CheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
||||
table.CheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
||||
table.ForeignKey(
|
||||
name: "FK_MontantsRegles_Vehicules_VehiculeId",
|
||||
column: x => x.VehiculeId,
|
||||
principalTable: "Vehicules",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Trajets",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Date = table.Column<DateOnly>(type: "TEXT", nullable: false),
|
||||
AdresseDepart = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
||||
AdresseArrivee = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
||||
Distance = table.Column<decimal>(type: "TEXT", nullable: false),
|
||||
Commentaire = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
|
||||
Position = table.Column<decimal>(type: "TEXT", nullable: false),
|
||||
VehiculeId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
PuissanceFiscale = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Trajets", x => x.Id);
|
||||
table.CheckConstraint("CK_Trajets_Distance", "\"Distance\" > 0");
|
||||
table.CheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
table.ForeignKey(
|
||||
name: "FK_Trajets_Vehicules_VehiculeId",
|
||||
column: x => x.VehiculeId,
|
||||
principalTable: "Vehicules",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AdresseCache_Adresse",
|
||||
table: "AdresseCache",
|
||||
column: "Adresse",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UX_AdresseNommee_Denomination",
|
||||
table: "AdressesNommees",
|
||||
column: "DenominationNormalisee",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MontantsRegles_VehiculeId",
|
||||
table: "MontantsRegles",
|
||||
column: "VehiculeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UX_MontantsRegles_Periode_Vehicule",
|
||||
table: "MontantsRegles",
|
||||
columns: new[] { "Annee", "Mois", "VehiculeId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UX_Profil_Singleton",
|
||||
table: "Profil",
|
||||
column: "Id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Trajets_Date",
|
||||
table: "Trajets",
|
||||
column: "Date");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Trajets_Date_Position",
|
||||
table: "Trajets",
|
||||
columns: new[] { "Date", "Position" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Trajets_Vehicule",
|
||||
table: "Trajets",
|
||||
column: "VehiculeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TranchesBareme_Annee_PF",
|
||||
table: "TranchesBareme",
|
||||
columns: new[] { "Annee", "PuissanceFiscale" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Vehicules_DateEffet",
|
||||
table: "Vehicules",
|
||||
column: "DateEffet");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AdresseCache");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AdressesNommees");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MontantsRegles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Profil");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Trajets");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TranchesBareme");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Vehicules");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+325
@@ -0,0 +1,325 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TrajetKmTracker.Api.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260913085051_TrajetDistanceNullable")]
|
||||
partial class TrajetDistanceNullable
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DerniereUtilisation")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Adresse")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdresseCache", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseNommee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DenominationNormalisee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("GeocodageReussi")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DenominationNormalisee" }, "UX_AdresseNommee_Denomination")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdressesNommees", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Mois")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Montant")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehiculeId");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "Mois", "VehiculeId" }, "UX_MontantsRegles_Periode_Vehicule")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MontantsRegles", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
||||
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Profil", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseDomicile")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("DomicileGeocode")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("DomicileLatitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("DomicileLongitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Matricule")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Prenom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Id" }, "UX_Profil_Singleton")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Profil", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseArrivee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("AdresseDepart")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Commentaire")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("Distance")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Position")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Date" }, "IX_Trajets_Date");
|
||||
|
||||
b.HasIndex(new[] { "Date", "Position" }, "IX_Trajets_Date_Position");
|
||||
|
||||
b.HasIndex(new[] { "VehiculeId" }, "IX_Trajets_Vehicule");
|
||||
|
||||
b.ToTable("Trajets", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Trajets_Distance", "\"Distance\" IS NULL OR \"Distance\" > 0");
|
||||
|
||||
t.HasCheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.TrancheBareme", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Base")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Coefficient")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMax")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMin")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "PuissanceFiscale" }, "IX_TranchesBareme_Annee_PF");
|
||||
|
||||
b.ToTable("TranchesBareme", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_TranchesBareme_Km", "\"KmMin\" <= \"KmMax\"");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("DateEffet")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Plaque")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DateEffet" }, "IX_Vehicules_DateEffet");
|
||||
|
||||
b.ToTable("Vehicules", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany("Trajets")
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Navigation("Trajets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TrajetDistanceNullable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropCheckConstraint(
|
||||
name: "CK_Trajets_Distance",
|
||||
table: "Trajets");
|
||||
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "Distance",
|
||||
table: "Trajets",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "TEXT");
|
||||
|
||||
migrationBuilder.AddCheckConstraint(
|
||||
name: "CK_Trajets_Distance",
|
||||
table: "Trajets",
|
||||
sql: "\"Distance\" IS NULL OR \"Distance\" > 0");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropCheckConstraint(
|
||||
name: "CK_Trajets_Distance",
|
||||
table: "Trajets");
|
||||
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "Distance",
|
||||
table: "Trajets",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: 0m,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "TEXT",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddCheckConstraint(
|
||||
name: "CK_Trajets_Distance",
|
||||
table: "Trajets",
|
||||
sql: "\"Distance\" > 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+328
@@ -0,0 +1,328 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TrajetKmTracker.Api.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260913224032_TrajetGeometrieJson")]
|
||||
partial class TrajetGeometrieJson
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DerniereUtilisation")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Adresse")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdresseCache", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseNommee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DenominationNormalisee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("GeocodageReussi")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DenominationNormalisee" }, "UX_AdresseNommee_Denomination")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdressesNommees", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Mois")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Montant")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehiculeId");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "Mois", "VehiculeId" }, "UX_MontantsRegles_Periode_Vehicule")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MontantsRegles", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
||||
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Profil", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseDomicile")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("DomicileGeocode")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("DomicileLatitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("DomicileLongitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Matricule")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Prenom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Id" }, "UX_Profil_Singleton")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Profil", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseArrivee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("AdresseDepart")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Commentaire")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("Distance")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Position")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Date" }, "IX_Trajets_Date");
|
||||
|
||||
b.HasIndex(new[] { "Date", "Position" }, "IX_Trajets_Date_Position");
|
||||
|
||||
b.HasIndex(new[] { "VehiculeId" }, "IX_Trajets_Vehicule");
|
||||
|
||||
b.ToTable("Trajets", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Trajets_Distance", "\"Distance\" IS NULL OR \"Distance\" > 0");
|
||||
|
||||
t.HasCheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.TrancheBareme", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Base")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Coefficient")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMax")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMin")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "PuissanceFiscale" }, "IX_TranchesBareme_Annee_PF");
|
||||
|
||||
b.ToTable("TranchesBareme", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_TranchesBareme_Km", "\"KmMin\" <= \"KmMax\"");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("DateEffet")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Plaque")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DateEffet" }, "IX_Vehicules_DateEffet");
|
||||
|
||||
b.ToTable("Vehicules", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany("Trajets")
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Navigation("Trajets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TrajetGeometrieJson : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "GeometrieJson",
|
||||
table: "Trajets",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GeometrieJson",
|
||||
table: "Trajets");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+333
@@ -0,0 +1,333 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TrajetKmTracker.Api.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260913231424_VehiculeDenomination")]
|
||||
partial class VehiculeDenomination
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DerniereUtilisation")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Adresse")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdresseCache", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseNommee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DenominationNormalisee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("GeocodageReussi")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DenominationNormalisee" }, "UX_AdresseNommee_Denomination")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdressesNommees", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Mois")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Montant")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehiculeId");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "Mois", "VehiculeId" }, "UX_MontantsRegles_Periode_Vehicule")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MontantsRegles", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
||||
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Profil", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseDomicile")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("DomicileGeocode")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("DomicileLatitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("DomicileLongitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Matricule")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Prenom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Id" }, "UX_Profil_Singleton")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Profil", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseArrivee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("AdresseDepart")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Commentaire")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("Distance")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Position")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Date" }, "IX_Trajets_Date");
|
||||
|
||||
b.HasIndex(new[] { "Date", "Position" }, "IX_Trajets_Date_Position");
|
||||
|
||||
b.HasIndex(new[] { "VehiculeId" }, "IX_Trajets_Vehicule");
|
||||
|
||||
b.ToTable("Trajets", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Trajets_Distance", "\"Distance\" IS NULL OR \"Distance\" > 0");
|
||||
|
||||
t.HasCheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.TrancheBareme", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Base")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Coefficient")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMax")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMin")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "PuissanceFiscale" }, "IX_TranchesBareme_Annee_PF");
|
||||
|
||||
b.ToTable("TranchesBareme", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_TranchesBareme_Km", "\"KmMin\" <= \"KmMax\"");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("DateEffet")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Plaque")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DateEffet" }, "IX_Vehicules_DateEffet");
|
||||
|
||||
b.ToTable("Vehicules", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany("Trajets")
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Navigation("Trajets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class VehiculeDenomination : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Denomination",
|
||||
table: "Vehicules",
|
||||
type: "TEXT",
|
||||
maxLength: 100,
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
// Véhicules déjà existants : dénomination par défaut = leur plaque, pour éviter
|
||||
// une dénomination vide (le champ est désormais obligatoire côté saisie).
|
||||
migrationBuilder.Sql(
|
||||
"UPDATE \"Vehicules\" SET \"Denomination\" = \"Plaque\" " +
|
||||
"WHERE \"Denomination\" IS NULL OR \"Denomination\" = '';");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Denomination",
|
||||
table: "Vehicules");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+333
@@ -0,0 +1,333 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TrajetKmTracker.Api.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260913233718_TrancheBaremeKmMaxNullable")]
|
||||
partial class TrancheBaremeKmMaxNullable
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DerniereUtilisation")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Adresse")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdresseCache", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseNommee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DenominationNormalisee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("GeocodageReussi")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DenominationNormalisee" }, "UX_AdresseNommee_Denomination")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdressesNommees", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Mois")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Montant")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehiculeId");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "Mois", "VehiculeId" }, "UX_MontantsRegles_Periode_Vehicule")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MontantsRegles", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
||||
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Profil", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseDomicile")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("DomicileGeocode")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("DomicileLatitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("DomicileLongitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Matricule")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Prenom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Id" }, "UX_Profil_Singleton")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Profil", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseArrivee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("AdresseDepart")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Commentaire")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("Distance")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Position")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Date" }, "IX_Trajets_Date");
|
||||
|
||||
b.HasIndex(new[] { "Date", "Position" }, "IX_Trajets_Date_Position");
|
||||
|
||||
b.HasIndex(new[] { "VehiculeId" }, "IX_Trajets_Vehicule");
|
||||
|
||||
b.ToTable("Trajets", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Trajets_Distance", "\"Distance\" IS NULL OR \"Distance\" > 0");
|
||||
|
||||
t.HasCheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.TrancheBareme", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Base")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Coefficient")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("KmMax")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMin")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "PuissanceFiscale" }, "IX_TranchesBareme_Annee_PF");
|
||||
|
||||
b.ToTable("TranchesBareme", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_TranchesBareme_Km", "\"KmMin\" <= \"KmMax\"");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("DateEffet")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Plaque")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DateEffet" }, "IX_Vehicules_DateEffet");
|
||||
|
||||
b.ToTable("Vehicules", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany("Trajets")
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Navigation("Trajets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TrancheBaremeKmMaxNullable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "KmMax",
|
||||
table: "TranchesBareme",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "TEXT");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<decimal>(
|
||||
name: "KmMax",
|
||||
table: "TranchesBareme",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: 0m,
|
||||
oldClrType: typeof(decimal),
|
||||
oldType: "TEXT",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+333
@@ -0,0 +1,333 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TrajetKmTracker.Api.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260913234022_TrancheBaremeKmCheckExclusif")]
|
||||
partial class TrancheBaremeKmCheckExclusif
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DerniereUtilisation")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Adresse")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdresseCache", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseNommee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DenominationNormalisee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("GeocodageReussi")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DenominationNormalisee" }, "UX_AdresseNommee_Denomination")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdressesNommees", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Mois")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Montant")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehiculeId");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "Mois", "VehiculeId" }, "UX_MontantsRegles_Periode_Vehicule")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MontantsRegles", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
||||
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Profil", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseDomicile")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("DomicileGeocode")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("DomicileLatitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("DomicileLongitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Matricule")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Prenom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Id" }, "UX_Profil_Singleton")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Profil", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseArrivee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("AdresseDepart")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Commentaire")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("Distance")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Position")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Date" }, "IX_Trajets_Date");
|
||||
|
||||
b.HasIndex(new[] { "Date", "Position" }, "IX_Trajets_Date_Position");
|
||||
|
||||
b.HasIndex(new[] { "VehiculeId" }, "IX_Trajets_Vehicule");
|
||||
|
||||
b.ToTable("Trajets", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Trajets_Distance", "\"Distance\" IS NULL OR \"Distance\" > 0");
|
||||
|
||||
t.HasCheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.TrancheBareme", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Base")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Coefficient")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("KmMax")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMin")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "PuissanceFiscale" }, "IX_TranchesBareme_Annee_PF");
|
||||
|
||||
b.ToTable("TranchesBareme", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_TranchesBareme_Km", "\"KmMax\" IS NULL OR \"KmMin\" < \"KmMax\"");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("DateEffet")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Plaque")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DateEffet" }, "IX_Vehicules_DateEffet");
|
||||
|
||||
b.ToTable("Vehicules", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany("Trajets")
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Navigation("Trajets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TrancheBaremeKmCheckExclusif : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropCheckConstraint(
|
||||
name: "CK_TranchesBareme_Km",
|
||||
table: "TranchesBareme");
|
||||
|
||||
migrationBuilder.AddCheckConstraint(
|
||||
name: "CK_TranchesBareme_Km",
|
||||
table: "TranchesBareme",
|
||||
sql: "\"KmMax\" IS NULL OR \"KmMin\" < \"KmMax\"");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropCheckConstraint(
|
||||
name: "CK_TranchesBareme_Km",
|
||||
table: "TranchesBareme");
|
||||
|
||||
migrationBuilder.AddCheckConstraint(
|
||||
name: "CK_TranchesBareme_Km",
|
||||
table: "TranchesBareme",
|
||||
sql: "\"KmMin\" <= \"KmMax\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
backend/TrajetKmTracker.Api/Data/Migrations/20260913234153_TrancheBaremeKmCheckNumerique.Designer.cs
Generated
+333
@@ -0,0 +1,333 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TrajetKmTracker.Api.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260913234153_TrancheBaremeKmCheckNumerique")]
|
||||
partial class TrancheBaremeKmCheckNumerique
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DerniereUtilisation")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Adresse")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdresseCache", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseNommee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DenominationNormalisee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("GeocodageReussi")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DenominationNormalisee" }, "UX_AdresseNommee_Denomination")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdressesNommees", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Mois")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Montant")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehiculeId");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "Mois", "VehiculeId" }, "UX_MontantsRegles_Periode_Vehicule")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MontantsRegles", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
||||
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Profil", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseDomicile")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("DomicileGeocode")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("DomicileLatitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("DomicileLongitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Matricule")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Prenom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Id" }, "UX_Profil_Singleton")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Profil", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseArrivee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("AdresseDepart")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Commentaire")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("Distance")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Position")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Date" }, "IX_Trajets_Date");
|
||||
|
||||
b.HasIndex(new[] { "Date", "Position" }, "IX_Trajets_Date_Position");
|
||||
|
||||
b.HasIndex(new[] { "VehiculeId" }, "IX_Trajets_Vehicule");
|
||||
|
||||
b.ToTable("Trajets", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Trajets_Distance", "\"Distance\" IS NULL OR \"Distance\" > 0");
|
||||
|
||||
t.HasCheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.TrancheBareme", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Base")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Coefficient")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("KmMax")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMin")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "PuissanceFiscale" }, "IX_TranchesBareme_Annee_PF");
|
||||
|
||||
b.ToTable("TranchesBareme", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_TranchesBareme_Km", "\"KmMax\" IS NULL OR CAST(\"KmMin\" AS REAL) < CAST(\"KmMax\" AS REAL)");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("DateEffet")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Plaque")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DateEffet" }, "IX_Vehicules_DateEffet");
|
||||
|
||||
b.ToTable("Vehicules", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany("Trajets")
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Navigation("Trajets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TrancheBaremeKmCheckNumerique : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropCheckConstraint(
|
||||
name: "CK_TranchesBareme_Km",
|
||||
table: "TranchesBareme");
|
||||
|
||||
migrationBuilder.AddCheckConstraint(
|
||||
name: "CK_TranchesBareme_Km",
|
||||
table: "TranchesBareme",
|
||||
sql: "\"KmMax\" IS NULL OR CAST(\"KmMin\" AS REAL) < CAST(\"KmMax\" AS REAL)");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropCheckConstraint(
|
||||
name: "CK_TranchesBareme_Km",
|
||||
table: "TranchesBareme");
|
||||
|
||||
migrationBuilder.AddCheckConstraint(
|
||||
name: "CK_TranchesBareme_Km",
|
||||
table: "TranchesBareme",
|
||||
sql: "\"KmMax\" IS NULL OR \"KmMin\" < \"KmMax\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using TrajetKmTracker.Api.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TrajetKmTracker.Api.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
partial class AppDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseCache", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DerniereUtilisation")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<double>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Adresse")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdresseCache", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.AdresseNommee", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Adresse")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DenominationNormalisee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("GeocodageReussi")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("Latitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("Longitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DenominationNormalisee" }, "UX_AdresseNommee_Denomination")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("AdressesNommees", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Mois")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Montant")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("VehiculeId");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "Mois", "VehiculeId" }, "UX_MontantsRegles_Periode_Vehicule")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MontantsRegles", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Mois", "\"Mois\" BETWEEN 1 AND 12");
|
||||
|
||||
t.HasCheckConstraint("CK_MontantsRegles_Montant", "\"Montant\" >= 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Profil", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseDomicile")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("DomicileGeocode")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double?>("DomicileLatitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double?>("DomicileLongitude")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<string>("Matricule")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Prenom")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Id" }, "UX_Profil_Singleton")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Profil", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AdresseArrivee")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("AdresseDepart")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Commentaire")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("Date")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("Distance")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("GeometrieJson")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Position")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("VehiculeId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Date" }, "IX_Trajets_Date");
|
||||
|
||||
b.HasIndex(new[] { "Date", "Position" }, "IX_Trajets_Date_Position");
|
||||
|
||||
b.HasIndex(new[] { "VehiculeId" }, "IX_Trajets_Vehicule");
|
||||
|
||||
b.ToTable("Trajets", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Trajets_Distance", "\"Distance\" IS NULL OR \"Distance\" > 0");
|
||||
|
||||
t.HasCheckConstraint("CK_Trajets_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.TrancheBareme", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Annee")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<decimal>("Base")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("Coefficient")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal?>("KmMax")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<decimal>("KmMin")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "Annee", "PuissanceFiscale" }, "IX_TranchesBareme_Annee_PF");
|
||||
|
||||
b.ToTable("TranchesBareme", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_TranchesBareme_Km", "\"KmMax\" IS NULL OR CAST(\"KmMin\" AS REAL) < CAST(\"KmMax\" AS REAL)");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateOnly>("DateEffet")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Denomination")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Plaque")
|
||||
.IsRequired()
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PuissanceFiscale")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex(new[] { "DateEffet" }, "IX_Vehicules_DateEffet");
|
||||
|
||||
b.ToTable("Vehicules", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("CK_Vehicules_PuissanceFiscale", "\"PuissanceFiscale\" > 0");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.MontantRegle", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany()
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Trajet", b =>
|
||||
{
|
||||
b.HasOne("TrajetKmTracker.Api.Models.Entities.Vehicule", "Vehicule")
|
||||
.WithMany("Trajets")
|
||||
.HasForeignKey("VehiculeId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Vehicule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("TrajetKmTracker.Api.Models.Entities.Vehicule", b =>
|
||||
{
|
||||
b.Navigation("Trajets");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user