SHA256
GuestLog - Moved Enums
- Enums moved to Enum folder (by type). - ResultCode class changed to enum to ensure type safety in results.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using Somnia.GuestLog.Enums.Services;
|
||||
using Somnia.GuestLog.Models.Configuration;
|
||||
using Somnia.GuestLog.Utils.DI;
|
||||
|
||||
@@ -11,8 +12,8 @@ public class ConfigFileAddressQueryFactory(
|
||||
{
|
||||
public static void RegisterFactoryItems(IServiceCollection services)
|
||||
{
|
||||
services.AddKeyedTransient<IAddressQueryService, NominatimAddressQueryService>(AddressQueryConfig.AddressQueryProviderEnum.Nominatim);
|
||||
services.AddKeyedTransient<IAddressQueryService, GoogleApiAddressQueryService>(AddressQueryConfig.AddressQueryProviderEnum.GoogleApiV4);
|
||||
services.AddKeyedTransient<IAddressQueryService, NominatimAddressQueryService>(AddressQueryProvider.Nominatim);
|
||||
services.AddKeyedTransient<IAddressQueryService, GoogleApiAddressQueryService>(AddressQueryProvider.GoogleApiV4);
|
||||
}
|
||||
|
||||
public IAddressQueryService GetService()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Somnia.GuestLog.Enums.Services;
|
||||
using Somnia.GuestLog.Infrastructure;
|
||||
using Somnia.GuestLog.Models;
|
||||
using Somnia.GuestLog.Models.DTOs;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Somnia.GuestLog.Enums.UI;
|
||||
using Somnia.GuestLog.Models.DTOs;
|
||||
|
||||
namespace Somnia.GuestLog.Services;
|
||||
@@ -8,10 +9,4 @@ public interface IUserMessageService
|
||||
|
||||
public void ShowResult(Result resultDto);
|
||||
public void ShowResultWithMessage(Result resultDto, string message);
|
||||
|
||||
|
||||
public enum MessageKind
|
||||
{
|
||||
Info, Warning, Error, Success, Normal
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using FluentValidation;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Somnia.GuestLog.Enums.Services;
|
||||
using Somnia.GuestLog.Infrastructure;
|
||||
using Somnia.GuestLog.Models;
|
||||
using Somnia.GuestLog.Models.DTOs;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using MudBlazor;
|
||||
using Somnia.GuestLog.Models;
|
||||
using Somnia.GuestLog.Enums.Services;
|
||||
using Somnia.GuestLog.Enums.UI;
|
||||
using Somnia.GuestLog.Models.DTOs;
|
||||
using Somnia.GuestLog.Resources;
|
||||
using MessageKind = Somnia.GuestLog.Services.IUserMessageService.MessageKind;
|
||||
|
||||
namespace Somnia.GuestLog.Services;
|
||||
|
||||
@@ -59,9 +59,9 @@ public class UserMessageService(
|
||||
snackbar.Add(message: msg, severity: GetSnackbarSeveryForMessageKind(kind));
|
||||
}
|
||||
|
||||
private string GetMsgForResultCode(string resultCode)
|
||||
private string GetMsgForResultCode(ResultCode resultCode)
|
||||
{
|
||||
return _localizer[$"resultCode.{resultCode}"];
|
||||
return _localizer[$"resultCode.{Enum.GetName(resultCode)}"];
|
||||
}
|
||||
|
||||
private static string GetFormatedMessage(string template, params object[]? parameters)
|
||||
|
||||
Reference in New Issue
Block a user