Skip to content

Commit 823eae0

Browse files
committed
Reorganize application services
1 parent 6630dc1 commit 823eae0

File tree

8 files changed

+38
-23
lines changed

8 files changed

+38
-23
lines changed

RealTimeWeatherMonitoringApp/Application/Interfaces/Core/IParsingStrategy.cs renamed to RealTimeWeatherMonitoringApp/Application/Interfaces/IParsingStrategy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace RealTimeWeatherMonitoringApp.Application.Interfaces.Core;
1+
namespace RealTimeWeatherMonitoringApp.Application.Interfaces;
22

33
/// <summary>
44
/// Defines a strategy for parsing a string into an instance of type <typeparamref name="TResult"/>.

RealTimeWeatherMonitoringApp/Application/Interfaces/IWeatherDataProcessor.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

RealTimeWeatherMonitoringApp/Application/Interfaces/Core/IAutoParsingService.cs renamed to RealTimeWeatherMonitoringApp/Application/Interfaces/Service/IAutoParsingService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using RealTimeWeatherMonitoringApp.Application.Common;
22

3-
namespace RealTimeWeatherMonitoringApp.Application.Interfaces.Core;
3+
namespace RealTimeWeatherMonitoringApp.Application.Interfaces.Service;
44

55
/// <summary>
66
/// Automatically selects and applies the appropriate parsing strategy

RealTimeWeatherMonitoringApp/Application/Interfaces/IBotNotificationService.cs renamed to RealTimeWeatherMonitoringApp/Application/Interfaces/Service/IBotNotificationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using RealTimeWeatherMonitoringApp.Domain.Common;
22

3-
namespace RealTimeWeatherMonitoringApp.Application.Interfaces;
3+
namespace RealTimeWeatherMonitoringApp.Application.Interfaces.Service;
44

55
public interface IBotNotificationService
66
{
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using RealTimeWeatherMonitoringApp.Domain.Common;
2+
3+
namespace RealTimeWeatherMonitoringApp.Application.Interfaces.Service;
4+
5+
/// <summary>
6+
/// Responsible for handling published bot events
7+
/// </summary>
8+
public interface IBotPublishingService
9+
{
10+
void Publish(BotEventArgs e);
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using RealTimeWeatherMonitoringApp.Application.Common;
2+
3+
namespace RealTimeWeatherMonitoringApp.Application.Interfaces.Service;
4+
5+
/// <summary>
6+
/// Responsible for passing processed data to the system
7+
/// </summary>
8+
/// <typeparam name="TData">The data to be processed and passed</typeparam>
9+
public interface IDataProcessingService<TData>
10+
{
11+
/// <summary>
12+
/// Parses the provided input string to extract data and passes the result through the system.
13+
/// </summary>
14+
/// <param name="input">The raw input string containing data to be parsed.</param>
15+
/// <returns>A <see cref="ParsingResult{TData}"/> object that encapsulates the result of the parsing operation,
16+
/// indicating success or failure, and containing the parsed <see cref="TData"/> if successful.</returns>
17+
ParsingResult<TData> Process(string input);
18+
}

RealTimeWeatherMonitoringApp/Application/Service/BotEventDispatcher.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
using RealTimeWeatherMonitoringApp.Application.Interfaces;
1+
using RealTimeWeatherMonitoringApp.Application.Interfaces.Service;
22
using RealTimeWeatherMonitoringApp.Domain.Common;
3-
using RealTimeWeatherMonitoringApp.Domain.Interfaces;
43

54
namespace RealTimeWeatherMonitoringApp.Application.Service;
65

RealTimeWeatherMonitoringApp/Presentation/UserController.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.Extensions.DependencyInjection;
2-
using RealTimeWeatherMonitoringApp.Application.Interfaces;
2+
using RealTimeWeatherMonitoringApp.Application.Interfaces.Service;
3+
using RealTimeWeatherMonitoringApp.Domain.Models;
34

45
namespace RealTimeWeatherMonitoringApp.Presentation;
56

@@ -8,9 +9,11 @@ public class UserController
89
private readonly IServiceProvider _provider;
910
public UserController(IServiceProvider provider) => _provider = provider;
1011

11-
private IWeatherDataProcessor WeatherDataProcessor => _provider.GetRequiredService<IWeatherDataProcessor>();
1212
private IBotNotificationService BotNotificationService => _provider.GetRequiredService<IBotNotificationService>();
1313

14+
private IDataProcessingService<WeatherData> WeatherDataProcessor =>
15+
_provider.GetRequiredService<IDataProcessingService<WeatherData>>();
16+
1417
public void Start()
1518
{
1619
BotNotificationService.OnBotNotification += (_, args) => Console.WriteLine(args.Message);

0 commit comments

Comments
 (0)