Include shared logging sources in projects & Log admin login and scanner outcomes
Links logging/shared sync result files into the client and adds backend logging abstraction dependency. Adds client-side logs for admin login success/failure and scan processing results.feature/centralized-offline-canteen
parent
e95614f0fb
commit
7b2b9b353e
|
|
@ -12,6 +12,7 @@
|
|||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.11" />
|
||||
<PackageReference Include="MySqlConnector" Version="2.3.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@
|
|||
<Compile Include="..\Services\IRfidService.cs" Link="Services\IRfidService.cs" />
|
||||
<Compile Include="..\Services\ScanResult.cs" Link="Services\ScanResult.cs" />
|
||||
<Compile Include="..\Services\Logger.cs" Link="Services\Logger.cs" />
|
||||
<Compile Include="..\Services\Logging\**\*.cs" LinkBase="Services\Logging" />
|
||||
<Compile Include="..\Services\SyncNowResult.cs" Link="Services\SyncNowResult.cs" />
|
||||
<Compile Include="..\Services\NavigationService.cs" Link="Services\NavigationService.cs" />
|
||||
<Compile Include="..\Services\INavigationService.cs" Link="Services\INavigationService.cs" />
|
||||
<Compile Include="..\Services\AppSession.cs" Link="Services\AppSession.cs" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using UtopiaCanteenSystem.Services;
|
||||
using UtopiaCanteenSystem.Services.Logging;
|
||||
|
||||
namespace UtopiaCanteenSystem.ViewModels;
|
||||
|
||||
|
|
@ -84,6 +85,7 @@ public partial class AdminLoginViewModel : ObservableObject
|
|||
if (!result.Success)
|
||||
{
|
||||
ErrorMessage = "Invalid username or password.";
|
||||
FileLogger.Warn("ClientLogin", $"Admin login failed for user '{user}'.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -95,6 +97,10 @@ public partial class AdminLoginViewModel : ObservableObject
|
|||
_employeeLookup,
|
||||
_backendApi).ConfigureAwait(true);
|
||||
|
||||
FileLogger.Info(
|
||||
"ClientLogin",
|
||||
$"Admin login succeeded. EmployeeId={result.EmployeeId}, AdminCardId saved, SiteId={_config.GetSiteId()}");
|
||||
|
||||
// Persist who logged in (for audit / reporting).
|
||||
await _adminAudit.RecordLoginAsync(user, result.EmployeeId).ConfigureAwait(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||
using CommunityToolkit.Mvvm.Input;
|
||||
using UtopiaCanteenSystem.Models;
|
||||
using UtopiaCanteenSystem.Services;
|
||||
using UtopiaCanteenSystem.Services.Logging;
|
||||
|
||||
namespace UtopiaCanteenSystem.ViewModels;
|
||||
|
||||
|
|
@ -570,9 +571,11 @@ public partial class ScannerDashboardViewModel : ObservableObject
|
|||
if (string.IsNullOrWhiteSpace(cardId))
|
||||
return;
|
||||
|
||||
FileLogger.Info("ClientScan", $"Scan started. CardId={LogMasking.MaskCardId(cardId)}");
|
||||
var result = _rfidService.ProcessScanDetailed(cardId);
|
||||
IsSuccess = result.Success;
|
||||
Message = result.Message;
|
||||
FileLogger.Info("ClientScan", $"Scan UI message. Success={result.Success}, Message={result.Message}");
|
||||
|
||||
// Check if this is a site mismatch error
|
||||
if (!result.Success && result.Message.Contains("not allowed to scan here"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue