From 2b7ed3e451d5cd2c9bdd5d9d056cb1c1eb2f9c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Fri, 21 Nov 2025 16:37:47 +0100 Subject: [PATCH] .net10 and few fixes --- .gitignore | 9 ++- .vscode/launch.json | 47 +++++++++++ .vscode/tasks.json | 77 +++++++++++++++++++ BimAI.API/BimAI.API.csproj | 2 - BimAI.API/Program.cs | 7 -- .../Services/HangfireAuthorizationFilter.cs | 13 +--- BimAI.API/appsettings.Development.json | 6 +- BimAI.UI.Mobile/BimAI.UI.Mobile.csproj | 10 +-- BimAI.UI.Web/appsettings.Development.json | 2 +- BimAI.sln | 2 - docker-compose.yml | 49 ------------ 11 files changed, 142 insertions(+), 82 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json delete mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index 1fff553..331c7b8 100644 --- a/.gitignore +++ b/.gitignore @@ -24,10 +24,6 @@ Generated/ *.db-shm *.db-wal -# Visual Studio Code -.vscode/ -.vscode/* - # MAUI / Mobile (Xcode/iOS) **/bin/ **/obj/ @@ -86,3 +82,8 @@ nunit-*.xml .idea/indexLayout.xml .idea/tasks.xml .idea/.idea_modules + +# VSCode - ignore personal settings but keep shared configs +.vscode/* +!.vscode/launch.json +!.vscode/tasks.json \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..dcbd883 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,47 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "API", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build-api", + "program": "${workspaceFolder}/BimAI.API/bin/Debug/net10.0/BimAI.API.dll", + "args": [], + "cwd": "${workspaceFolder}/BimAI.API", + "stopAtEntry": false, + "env": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + { + "name": "Web", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build-web", + "program": "${workspaceFolder}/BimAI.UI.Web/bin/Debug/net10.0/BimAI.UI.Web.dll", + "args": [], + "cwd": "${workspaceFolder}/BimAI.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}", + "browser": [ + { + "osx": "Google Chrome", + "linux": "chrome", + "windows": "chrome" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..f1d4ea9 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,77 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build-api", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/BimAI.API/BimAI.API.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "build-web", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/BimAI.UI.Web/BimAI.UI.Web.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish-api", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/BimAI.API/BimAI.API.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish-web", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/BimAI.UI.Web/BimAI.UI.Web.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary;ForceNoAlign" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch-api", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/BimAI.API/BimAI.API.csproj" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch-web", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/BimAI.UI.Web/BimAI.UI.Web.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} diff --git a/BimAI.API/BimAI.API.csproj b/BimAI.API/BimAI.API.csproj index c1025d4..f956276 100644 --- a/BimAI.API/BimAI.API.csproj +++ b/BimAI.API/BimAI.API.csproj @@ -11,12 +11,10 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive all - diff --git a/BimAI.API/Program.cs b/BimAI.API/Program.cs index 1ae4034..5afbfe5 100644 --- a/BimAI.API/Program.cs +++ b/BimAI.API/Program.cs @@ -18,8 +18,6 @@ builder.Services.AddScoped(); builder.Services.AddHttpClient(); builder.Services.AddControllers(); -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); // Start Hangfire section builder.Services.AddHangfire(configuration => configuration @@ -110,11 +108,6 @@ using (var scope = app.Services.CreateScope()) } } -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} app.UseHttpsRedirection(); app.UseCors("AllowAll"); diff --git a/BimAI.API/Services/HangfireAuthorizationFilter.cs b/BimAI.API/Services/HangfireAuthorizationFilter.cs index 863b356..b493842 100644 --- a/BimAI.API/Services/HangfireAuthorizationFilter.cs +++ b/BimAI.API/Services/HangfireAuthorizationFilter.cs @@ -6,20 +6,15 @@ public class HangfireAuthorizationFilter: IDashboardAsyncAuthorizationFilter { public Task AuthorizeAsync(DashboardContext context) { - // just for now - // TODO: add auth - return Task.FromResult(true); - /* var httpContext = context.GetHttpContext(); - + var env = httpContext.RequestServices.GetService(); - if (env.IsDevelopment()) + if (env != null && env.IsDevelopment()) { return Task.FromResult(true); } - - var isAuthenticated = httpContext.User.Identity?.IsAuthenticated ?? false; + + var isAuthenticated = httpContext.User.Identity?.IsAuthenticated ?? false; return Task.FromResult(isAuthenticated); - */ } } \ No newline at end of file diff --git a/BimAI.API/appsettings.Development.json b/BimAI.API/appsettings.Development.json index 1183cd3..2044b0a 100644 --- a/BimAI.API/appsettings.Development.json +++ b/BimAI.API/appsettings.Development.json @@ -1,13 +1,13 @@ { "ConnectionStrings": { - "DefaultConnection": "Server=localhost,1433;Database=bimai;User Id=sa;Password=BimAI_Dev_Pass_2024!;TrustServerCertificate=True;Encrypt=False", - "HangfireConnection": "Server=localhost,1433;Database=bimai;User Id=sa;Password=BimAI_Dev_Pass_2024!;TrustServerCertificate=True;Encrypt=False" + "DefaultConnection": "Server=localhost,1433;Database=bimai;User Id=sa;Password=BimAI_SA_2025x@;TrustServerCertificate=True;Encrypt=False", + "HangfireConnection": "Server=localhost,1433;Database=bimai;User Id=sa;Password=BimAI_SA_2025x@;TrustServerCertificate=True;Encrypt=False" }, "E5_CRM": { "ApiKey": "7e50a8a5-f01f-4fbc-8c1b-59f3fc474bb5" }, "GoogleAuth": { - "ClientId": "1057234319293-r17ocvs40chitgoj4s83nrfd5409rlc4.apps.googleusercontent.com" + "ClientId": "896226687615-rhmqk06t1hvll1hh2gtje2u6nbadtras.apps.googleusercontent.com" }, "JwtSettings": { "SecretKey": "BimAISuperSecretKeyThatMustBeAtLeast32CharactersLong123456789" diff --git a/BimAI.UI.Mobile/BimAI.UI.Mobile.csproj b/BimAI.UI.Mobile/BimAI.UI.Mobile.csproj index 722e701..8a68e22 100644 --- a/BimAI.UI.Mobile/BimAI.UI.Mobile.csproj +++ b/BimAI.UI.Mobile/BimAI.UI.Mobile.csproj @@ -70,14 +70,14 @@ - - - - + + + + - + diff --git a/BimAI.UI.Web/appsettings.Development.json b/BimAI.UI.Web/appsettings.Development.json index 2582959..711c5a8 100644 --- a/BimAI.UI.Web/appsettings.Development.json +++ b/BimAI.UI.Web/appsettings.Development.json @@ -1,6 +1,6 @@ { "GoogleAuth": { - "ClientId": "1057234319293-r17ocvs40chitgoj4s83nrfd5409rlc4.apps.googleusercontent.com" + "ClientId": "896226687615-rhmqk06t1hvll1hh2gtje2u6nbadtras.apps.googleusercontent.com" }, "ApiSettings": { "BaseUrl": "http://localhost:7142" diff --git a/BimAI.sln b/BimAI.sln index b8ee62d..80aa34c 100644 --- a/BimAI.sln +++ b/BimAI.sln @@ -51,8 +51,6 @@ Global {7ACBFE74-E72C-4033-9172-30512233A518}.Release|Any CPU.ActiveCfg = Release|Any CPU {7ACBFE74-E72C-4033-9172-30512233A518}.Release|Any CPU.Build.0 = Release|Any CPU {12FB8E56-08C1-47CF-B0FC-4BE9F01F020A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {12FB8E56-08C1-47CF-B0FC-4BE9F01F020A}.Debug|Any CPU.Build.0 = Debug|Any CPU {12FB8E56-08C1-47CF-B0FC-4BE9F01F020A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {12FB8E56-08C1-47CF-B0FC-4BE9F01F020A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 89ed8e3..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,49 +0,0 @@ -services: - mssql: - image: mcr.microsoft.com/mssql/server:2022-latest - container_name: bimai-mssql - hostname: bimai-mssql - environment: - - ACCEPT_EULA=Y - - SA_PASSWORD=BimAI_Dev_Pass_2024! - - MSSQL_PID=Developer - ports: - - "1433:1433" - volumes: - - mssql-data:/var/opt/mssql - networks: - - bimai-network - healthcheck: - test: /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "BimAI_Dev_Pass_2024!" -C -Q "SELECT 1" || exit 1 - interval: 10s - timeout: 3s - retries: 10 - start_period: 10s - - init-mssql: - image: mcr.microsoft.com/mssql/server:2022-latest - container_name: bimai-init-mssql - restart: "no" - networks: - - bimai-network - depends_on: - mssql: - condition: service_healthy - environment: - - MSSQL_SA_PASSWORD=BimAI_Dev_Pass_2024! - entrypoint: >- - bash -lc " - set -e - for i in {1..30}; do - /opt/mssql-tools18/bin/sqlcmd -S bimai-mssql -U sa -P \"$$MSSQL_SA_PASSWORD\" -C -Q \"SELECT 1\" && break || sleep 2; - done; - /opt/mssql-tools18/bin/sqlcmd -S bimai-mssql -U sa -P \"$$MSSQL_SA_PASSWORD\" -C -Q \"IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = N'bimai') CREATE DATABASE [bimai];\" - " - -networks: - bimai-network: - driver: bridge - -volumes: - mssql-data: - name: bimai-mssql-data