From f30a8a74ff073fdf6b86a10e50764faff257d43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Wed, 19 Nov 2025 12:33:37 +0100 Subject: [PATCH] .NET 10 and few minor things --- global.json | 2 +- src/Backend/.vscode/launch.json | 43 ++ src/Backend/.vscode/tasks.json | 77 ++++ src/Backend/DiunaBI.API/DiunaBI.API.csproj | 12 +- src/Backend/DiunaBI.API/Dockerfile | 6 +- .../DiunaBI.Application.csproj | 6 +- .../DiunaBI.Domain/DiunaBI.Domain.csproj | 4 +- .../Data/AppDbContext.cs | 4 +- .../DiunaBI.Infrastructure.csproj | 12 +- .../20251119110709_UpdateModel.Designer.cs | 428 ++++++++++++++++++ .../Migrations/20251119110709_UpdateModel.cs | 295 ++++++++++++ .../Migrations/AppDbContextModelSnapshot.cs | 83 ++-- .../DiunaBI.Plugins.Morska.csproj | 4 +- .../DiunaBI.Tests/DiunaBI.Tests.csproj | 6 +- .../Components/LoginCard.razor | 12 +- .../DiunaBI.UI.Shared.csproj | 12 +- .../DiunaBI.UI.Shared/Services/AuthService.cs | 2 +- .../DiunaBI.UI.Shared/wwwroot/js/auth.js | 22 +- .../DiunaBI.UI.Web/DiunaBI.UI.Web.csproj | 4 +- src/Backend/DiunaBI.UI.Web/Dockerfile | 4 +- src/Backend/DiunaBI.code-workspace | 8 + 21 files changed, 971 insertions(+), 75 deletions(-) create mode 100644 src/Backend/.vscode/launch.json create mode 100644 src/Backend/.vscode/tasks.json create mode 100644 src/Backend/DiunaBI.Infrastructure/Migrations/20251119110709_UpdateModel.Designer.cs create mode 100644 src/Backend/DiunaBI.Infrastructure/Migrations/20251119110709_UpdateModel.cs create mode 100644 src/Backend/DiunaBI.code-workspace diff --git a/global.json b/global.json index 3b1d787..6ce09c7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.0", + "version": "10.0.100", "rollForward": "latestFeature" } } \ No newline at end of file diff --git a/src/Backend/.vscode/launch.json b/src/Backend/.vscode/launch.json new file mode 100644 index 0000000..1d09d08 --- /dev/null +++ b/src/Backend/.vscode/launch.json @@ -0,0 +1,43 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "API", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build-api", + "program": "${workspaceFolder}/DiunaBI.API/bin/Debug/net10.0/DiunaBI.API.dll", + "args": [], + "cwd": "${workspaceFolder}/DiunaBI.API", + "stopAtEntry": false, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + { + "name": "Web", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build-web", + "program": "${workspaceFolder}/DiunaBI.UI.Web/bin/Debug/net10.0/DiunaBI.UI.Web.dll", + "args": [], + "cwd": "${workspaceFolder}/DiunaBI.UI.Web", + "stopAtEntry": false, + "serverReadyAction": { + "action": "openExternally", + "pattern": "\\bNow listening on:\\s+(https?://\\S+)", + "uriFormat": "%s" + }, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "launchBrowser": { + "enabled": true, + "args": "${auto-detect-url}", + "osx": "open -a 'Google Chrome' ${auto-detect-url}", + "linux": "google-chrome ${auto-detect-url}", + "windows": "cmd /c start chrome ${auto-detect-url}" + } + } + ] +} diff --git a/src/Backend/.vscode/tasks.json b/src/Backend/.vscode/tasks.json new file mode 100644 index 0000000..9526c19 --- /dev/null +++ b/src/Backend/.vscode/tasks.json @@ -0,0 +1,77 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build-api", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/DiunaBI.API/DiunaBI.API.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "build-web", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/DiunaBI.UI.Web/DiunaBI.UI.Web.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish-api", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/DiunaBI.API/DiunaBI.API.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish-web", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/DiunaBI.UI.Web/DiunaBI.UI.Web.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch-api", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/DiunaBI.API/DiunaBI.API.csproj" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch-web", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/DiunaBI.UI.Web/DiunaBI.UI.Web.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} diff --git a/src/Backend/DiunaBI.API/DiunaBI.API.csproj b/src/Backend/DiunaBI.API/DiunaBI.API.csproj index 7ea8e7b..a33bde2 100644 --- a/src/Backend/DiunaBI.API/DiunaBI.API.csproj +++ b/src/Backend/DiunaBI.API/DiunaBI.API.csproj @@ -1,6 +1,6 @@ - net8.0 + net10.0 enable enable DiunaBI.WebAPI @@ -8,16 +8,20 @@ - + - + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + - + diff --git a/src/Backend/DiunaBI.API/Dockerfile b/src/Backend/DiunaBI.API/Dockerfile index 249a4d7..4f05af9 100644 --- a/src/Backend/DiunaBI.API/Dockerfile +++ b/src/Backend/DiunaBI.API/Dockerfile @@ -1,6 +1,6 @@ # Stage 1: Build -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build WORKDIR /src/Backend # Copy solution and all project files for restore @@ -27,10 +27,10 @@ RUN dotnet publish -c Release -o /app/publish --no-restore # Copy plugin DLL to publish output RUN mkdir -p /app/publish/Plugins && \ - cp /src/Backend/DiunaBI.Plugins.Morska/bin/Release/net8.0/DiunaBI.Plugins.Morska.dll /app/publish/Plugins/ + cp /src/Backend/DiunaBI.Plugins.Morska/bin/Release/net10.0/DiunaBI.Plugins.Morska.dll /app/publish/Plugins/ # Stage 2: Runtime -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime WORKDIR /app # Install wget for health checks diff --git a/src/Backend/DiunaBI.Application/DiunaBI.Application.csproj b/src/Backend/DiunaBI.Application/DiunaBI.Application.csproj index 6d6a6b4..5204036 100644 --- a/src/Backend/DiunaBI.Application/DiunaBI.Application.csproj +++ b/src/Backend/DiunaBI.Application/DiunaBI.Application.csproj @@ -1,10 +1,10 @@ - net8.0 + net10.0 enable enable - 12.0 + 13.0 @@ -13,7 +13,7 @@ - + \ No newline at end of file diff --git a/src/Backend/DiunaBI.Domain/DiunaBI.Domain.csproj b/src/Backend/DiunaBI.Domain/DiunaBI.Domain.csproj index 95e85d4..134177c 100644 --- a/src/Backend/DiunaBI.Domain/DiunaBI.Domain.csproj +++ b/src/Backend/DiunaBI.Domain/DiunaBI.Domain.csproj @@ -1,10 +1,10 @@ - net8.0 + net10.0 enable enable - 12.0 + 13.0 \ No newline at end of file diff --git a/src/Backend/DiunaBI.Infrastructure/Data/AppDbContext.cs b/src/Backend/DiunaBI.Infrastructure/Data/AppDbContext.cs index bd44a33..28d6528 100644 --- a/src/Backend/DiunaBI.Infrastructure/Data/AppDbContext.cs +++ b/src/Backend/DiunaBI.Infrastructure/Data/AppDbContext.cs @@ -129,7 +129,7 @@ public class AppDbContext(DbContextOptions options) : DbContext(op { modelBuilder.Entity(entityType.ClrType) .Property("CreatedAt") - .HasDefaultValueSql("NOW()"); + .HasDefaultValueSql("GETUTCDATE()"); } // Check if entity has ModifiedAt property @@ -138,7 +138,7 @@ public class AppDbContext(DbContextOptions options) : DbContext(op { modelBuilder.Entity(entityType.ClrType) .Property("ModifiedAt") - .HasDefaultValueSql("NOW()"); + .HasDefaultValueSql("GETUTCDATE()"); } } } diff --git a/src/Backend/DiunaBI.Infrastructure/DiunaBI.Infrastructure.csproj b/src/Backend/DiunaBI.Infrastructure/DiunaBI.Infrastructure.csproj index 038a8ec..1775919 100644 --- a/src/Backend/DiunaBI.Infrastructure/DiunaBI.Infrastructure.csproj +++ b/src/Backend/DiunaBI.Infrastructure/DiunaBI.Infrastructure.csproj @@ -2,10 +2,10 @@ - net8.0 + net10.0 enable enable - 12.0 + 13.0 @@ -14,15 +14,15 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + - + \ No newline at end of file diff --git a/src/Backend/DiunaBI.Infrastructure/Migrations/20251119110709_UpdateModel.Designer.cs b/src/Backend/DiunaBI.Infrastructure/Migrations/20251119110709_UpdateModel.Designer.cs new file mode 100644 index 0000000..11f18d4 --- /dev/null +++ b/src/Backend/DiunaBI.Infrastructure/Migrations/20251119110709_UpdateModel.Designer.cs @@ -0,0 +1,428 @@ +// +using System; +using DiunaBI.Infrastructure.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace DiunaBI.Infrastructure.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20251119110709_UpdateModel")] + partial class UpdateModel + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "10.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("DiunaBI.Domain.Entities.DataInbox", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Source") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("DataInbox"); + }); + + modelBuilder.Entity("DiunaBI.Domain.Entities.Layer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("IsCancelled") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("ModifiedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Number") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("ModifiedById"); + + b.ToTable("Layers"); + }); + + modelBuilder.Entity("DiunaBI.Domain.Entities.ProcessSource", b => + { + b.Property("LayerId") + .HasColumnType("uniqueidentifier"); + + b.Property("SourceId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("LayerId", "SourceId"); + + b.HasIndex("SourceId"); + + b.ToTable("ProcessSources"); + }); + + modelBuilder.Entity("DiunaBI.Domain.Entities.QueueJob", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CompletedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); + + b.Property("CreatedAtUtc") + .HasColumnType("datetime2"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("JobType") + .HasColumnType("int"); + + b.Property("LastAttemptAt") + .HasColumnType("datetime2"); + + b.Property("LastError") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("LayerId") + .HasColumnType("uniqueidentifier"); + + b.Property("LayerName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("MaxRetries") + .HasColumnType("int"); + + b.Property("ModifiedAtUtc") + .HasColumnType("datetime2"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("PluginName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("RetryCount") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("QueueJobs"); + }); + + modelBuilder.Entity("DiunaBI.Domain.Entities.Record", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Desc1") + .HasMaxLength(10000) + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LayerId") + .HasColumnType("uniqueidentifier"); + + b.Property("ModifiedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); + + b.Property("ModifiedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Value1") + .HasColumnType("float"); + + b.Property("Value10") + .HasColumnType("float"); + + b.Property("Value11") + .HasColumnType("float"); + + b.Property("Value12") + .HasColumnType("float"); + + b.Property("Value13") + .HasColumnType("float"); + + b.Property("Value14") + .HasColumnType("float"); + + b.Property("Value15") + .HasColumnType("float"); + + b.Property("Value16") + .HasColumnType("float"); + + b.Property("Value17") + .HasColumnType("float"); + + b.Property("Value18") + .HasColumnType("float"); + + b.Property("Value19") + .HasColumnType("float"); + + b.Property("Value2") + .HasColumnType("float"); + + b.Property("Value20") + .HasColumnType("float"); + + b.Property("Value21") + .HasColumnType("float"); + + b.Property("Value22") + .HasColumnType("float"); + + b.Property("Value23") + .HasColumnType("float"); + + b.Property("Value24") + .HasColumnType("float"); + + b.Property("Value25") + .HasColumnType("float"); + + b.Property("Value26") + .HasColumnType("float"); + + b.Property("Value27") + .HasColumnType("float"); + + b.Property("Value28") + .HasColumnType("float"); + + b.Property("Value29") + .HasColumnType("float"); + + b.Property("Value3") + .HasColumnType("float"); + + b.Property("Value30") + .HasColumnType("float"); + + b.Property("Value31") + .HasColumnType("float"); + + b.Property("Value32") + .HasColumnType("float"); + + b.Property("Value4") + .HasColumnType("float"); + + b.Property("Value5") + .HasColumnType("float"); + + b.Property("Value6") + .HasColumnType("float"); + + b.Property("Value7") + .HasColumnType("float"); + + b.Property("Value8") + .HasColumnType("float"); + + b.Property("Value9") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("LayerId"); + + b.HasIndex("ModifiedById"); + + b.ToTable("Records"); + }); + + modelBuilder.Entity("DiunaBI.Domain.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); + + b.Property("Email") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UserName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("DiunaBI.Domain.Entities.Layer", b => + { + b.HasOne("DiunaBI.Domain.Entities.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("DiunaBI.Domain.Entities.User", "ModifiedBy") + .WithMany() + .HasForeignKey("ModifiedById") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("ModifiedBy"); + }); + + modelBuilder.Entity("DiunaBI.Domain.Entities.ProcessSource", b => + { + b.HasOne("DiunaBI.Domain.Entities.Layer", null) + .WithMany() + .HasForeignKey("LayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DiunaBI.Domain.Entities.Layer", "Source") + .WithMany() + .HasForeignKey("SourceId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Source"); + }); + + modelBuilder.Entity("DiunaBI.Domain.Entities.Record", b => + { + b.HasOne("DiunaBI.Domain.Entities.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("DiunaBI.Domain.Entities.Layer", null) + .WithMany("Records") + .HasForeignKey("LayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DiunaBI.Domain.Entities.User", "ModifiedBy") + .WithMany() + .HasForeignKey("ModifiedById") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("ModifiedBy"); + }); + + modelBuilder.Entity("DiunaBI.Domain.Entities.Layer", b => + { + b.Navigation("Records"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Backend/DiunaBI.Infrastructure/Migrations/20251119110709_UpdateModel.cs b/src/Backend/DiunaBI.Infrastructure/Migrations/20251119110709_UpdateModel.cs new file mode 100644 index 0000000..d019b25 --- /dev/null +++ b/src/Backend/DiunaBI.Infrastructure/Migrations/20251119110709_UpdateModel.cs @@ -0,0 +1,295 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DiunaBI.Infrastructure.Migrations +{ + /// + public partial class UpdateModel : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Layers_Users_CreatedById", + table: "Layers"); + + migrationBuilder.DropForeignKey( + name: "FK_Layers_Users_ModifiedById", + table: "Layers"); + + migrationBuilder.DropForeignKey( + name: "FK_ProcessSources_Layers_SourceId", + table: "ProcessSources"); + + migrationBuilder.DropForeignKey( + name: "FK_Records_Users_CreatedById", + table: "Records"); + + migrationBuilder.DropForeignKey( + name: "FK_Records_Users_ModifiedById", + table: "Records"); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "Users", + type: "datetime2", + nullable: false, + defaultValueSql: "GETUTCDATE()", + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "ModifiedAt", + table: "Records", + type: "datetime2", + nullable: false, + defaultValueSql: "GETUTCDATE()", + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "Records", + type: "datetime2", + nullable: false, + defaultValueSql: "GETUTCDATE()", + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "QueueJobs", + type: "datetime2", + nullable: false, + defaultValueSql: "GETUTCDATE()", + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "ModifiedAt", + table: "Layers", + type: "datetime2", + nullable: false, + defaultValueSql: "GETUTCDATE()", + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "IsDeleted", + table: "Layers", + type: "bit", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "bit"); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "Layers", + type: "datetime2", + nullable: false, + defaultValueSql: "GETUTCDATE()", + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "DataInbox", + type: "datetime2", + nullable: false, + defaultValueSql: "GETUTCDATE()", + oldClrType: typeof(DateTime), + oldType: "datetime2"); + + migrationBuilder.AddForeignKey( + name: "FK_Layers_Users_CreatedById", + table: "Layers", + column: "CreatedById", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_Layers_Users_ModifiedById", + table: "Layers", + column: "ModifiedById", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_ProcessSources_Layers_LayerId", + table: "ProcessSources", + column: "LayerId", + principalTable: "Layers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_ProcessSources_Layers_SourceId", + table: "ProcessSources", + column: "SourceId", + principalTable: "Layers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_Records_Users_CreatedById", + table: "Records", + column: "CreatedById", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_Records_Users_ModifiedById", + table: "Records", + column: "ModifiedById", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Layers_Users_CreatedById", + table: "Layers"); + + migrationBuilder.DropForeignKey( + name: "FK_Layers_Users_ModifiedById", + table: "Layers"); + + migrationBuilder.DropForeignKey( + name: "FK_ProcessSources_Layers_LayerId", + table: "ProcessSources"); + + migrationBuilder.DropForeignKey( + name: "FK_ProcessSources_Layers_SourceId", + table: "ProcessSources"); + + migrationBuilder.DropForeignKey( + name: "FK_Records_Users_CreatedById", + table: "Records"); + + migrationBuilder.DropForeignKey( + name: "FK_Records_Users_ModifiedById", + table: "Records"); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "Users", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldDefaultValueSql: "GETUTCDATE()"); + + migrationBuilder.AlterColumn( + name: "ModifiedAt", + table: "Records", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldDefaultValueSql: "GETUTCDATE()"); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "Records", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldDefaultValueSql: "GETUTCDATE()"); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "QueueJobs", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldDefaultValueSql: "GETUTCDATE()"); + + migrationBuilder.AlterColumn( + name: "ModifiedAt", + table: "Layers", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldDefaultValueSql: "GETUTCDATE()"); + + migrationBuilder.AlterColumn( + name: "IsDeleted", + table: "Layers", + type: "bit", + nullable: false, + oldClrType: typeof(bool), + oldType: "bit", + oldDefaultValue: false); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "Layers", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldDefaultValueSql: "GETUTCDATE()"); + + migrationBuilder.AlterColumn( + name: "CreatedAt", + table: "DataInbox", + type: "datetime2", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "datetime2", + oldDefaultValueSql: "GETUTCDATE()"); + + migrationBuilder.AddForeignKey( + name: "FK_Layers_Users_CreatedById", + table: "Layers", + column: "CreatedById", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Layers_Users_ModifiedById", + table: "Layers", + column: "ModifiedById", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_ProcessSources_Layers_SourceId", + table: "ProcessSources", + column: "SourceId", + principalTable: "Layers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Records_Users_CreatedById", + table: "Records", + column: "CreatedById", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Records_Users_ModifiedById", + table: "Records", + column: "ModifiedById", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/src/Backend/DiunaBI.Infrastructure/Migrations/AppDbContextModelSnapshot.cs b/src/Backend/DiunaBI.Infrastructure/Migrations/AppDbContextModelSnapshot.cs index 4410fb3..add6e42 100644 --- a/src/Backend/DiunaBI.Infrastructure/Migrations/AppDbContextModelSnapshot.cs +++ b/src/Backend/DiunaBI.Infrastructure/Migrations/AppDbContextModelSnapshot.cs @@ -17,23 +17,24 @@ namespace DiunaBI.Infrastructure.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("ProductVersion", "10.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - modelBuilder.Entity("DiunaBI.Core.Models.DataInbox", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.DataInbox", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); b.Property("Data") .IsRequired() - .HasMaxLength(2147483647) .HasColumnType("nvarchar(max)"); b.Property("Name") @@ -51,14 +52,16 @@ namespace DiunaBI.Infrastructure.Migrations b.ToTable("DataInbox"); }); - modelBuilder.Entity("DiunaBI.Core.Models.Layer", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.Layer", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); b.Property("CreatedById") .HasColumnType("uniqueidentifier"); @@ -67,10 +70,14 @@ namespace DiunaBI.Infrastructure.Migrations .HasColumnType("bit"); b.Property("IsDeleted") - .HasColumnType("bit"); + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); b.Property("ModifiedAt") - .HasColumnType("datetime2"); + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); b.Property("ModifiedById") .HasColumnType("uniqueidentifier"); @@ -98,7 +105,7 @@ namespace DiunaBI.Infrastructure.Migrations b.ToTable("Layers"); }); - modelBuilder.Entity("DiunaBI.Core.Models.ProcessSource", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.ProcessSource", b => { b.Property("LayerId") .HasColumnType("uniqueidentifier"); @@ -113,7 +120,7 @@ namespace DiunaBI.Infrastructure.Migrations b.ToTable("ProcessSources"); }); - modelBuilder.Entity("DiunaBI.Core.Models.QueueJob", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.QueueJob", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -123,7 +130,9 @@ namespace DiunaBI.Infrastructure.Migrations .HasColumnType("datetime2"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); b.Property("CreatedAtUtc") .HasColumnType("datetime2"); @@ -177,7 +186,7 @@ namespace DiunaBI.Infrastructure.Migrations b.ToTable("QueueJobs"); }); - modelBuilder.Entity("DiunaBI.Core.Models.Record", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.Record", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -189,7 +198,9 @@ namespace DiunaBI.Infrastructure.Migrations .HasColumnType("nvarchar(50)"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); b.Property("CreatedById") .HasColumnType("uniqueidentifier"); @@ -205,7 +216,9 @@ namespace DiunaBI.Infrastructure.Migrations .HasColumnType("uniqueidentifier"); b.Property("ModifiedAt") - .HasColumnType("datetime2"); + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); b.Property("ModifiedById") .HasColumnType("uniqueidentifier"); @@ -317,14 +330,16 @@ namespace DiunaBI.Infrastructure.Migrations b.ToTable("Records"); }); - modelBuilder.Entity("DiunaBI.Core.Models.User", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.User", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETUTCDATE()"); b.Property("Email") .HasMaxLength(50) @@ -339,18 +354,18 @@ namespace DiunaBI.Infrastructure.Migrations b.ToTable("Users"); }); - modelBuilder.Entity("DiunaBI.Core.Models.Layer", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.Layer", b => { - b.HasOne("DiunaBI.Core.Models.User", "CreatedBy") + b.HasOne("DiunaBI.Domain.Entities.User", "CreatedBy") .WithMany() .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) + .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("DiunaBI.Core.Models.User", "ModifiedBy") + b.HasOne("DiunaBI.Domain.Entities.User", "ModifiedBy") .WithMany() .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) + .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("CreatedBy"); @@ -358,35 +373,41 @@ namespace DiunaBI.Infrastructure.Migrations b.Navigation("ModifiedBy"); }); - modelBuilder.Entity("DiunaBI.Core.Models.ProcessSource", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.ProcessSource", b => { - b.HasOne("DiunaBI.Core.Models.Layer", "Source") + b.HasOne("DiunaBI.Domain.Entities.Layer", null) + .WithMany() + .HasForeignKey("LayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DiunaBI.Domain.Entities.Layer", "Source") .WithMany() .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) + .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("Source"); }); - modelBuilder.Entity("DiunaBI.Core.Models.Record", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.Record", b => { - b.HasOne("DiunaBI.Core.Models.User", "CreatedBy") + b.HasOne("DiunaBI.Domain.Entities.User", "CreatedBy") .WithMany() .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) + .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("DiunaBI.Core.Models.Layer", null) + b.HasOne("DiunaBI.Domain.Entities.Layer", null) .WithMany("Records") .HasForeignKey("LayerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("DiunaBI.Core.Models.User", "ModifiedBy") + b.HasOne("DiunaBI.Domain.Entities.User", "ModifiedBy") .WithMany() .HasForeignKey("ModifiedById") - .OnDelete(DeleteBehavior.Cascade) + .OnDelete(DeleteBehavior.Restrict) .IsRequired(); b.Navigation("CreatedBy"); @@ -394,7 +415,7 @@ namespace DiunaBI.Infrastructure.Migrations b.Navigation("ModifiedBy"); }); - modelBuilder.Entity("DiunaBI.Core.Models.Layer", b => + modelBuilder.Entity("DiunaBI.Domain.Entities.Layer", b => { b.Navigation("Records"); }); diff --git a/src/Backend/DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj b/src/Backend/DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj index a610c9b..f71fe76 100644 --- a/src/Backend/DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj +++ b/src/Backend/DiunaBI.Plugins.Morska/DiunaBI.Plugins.Morska.csproj @@ -1,12 +1,12 @@  - net8.0 + net10.0 enable enable - + diff --git a/src/Backend/DiunaBI.Tests/DiunaBI.Tests.csproj b/src/Backend/DiunaBI.Tests/DiunaBI.Tests.csproj index f31e06e..1373792 100644 --- a/src/Backend/DiunaBI.Tests/DiunaBI.Tests.csproj +++ b/src/Backend/DiunaBI.Tests/DiunaBI.Tests.csproj @@ -1,15 +1,15 @@ - net8.0 + net10.0 enable enable false - - + + all diff --git a/src/Backend/DiunaBI.UI.Shared/Components/LoginCard.razor b/src/Backend/DiunaBI.UI.Shared/Components/LoginCard.razor index ef3087b..31d526b 100644 --- a/src/Backend/DiunaBI.UI.Shared/Components/LoginCard.razor +++ b/src/Backend/DiunaBI.UI.Shared/Components/LoginCard.razor @@ -59,20 +59,26 @@ try { if (_isInitialized) return; - + var clientId = Configuration["GoogleAuth:ClientId"]; + Console.WriteLine($"🔍 Reading GoogleAuth:ClientId from configuration: '{clientId}'"); + if (string.IsNullOrEmpty(clientId)) { - throw new Exception("Google ClientId is not configured."); + _errorMessage = "Google ClientId is not configured in appsettings."; + Console.Error.WriteLine("❌ Google ClientId is NULL or EMPTY in configuration!"); + return; } + Console.WriteLine($"✅ Calling initGoogleSignIn with clientId: {clientId}"); await JS.InvokeVoidAsync("initGoogleSignIn", clientId); _isInitialized = true; } catch (Exception ex) { _errorMessage = "Błąd inicjalizacji Google Sign-In."; - Console.Error.WriteLine($"Google Sign-In initialization error: {ex.Message}"); + Console.Error.WriteLine($"❌ Google Sign-In initialization error: {ex.Message}"); + Console.Error.WriteLine($"Stack trace: {ex.StackTrace}"); } } diff --git a/src/Backend/DiunaBI.UI.Shared/DiunaBI.UI.Shared.csproj b/src/Backend/DiunaBI.UI.Shared/DiunaBI.UI.Shared.csproj index 3cda54f..f65b4fe 100644 --- a/src/Backend/DiunaBI.UI.Shared/DiunaBI.UI.Shared.csproj +++ b/src/Backend/DiunaBI.UI.Shared/DiunaBI.UI.Shared.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable enable @@ -12,11 +12,11 @@ - - - - - + + + + + diff --git a/src/Backend/DiunaBI.UI.Shared/Services/AuthService.cs b/src/Backend/DiunaBI.UI.Shared/Services/AuthService.cs index a158c9d..c88a47b 100644 --- a/src/Backend/DiunaBI.UI.Shared/Services/AuthService.cs +++ b/src/Backend/DiunaBI.UI.Shared/Services/AuthService.cs @@ -37,7 +37,7 @@ public class AuthService Console.WriteLine($"=== ValidateWithBackend: Sending Google credential for {email} ==="); // Wyślij Google credential do backendu - var response = await _httpClient.PostAsJsonAsync("/api/Auth/apiToken", googleCredential); + var response = await _httpClient.PostAsJsonAsync("/Auth/apiToken", googleCredential); if (response.IsSuccessStatusCode) { diff --git a/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js b/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js index e65d290..c18ffd1 100644 --- a/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js +++ b/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js @@ -5,9 +5,23 @@ window.initGoogleSignIn = function(clientId) { console.log("Google Sign-In already initialized"); return; } - - console.log("🔐 Initializing Google Sign-In (ID Token flow) with clientId:", clientId); - + + console.log("🔐 Initializing Google Sign-In (ID Token flow)"); + console.log("📋 Received clientId:", clientId); + console.log("📋 ClientId type:", typeof clientId); + console.log("📋 ClientId length:", clientId ? clientId.length : 0); + + if (!clientId || clientId === '' || clientId === 'null' || clientId === 'undefined') { + console.error("❌ Invalid clientId received:", clientId); + throw new Error("ClientId is null, empty, or invalid"); + } + + // Check if Google library is loaded + if (typeof google === 'undefined' || !google.accounts || !google.accounts.id) { + console.error("❌ Google Sign-In library not loaded yet!"); + throw new Error("Google Sign-In library not ready"); + } + // Używamy google.accounts.id - zwraca ID token (JWT credential) google.accounts.id.initialize({ client_id: clientId, @@ -15,7 +29,7 @@ window.initGoogleSignIn = function(clientId) { auto_select: false, cancel_on_tap_outside: true }); - + googleInitialized = true; console.log("✅ Google Sign-In initialized successfully"); }; diff --git a/src/Backend/DiunaBI.UI.Web/DiunaBI.UI.Web.csproj b/src/Backend/DiunaBI.UI.Web/DiunaBI.UI.Web.csproj index 0224edb..2850c5c 100644 --- a/src/Backend/DiunaBI.UI.Web/DiunaBI.UI.Web.csproj +++ b/src/Backend/DiunaBI.UI.Web/DiunaBI.UI.Web.csproj @@ -1,13 +1,13 @@ - net8.0 + net10.0 enable enable - + diff --git a/src/Backend/DiunaBI.UI.Web/Dockerfile b/src/Backend/DiunaBI.UI.Web/Dockerfile index 1cb953b..b0dfafe 100644 --- a/src/Backend/DiunaBI.UI.Web/Dockerfile +++ b/src/Backend/DiunaBI.UI.Web/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build WORKDIR /src/Backend # Copy solution and all project files for restore @@ -20,7 +20,7 @@ WORKDIR /src/Backend/DiunaBI.UI.Web RUN dotnet publish -c Release -o /app/publish --no-restore # Stage 2: Runtime -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime WORKDIR /app # Install wget for health checks diff --git a/src/Backend/DiunaBI.code-workspace b/src/Backend/DiunaBI.code-workspace new file mode 100644 index 0000000..876a149 --- /dev/null +++ b/src/Backend/DiunaBI.code-workspace @@ -0,0 +1,8 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": {} +} \ No newline at end of file