From dc9817809531111c3ae798103a888f3a6d501ba8 Mon Sep 17 00:00:00 2001 From: "Janus C. H. Knudsen" Date: Thu, 26 Jun 2025 21:30:32 +0200 Subject: [PATCH] Different workings --- .gitignore | 2 -- .idea/.idea.PlanTempus/.idea/.gitignore | 13 +++++++++++++ .idea/.idea.PlanTempus/.idea/dataSources.xml | 18 ++++++++++++++++++ .idea/.idea.PlanTempus/.idea/encodings.xml | 4 ++++ .idea/.idea.PlanTempus/.idea/indexLayout.xml | 8 ++++++++ .idea/.idea.PlanTempus/.idea/vcs.xml | 6 ++++++ .kdtooling/crm_connections.kdco | 2 -- Core/CommandQueries/CommandResponse.cs | 5 ++--- .../Users/Create/CommandHandlerDecorator.cs | 2 -- .../Users/Create/CreateUserHandler.cs | 5 +++-- .../Users/Create/UserCreationResult.cs | 8 -------- .../.dbeaver/.project-metadata.json.bak | 2 +- SqlManagement/.dbeaver/project-metadata.json | 2 +- Tests/CommandQueryHandlerTests/HandlerTest.cs | 2 +- 14 files changed, 57 insertions(+), 22 deletions(-) create mode 100644 .idea/.idea.PlanTempus/.idea/.gitignore create mode 100644 .idea/.idea.PlanTempus/.idea/dataSources.xml create mode 100644 .idea/.idea.PlanTempus/.idea/encodings.xml create mode 100644 .idea/.idea.PlanTempus/.idea/indexLayout.xml create mode 100644 .idea/.idea.PlanTempus/.idea/vcs.xml delete mode 100644 .kdtooling/crm_connections.kdco delete mode 100644 PlanTempus.Components/Users/Create/UserCreationResult.cs diff --git a/.gitignore b/.gitignore index 815276b..1ee5385 100644 --- a/.gitignore +++ b/.gitignore @@ -360,5 +360,3 @@ MigrationBackup/ # Fody - auto-generated XML schema FodyWeavers.xsd - -.idea/.idea.PlanTempus/.idea/ diff --git a/.idea/.idea.PlanTempus/.idea/.gitignore b/.idea/.idea.PlanTempus/.idea/.gitignore new file mode 100644 index 0000000..9da28e8 --- /dev/null +++ b/.idea/.idea.PlanTempus/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/.idea.PlanTempus.iml +/contentModel.xml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.PlanTempus/.idea/dataSources.xml b/.idea/.idea.PlanTempus/.idea/dataSources.xml new file mode 100644 index 0000000..ae8ca9e --- /dev/null +++ b/.idea/.idea.PlanTempus/.idea/dataSources.xml @@ -0,0 +1,18 @@ + + + + + postgresql + true + org.postgresql.Driver + jdbc:postgresql://192.168.1.57:5432/ptmain + + + + + + + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/.idea.PlanTempus/.idea/encodings.xml b/.idea/.idea.PlanTempus/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.PlanTempus/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.PlanTempus/.idea/indexLayout.xml b/.idea/.idea.PlanTempus/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.PlanTempus/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.PlanTempus/.idea/vcs.xml b/.idea/.idea.PlanTempus/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/.idea.PlanTempus/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.kdtooling/crm_connections.kdco b/.kdtooling/crm_connections.kdco deleted file mode 100644 index bebc5df..0000000 --- a/.kdtooling/crm_connections.kdco +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/Core/CommandQueries/CommandResponse.cs b/Core/CommandQueries/CommandResponse.cs index 52dd0f5..5ea7168 100644 --- a/Core/CommandQueries/CommandResponse.cs +++ b/Core/CommandQueries/CommandResponse.cs @@ -1,8 +1,7 @@ - -namespace PlanTempus.Core.CommandQueries; +namespace PlanTempus.Core.CommandQueries; /// -/// Represents a response to a command request, typically used in asynchronous operations. +/// Represents a response to a command request /// This class includes details such as a unique request ID, correlation ID, command name, /// transaction ID, creation timestamp, and a URL to check the status of the command. /// diff --git a/PlanTempus.Components/Users/Create/CommandHandlerDecorator.cs b/PlanTempus.Components/Users/Create/CommandHandlerDecorator.cs index c2b7531..dcc629b 100644 --- a/PlanTempus.Components/Users/Create/CommandHandlerDecorator.cs +++ b/PlanTempus.Components/Users/Create/CommandHandlerDecorator.cs @@ -11,8 +11,6 @@ public class CommandHandlerDecorator( { public async Task Handle(TCommand command) { - // var correlationId = Activity.Current?.RootId ?? command.CorrelationId; - using (var operation = telemetryClient.StartOperation($"Handle {decoratedHandler.GetType().FullName}", command.CorrelationId.ToString())) diff --git a/PlanTempus.Components/Users/Create/CreateUserHandler.cs b/PlanTempus.Components/Users/Create/CreateUserHandler.cs index d5acd1c..a0036a9 100644 --- a/PlanTempus.Components/Users/Create/CreateUserHandler.cs +++ b/PlanTempus.Components/Users/Create/CreateUserHandler.cs @@ -25,7 +25,7 @@ namespace PlanTempus.Components.Users.Create @AccessFailedCount, @LockoutEnabled, @IsActive) RETURNING id, created_at, email, is_active"; - var data = await db.Connection.QuerySqlAsync(sql, new + await db.Connection.QuerySqlAsync(sql, new { command.Email, PasswordHash = secureTokenizer.TokenizeText(command.Password), @@ -35,7 +35,8 @@ namespace PlanTempus.Components.Users.Create LockoutEnabled = false, command.IsActive, }); - + //lav en mapping mellem requestid og userid + return new CommandResponse(command.CorrelationId, command.GetType().Name, command.TransactionId); } catch (PostgresException ex) when (ex.SqlState == "23505") diff --git a/PlanTempus.Components/Users/Create/UserCreationResult.cs b/PlanTempus.Components/Users/Create/UserCreationResult.cs deleted file mode 100644 index 35f4aa6..0000000 --- a/PlanTempus.Components/Users/Create/UserCreationResult.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace PlanTempus.Components.Users.Create -{ - public class UserCreationResult - { - public long Id { get; set; } - public DateTime CreatedAt { get; set; } - } -} \ No newline at end of file diff --git a/SqlManagement/.dbeaver/.project-metadata.json.bak b/SqlManagement/.dbeaver/.project-metadata.json.bak index 3200961..fb3fd6a 100644 --- a/SqlManagement/.dbeaver/.project-metadata.json.bak +++ b/SqlManagement/.dbeaver/.project-metadata.json.bak @@ -1 +1 @@ -{"resources":{"Scripts/Script-1.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"},"Scripts/Script.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"},"Scripts/SmartConfigSystem.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptdb01"},"Scripts/grant-privileges.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"}}} \ No newline at end of file +{"resources":{"Scripts/Script-1.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"},"Scripts/Script.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"},"Scripts/SmartConfigSystem.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptdb01"},"Scripts/grant-privileges.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"}}} \ No newline at end of file diff --git a/SqlManagement/.dbeaver/project-metadata.json b/SqlManagement/.dbeaver/project-metadata.json index 3200961..fb3fd6a 100644 --- a/SqlManagement/.dbeaver/project-metadata.json +++ b/SqlManagement/.dbeaver/project-metadata.json @@ -1 +1 @@ -{"resources":{"Scripts/Script-1.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"},"Scripts/Script.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"},"Scripts/SmartConfigSystem.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptdb01"},"Scripts/grant-privileges.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"}}} \ No newline at end of file +{"resources":{"Scripts/Script-1.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"sandbox"},"Scripts/Script.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"},"Scripts/SmartConfigSystem.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptdb01"},"Scripts/grant-privileges.sql":{"default-datasource":"postgres-jdbc-1948450a8b4-5fc9eec404e65c44","default-catalog":"ptmain"}}} \ No newline at end of file diff --git a/Tests/CommandQueryHandlerTests/HandlerTest.cs b/Tests/CommandQueryHandlerTests/HandlerTest.cs index b1c4742..c7d5d69 100644 --- a/Tests/CommandQueryHandlerTests/HandlerTest.cs +++ b/Tests/CommandQueryHandlerTests/HandlerTest.cs @@ -25,7 +25,7 @@ public class HandlerTest : TestFixture var command = new CreateUserCommand { - Email = "lloyd@dumbanddumber.com3", // Lloyd Christmas + Email = "lloyd@dumbanddumber.com5", // Lloyd Christmas Password = "1234AceVentura#LOL", // Ace Ventura IsActive = true, CorrelationId = Guid.NewGuid()