Initial commit
This commit is contained in:
+242
@@ -0,0 +1,242 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ExpenseTracker.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ExpenseTracker.Api.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260902125250_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.AppSetting", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("key");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("value");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_app_settings_key_unique");
|
||||
|
||||
b.ToTable("app_settings", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000001"),
|
||||
Key = "default_salary",
|
||||
Value = "0"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(7)
|
||||
.HasColumnType("character varying(7)")
|
||||
.HasColumnName("color");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("categories", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Color = "#ef4444",
|
||||
Name = "Alimentation"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
Color = "#f97316",
|
||||
Name = "Transport"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
Color = "#eab308",
|
||||
Name = "Logement"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
Color = "#22c55e",
|
||||
Name = "Santé"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
Color = "#3b82f6",
|
||||
Name = "Loisirs"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
Color = "#a855f7",
|
||||
Name = "Abonnements"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000007"),
|
||||
Color = "#6b7280",
|
||||
Name = "Autre"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("DECIMAL(12,2)")
|
||||
.HasColumnName("amount");
|
||||
|
||||
b.Property<Guid?>("CategoryId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("category_id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<DateOnly>("EntryDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("entry_date");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("label");
|
||||
|
||||
b.Property<Guid>("MonthId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("month_id");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId")
|
||||
.HasDatabaseName("ix_entries_category_id");
|
||||
|
||||
b.HasIndex("MonthId")
|
||||
.HasDatabaseName("ix_entries_month_id");
|
||||
|
||||
b.ToTable("entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<decimal>("DefaultSalary")
|
||||
.HasColumnType("DECIMAL(12,2)")
|
||||
.HasColumnName("default_salary");
|
||||
|
||||
b.Property<int>("MonthNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("month");
|
||||
|
||||
b.Property<int>("Year")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("year");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Year", "MonthNumber")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_months_year_month_unique");
|
||||
|
||||
b.ToTable("months", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b =>
|
||||
{
|
||||
b.HasOne("ExpenseTracker.Api.Models.Category", "Category")
|
||||
.WithMany("Entries")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("ExpenseTracker.Api.Models.Month", "Month")
|
||||
.WithMany("Entries")
|
||||
.HasForeignKey("MonthId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Category");
|
||||
|
||||
b.Navigation("Month");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b =>
|
||||
{
|
||||
b.Navigation("Entries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b =>
|
||||
{
|
||||
b.Navigation("Entries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace ExpenseTracker.Api.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "app_settings",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
key = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
value = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_app_settings", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "categories",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
color = table.Column<string>(type: "character varying(7)", maxLength: 7, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_categories", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "months",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
year = table.Column<int>(type: "integer", nullable: false),
|
||||
month = table.Column<int>(type: "integer", nullable: false),
|
||||
default_salary = table.Column<decimal>(type: "numeric(12,2)", nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_months", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "entries",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
month_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
type = table.Column<string>(type: "text", nullable: false),
|
||||
amount = table.Column<decimal>(type: "numeric(12,2)", nullable: false),
|
||||
label = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
||||
category_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
entry_date = table.Column<DateOnly>(type: "date", nullable: false),
|
||||
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_entries", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_entries_categories_category_id",
|
||||
column: x => x.category_id,
|
||||
principalTable: "categories",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
table.ForeignKey(
|
||||
name: "FK_entries_months_month_id",
|
||||
column: x => x.month_id,
|
||||
principalTable: "months",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "app_settings",
|
||||
columns: new[] { "id", "key", "value" },
|
||||
values: new object[] { new Guid("20000000-0000-0000-0000-000000000001"), "default_salary", "0" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "categories",
|
||||
columns: new[] { "id", "color", "name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("10000000-0000-0000-0000-000000000001"), "#ef4444", "Alimentation" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000002"), "#f97316", "Transport" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000003"), "#eab308", "Logement" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000004"), "#22c55e", "Santé" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000005"), "#3b82f6", "Loisirs" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000006"), "#a855f7", "Abonnements" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000007"), "#6b7280", "Autre" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_app_settings_key_unique",
|
||||
table: "app_settings",
|
||||
column: "key",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_entries_category_id",
|
||||
table: "entries",
|
||||
column: "category_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_entries_month_id",
|
||||
table: "entries",
|
||||
column: "month_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_months_year_month_unique",
|
||||
table: "months",
|
||||
columns: new[] { "year", "month" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "app_settings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "entries");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "categories");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "months");
|
||||
}
|
||||
}
|
||||
}
|
||||
+296
@@ -0,0 +1,296 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ExpenseTracker.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ExpenseTracker.Api.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260907094513_UpdateCategories")]
|
||||
partial class UpdateCategories
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.AppSetting", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("key");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("value");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_app_settings_key_unique");
|
||||
|
||||
b.ToTable("app_settings", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000001"),
|
||||
Key = "default_salary",
|
||||
Value = "0"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(7)
|
||||
.HasColumnType("character varying(7)")
|
||||
.HasColumnName("color");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("categories", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Color = "#f97316",
|
||||
Name = "Ameublement et appareil"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
Color = "#6b7280",
|
||||
Name = "Banque et assurance"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
Color = "#22c55e",
|
||||
Name = "Credit"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
Color = "#eab308",
|
||||
Name = "Energie"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
Color = "#ef4444",
|
||||
Name = "Frais bancaires"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
Color = "#ec4899",
|
||||
Name = "Hygiene"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000007"),
|
||||
Color = "#dc2626",
|
||||
Name = "Impots et taxes"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000008"),
|
||||
Color = "#3b82f6",
|
||||
Name = "Internet et telephonie"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000009"),
|
||||
Color = "#8b5cf6",
|
||||
Name = "Juridique et administratif"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000010"),
|
||||
Color = "#64748b",
|
||||
Name = "Prelevement"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000011"),
|
||||
Color = "#16a34a",
|
||||
Name = "Salaires"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000012"),
|
||||
Color = "#a855f7",
|
||||
Name = "Shopping et services"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000013"),
|
||||
Color = "#0ea5e9",
|
||||
Name = "Sport, Gym et Equipement"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000014"),
|
||||
Color = "#94a3b8",
|
||||
Name = "Transaction differee"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000015"),
|
||||
Color = "#f59e0b",
|
||||
Name = "Virement emis"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000016"),
|
||||
Color = "#10b981",
|
||||
Name = "Virement recu"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("DECIMAL(12,2)")
|
||||
.HasColumnName("amount");
|
||||
|
||||
b.Property<Guid?>("CategoryId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("category_id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<DateOnly>("EntryDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("entry_date");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("label");
|
||||
|
||||
b.Property<Guid>("MonthId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("month_id");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId")
|
||||
.HasDatabaseName("ix_entries_category_id");
|
||||
|
||||
b.HasIndex("MonthId")
|
||||
.HasDatabaseName("ix_entries_month_id");
|
||||
|
||||
b.ToTable("entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<decimal>("DefaultSalary")
|
||||
.HasColumnType("DECIMAL(12,2)")
|
||||
.HasColumnName("default_salary");
|
||||
|
||||
b.Property<int>("MonthNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("month");
|
||||
|
||||
b.Property<int>("Year")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("year");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Year", "MonthNumber")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_months_year_month_unique");
|
||||
|
||||
b.ToTable("months", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b =>
|
||||
{
|
||||
b.HasOne("ExpenseTracker.Api.Models.Category", "Category")
|
||||
.WithMany("Entries")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("ExpenseTracker.Api.Models.Month", "Month")
|
||||
.WithMany("Entries")
|
||||
.HasForeignKey("MonthId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Category");
|
||||
|
||||
b.Navigation("Month");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b =>
|
||||
{
|
||||
b.Navigation("Entries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b =>
|
||||
{
|
||||
b.Navigation("Entries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace ExpenseTracker.Api.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdateCategories : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#f97316", "Ameublement et appareil" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#6b7280", "Banque et assurance" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#22c55e", "Credit" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#eab308", "Energie" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#ef4444", "Frais bancaires" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#ec4899", "Hygiene" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000007"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#dc2626", "Impots et taxes" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "categories",
|
||||
columns: new[] { "id", "color", "name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("10000000-0000-0000-0000-000000000008"), "#3b82f6", "Internet et telephonie" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000009"), "#8b5cf6", "Juridique et administratif" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000010"), "#64748b", "Prelevement" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000011"), "#16a34a", "Salaires" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000012"), "#a855f7", "Shopping et services" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000013"), "#0ea5e9", "Sport, Gym et Equipement" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000014"), "#94a3b8", "Transaction differee" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000015"), "#f59e0b", "Virement emis" },
|
||||
{ new Guid("10000000-0000-0000-0000-000000000016"), "#10b981", "Virement recu" }
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000008"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000009"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000010"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000011"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000012"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000013"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000014"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000015"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000016"));
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#ef4444", "Alimentation" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#f97316", "Transport" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#eab308", "Logement" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#22c55e", "Santé" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#3b82f6", "Loisirs" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#a855f7", "Abonnements" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000007"),
|
||||
columns: new[] { "color", "name" },
|
||||
values: new object[] { "#6b7280", "Autre" });
|
||||
}
|
||||
}
|
||||
}
|
||||
+302
@@ -0,0 +1,302 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ExpenseTracker.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ExpenseTracker.Api.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260907100011_AddAutreCategory")]
|
||||
partial class AddAutreCategory
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.AppSetting", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("key");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("value");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_app_settings_key_unique");
|
||||
|
||||
b.ToTable("app_settings", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000001"),
|
||||
Key = "default_salary",
|
||||
Value = "0"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(7)
|
||||
.HasColumnType("character varying(7)")
|
||||
.HasColumnName("color");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("categories", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Color = "#f97316",
|
||||
Name = "Ameublement et appareil"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
Color = "#6b7280",
|
||||
Name = "Banque et assurance"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
Color = "#22c55e",
|
||||
Name = "Credit"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
Color = "#eab308",
|
||||
Name = "Energie"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
Color = "#ef4444",
|
||||
Name = "Frais bancaires"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
Color = "#ec4899",
|
||||
Name = "Hygiene"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000007"),
|
||||
Color = "#dc2626",
|
||||
Name = "Impots et taxes"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000008"),
|
||||
Color = "#3b82f6",
|
||||
Name = "Internet et telephonie"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000009"),
|
||||
Color = "#8b5cf6",
|
||||
Name = "Juridique et administratif"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000010"),
|
||||
Color = "#64748b",
|
||||
Name = "Prelevement"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000011"),
|
||||
Color = "#16a34a",
|
||||
Name = "Salaires"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000012"),
|
||||
Color = "#a855f7",
|
||||
Name = "Shopping et services"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000013"),
|
||||
Color = "#0ea5e9",
|
||||
Name = "Sport, Gym et Equipement"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000014"),
|
||||
Color = "#94a3b8",
|
||||
Name = "Transaction differee"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000015"),
|
||||
Color = "#f59e0b",
|
||||
Name = "Virement emis"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000016"),
|
||||
Color = "#10b981",
|
||||
Name = "Virement recu"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000017"),
|
||||
Color = "#6b7280",
|
||||
Name = "Autre"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("DECIMAL(12,2)")
|
||||
.HasColumnName("amount");
|
||||
|
||||
b.Property<Guid?>("CategoryId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("category_id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<DateOnly>("EntryDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("entry_date");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("label");
|
||||
|
||||
b.Property<Guid>("MonthId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("month_id");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId")
|
||||
.HasDatabaseName("ix_entries_category_id");
|
||||
|
||||
b.HasIndex("MonthId")
|
||||
.HasDatabaseName("ix_entries_month_id");
|
||||
|
||||
b.ToTable("entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<decimal>("DefaultSalary")
|
||||
.HasColumnType("DECIMAL(12,2)")
|
||||
.HasColumnName("default_salary");
|
||||
|
||||
b.Property<int>("MonthNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("month");
|
||||
|
||||
b.Property<int>("Year")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("year");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Year", "MonthNumber")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_months_year_month_unique");
|
||||
|
||||
b.ToTable("months", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b =>
|
||||
{
|
||||
b.HasOne("ExpenseTracker.Api.Models.Category", "Category")
|
||||
.WithMany("Entries")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("ExpenseTracker.Api.Models.Month", "Month")
|
||||
.WithMany("Entries")
|
||||
.HasForeignKey("MonthId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Category");
|
||||
|
||||
b.Navigation("Month");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b =>
|
||||
{
|
||||
b.Navigation("Entries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b =>
|
||||
{
|
||||
b.Navigation("Entries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ExpenseTracker.Api.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddAutreCategory : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
table: "categories",
|
||||
columns: new[] { "id", "color", "name" },
|
||||
values: new object[] { new Guid("10000000-0000-0000-0000-000000000017"), "#6b7280", "Autre" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
table: "categories",
|
||||
keyColumn: "id",
|
||||
keyValue: new Guid("10000000-0000-0000-0000-000000000017"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ExpenseTracker.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ExpenseTracker.Api.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
partial class AppDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.AppSetting", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("key");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("value");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_app_settings_key_unique");
|
||||
|
||||
b.ToTable("app_settings", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("20000000-0000-0000-0000-000000000001"),
|
||||
Key = "default_salary",
|
||||
Value = "0"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Color")
|
||||
.IsRequired()
|
||||
.HasMaxLength(7)
|
||||
.HasColumnType("character varying(7)")
|
||||
.HasColumnName("color");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("categories", (string)null);
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000001"),
|
||||
Color = "#f97316",
|
||||
Name = "Ameublement et appareil"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000002"),
|
||||
Color = "#6b7280",
|
||||
Name = "Banque et assurance"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000003"),
|
||||
Color = "#22c55e",
|
||||
Name = "Credit"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000004"),
|
||||
Color = "#eab308",
|
||||
Name = "Energie"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000005"),
|
||||
Color = "#ef4444",
|
||||
Name = "Frais bancaires"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000006"),
|
||||
Color = "#ec4899",
|
||||
Name = "Hygiene"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000007"),
|
||||
Color = "#dc2626",
|
||||
Name = "Impots et taxes"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000008"),
|
||||
Color = "#3b82f6",
|
||||
Name = "Internet et telephonie"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000009"),
|
||||
Color = "#8b5cf6",
|
||||
Name = "Juridique et administratif"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000010"),
|
||||
Color = "#64748b",
|
||||
Name = "Prelevement"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000011"),
|
||||
Color = "#16a34a",
|
||||
Name = "Salaires"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000012"),
|
||||
Color = "#a855f7",
|
||||
Name = "Shopping et services"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000013"),
|
||||
Color = "#0ea5e9",
|
||||
Name = "Sport, Gym et Equipement"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000014"),
|
||||
Color = "#94a3b8",
|
||||
Name = "Transaction differee"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000015"),
|
||||
Color = "#f59e0b",
|
||||
Name = "Virement emis"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000016"),
|
||||
Color = "#10b981",
|
||||
Name = "Virement recu"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("10000000-0000-0000-0000-000000000017"),
|
||||
Color = "#6b7280",
|
||||
Name = "Autre"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("DECIMAL(12,2)")
|
||||
.HasColumnName("amount");
|
||||
|
||||
b.Property<Guid?>("CategoryId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("category_id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<DateOnly>("EntryDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("entry_date");
|
||||
|
||||
b.Property<string>("Label")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("label");
|
||||
|
||||
b.Property<Guid>("MonthId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("month_id");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId")
|
||||
.HasDatabaseName("ix_entries_category_id");
|
||||
|
||||
b.HasIndex("MonthId")
|
||||
.HasDatabaseName("ix_entries_month_id");
|
||||
|
||||
b.ToTable("entries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<decimal>("DefaultSalary")
|
||||
.HasColumnType("DECIMAL(12,2)")
|
||||
.HasColumnName("default_salary");
|
||||
|
||||
b.Property<int>("MonthNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("month");
|
||||
|
||||
b.Property<int>("Year")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("year");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Year", "MonthNumber")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_months_year_month_unique");
|
||||
|
||||
b.ToTable("months", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Entry", b =>
|
||||
{
|
||||
b.HasOne("ExpenseTracker.Api.Models.Category", "Category")
|
||||
.WithMany("Entries")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("ExpenseTracker.Api.Models.Month", "Month")
|
||||
.WithMany("Entries")
|
||||
.HasForeignKey("MonthId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Category");
|
||||
|
||||
b.Navigation("Month");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Category", b =>
|
||||
{
|
||||
b.Navigation("Entries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ExpenseTracker.Api.Models.Month", b =>
|
||||
{
|
||||
b.Navigation("Entries");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user