From ae2ea510608810b1a3980ef44fccd20ead63e03b5bc500febb6df6a009b87609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= <93217193+Daniel-Garmig@users.noreply.github.com> Date: Thu, 10 Sep 2026 11:26:21 +0200 Subject: [PATCH] Small fixes and improvements: - Show app version on Sidebar. - StayEntryForm - Remove unnecesary refs to components. - Fixed some result and log messages in entity services. --- src/Somnia.GuestLog/Components/Forms/StayEntryForm.razor | 6 ++---- src/Somnia.GuestLog/Components/Layout/MainLayout.razor | 4 ++++ src/Somnia.GuestLog/Models/Entities/GuestDocument.cs | 1 + .../Services/Entity/StayEntryEntityService.cs | 2 +- .../Services/Entity/StayExportFileEntityService.cs | 8 +++++--- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Somnia.GuestLog/Components/Forms/StayEntryForm.razor b/src/Somnia.GuestLog/Components/Forms/StayEntryForm.razor index bf69078..37c8698 100644 --- a/src/Somnia.GuestLog/Components/Forms/StayEntryForm.razor +++ b/src/Somnia.GuestLog/Components/Forms/StayEntryForm.razor @@ -21,12 +21,12 @@ - - PaymentMethodSet diff --git a/src/Somnia.GuestLog/Components/Layout/MainLayout.razor b/src/Somnia.GuestLog/Components/Layout/MainLayout.razor index 423c19c..a0b9f62 100644 --- a/src/Somnia.GuestLog/Components/Layout/MainLayout.razor +++ b/src/Somnia.GuestLog/Components/Layout/MainLayout.razor @@ -22,6 +22,10 @@ + + + @AppSettings.AppName - @AppSettings.AppVersion + @Body diff --git a/src/Somnia.GuestLog/Models/Entities/GuestDocument.cs b/src/Somnia.GuestLog/Models/Entities/GuestDocument.cs index 6e28df0..4e7776d 100644 --- a/src/Somnia.GuestLog/Models/Entities/GuestDocument.cs +++ b/src/Somnia.GuestLog/Models/Entities/GuestDocument.cs @@ -33,4 +33,5 @@ public class GuestDocument : BaseEntity public override string GetFullKey() => $"{Id}-{Version}"; + public string FullDocument => $"{DocumentType}-{DocumentNum}"; } \ No newline at end of file diff --git a/src/Somnia.GuestLog/Services/Entity/StayEntryEntityService.cs b/src/Somnia.GuestLog/Services/Entity/StayEntryEntityService.cs index c326176..000acae 100644 --- a/src/Somnia.GuestLog/Services/Entity/StayEntryEntityService.cs +++ b/src/Somnia.GuestLog/Services/Entity/StayEntryEntityService.cs @@ -56,7 +56,7 @@ public class StayEntryEntityService( if (isInOtherStay) { string period = $"{dbStay.DateIn}-{dbStay.DateOut}"; - return Result.FailWithContext(ResultCode.GuestCurrentlyInStay, dbGuest.GetFullKey(), period); + return Result.FailWithContext(ResultCode.GuestCurrentlyInStay, dbGuest.FullDocument, period); } //Add dbGuest to dbStay. diff --git a/src/Somnia.GuestLog/Services/Entity/StayExportFileEntityService.cs b/src/Somnia.GuestLog/Services/Entity/StayExportFileEntityService.cs index f22609f..6da3723 100644 --- a/src/Somnia.GuestLog/Services/Entity/StayExportFileEntityService.cs +++ b/src/Somnia.GuestLog/Services/Entity/StayExportFileEntityService.cs @@ -46,12 +46,14 @@ public class StayExportFileEntityService( await dbContext.AddAsync(dbItem); await dbContext.SaveChangesAsync(); - logger.LogInformation("StayExportFileService - CreateStayExportAsync: GuestDocument Created: '{id}'", dbItem.GetFullKey()); + logger.LogInformation( + "StayExportFileService - CreateStayExportAsync: StayExport Created (ID: '{id}') with result: '{result}'", + dbItem.GetFullKey(), dbItem.ExportResult); return Result.Ok(); } catch (Exception ex) { - logger.LogError(ex, "StayExportFileService - CreateStayExportAsync: Error creating GuestDocument"); + logger.LogError(ex, "StayExportFileService - CreateStayExportAsync: Error creating StayExport"); return Result.FailUnknownError(); } } @@ -83,7 +85,7 @@ public class StayExportFileEntityService( } catch (Exception ex) { - logger.LogError(ex, "StayExportFileService - DeleteStayExportAsync: Error creating GuestDocument"); + logger.LogError(ex, "StayExportFileService - DeleteStayExportAsync: Error deleting StayExport"); return Result.FailUnknownError(); } }