diff --git a/api/Migrations/20260317024844_AddUserAuthFields.Designer.cs b/api/Migrations/20260317024844_AddUserAuthFields.Designer.cs new file mode 100644 index 0000000..6a1cde8 --- /dev/null +++ b/api/Migrations/20260317024844_AddUserAuthFields.Designer.cs @@ -0,0 +1,53 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace agologum_api.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20260317024844_AddUserAuthFields")] + partial class AddUserAuthFields + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("agologumApi.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/api/Migrations/20260317024844_AddUserAuthFields.cs b/api/Migrations/20260317024844_AddUserAuthFields.cs new file mode 100644 index 0000000..4c533f6 --- /dev/null +++ b/api/Migrations/20260317024844_AddUserAuthFields.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace agologum_api.Migrations +{ + /// + public partial class AddUserAuthFields : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "PasswordHash", + table: "Users", + type: "text", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "PasswordHash", + table: "Users"); + } + } +} diff --git a/api/Migrations/AppDbContextModelSnapshot.cs b/api/Migrations/AppDbContextModelSnapshot.cs index 112584c..f1b5d4f 100644 --- a/api/Migrations/AppDbContextModelSnapshot.cs +++ b/api/Migrations/AppDbContextModelSnapshot.cs @@ -36,6 +36,10 @@ namespace agologum_api.Migrations .IsRequired() .HasColumnType("text"); + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("text"); + b.HasKey("Id"); b.ToTable("Users"); diff --git a/api/appsettings.json b/api/appsettings.json index 3bbbad3..1ee7388 100644 --- a/api/appsettings.json +++ b/api/appsettings.json @@ -9,5 +9,10 @@ "DefaultConnection": "Host=agologum-net;Port=5432;Database=agologum;Username=agologum;Password=${POSTGRES_PASSWORD}" }, "AllowedHosts": "*", - "https_port": 443 + "https_port": 443, + "Jwt": { + "Key": "local_secret", + "Issuer": "agologum-api", + "Audience": "agologum-users" + } }