Skip to content

Commit

Permalink
Refactoring of report processors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryba1986 committed Jul 5, 2022
1 parent 67a775a commit 53e439d
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 46 deletions.
21 changes: 0 additions & 21 deletions src/Zeus.Infrastructure/Configuration/Modules/PlcModule.cs

This file was deleted.

24 changes: 22 additions & 2 deletions src/Zeus.Infrastructure/Configuration/Modules/ReportModule.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
using Autofac;
using Zeus.Enums.Plcs;
using Zeus.Enums.Reports;
using Zeus.Infrastructure.Reports;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Plcs;
using Zeus.Infrastructure.Reports.Plcs.Base;
using Zeus.Infrastructure.Reports.Types;
using Zeus.Infrastructure.Reports.Types.Base;

namespace Zeus.Infrastructure.Configuration.Modules
{
internal sealed class ReportModule : Module
{
protected override void Load(ContainerBuilder builder)
{
RegisterPlcProcessors(builder);
RegisterTypeProcessors(builder);
}

private static void RegisterPlcProcessors(ContainerBuilder builder)
{
builder
.RegisterType<MeterPlcProcessor>()
.Keyed<IPlcProcessor>(PlcType.Meter);

builder
.RegisterType<Rvd145PlcProcessor>()
.Keyed<IPlcProcessor>(PlcType.Rvd145);
}

private static void RegisterTypeProcessors(ContainerBuilder builder)
{
builder
.RegisterType<DayReportProcessor>()
Expand Down
1 change: 0 additions & 1 deletion src/Zeus.Infrastructure/Configuration/ZeusModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ private void RegisterMappers(ContainerBuilder builder)
private void RegisterModules(ContainerBuilder builder)
{
builder.RegisterModule<MongoModule>();
builder.RegisterModule<PlcModule>();
builder.RegisterModule<ReportModule>();
builder.RegisterModule<MediatorModule>();
builder.RegisterModule(new SettingsModule(_configuration));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
using Zeus.Infrastructure.Extensions;
using Zeus.Infrastructure.Handlers.Base;
using Zeus.Infrastructure.Mongo;
using Zeus.Infrastructure.Plc.Base;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Plcs.Base;
using Zeus.Infrastructure.Reports.Types.Base;
using Zeus.Infrastructure.Repositories;
using Zeus.Models.Devices.Dto;
using Zeus.Models.Locations.Dto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using Zeus.Domain.Base;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Types.Base;
using Zeus.Models.Base.Dto;
using Zeus.Models.Devices.Dto;
using Zeus.Models.Utilities;

namespace Zeus.Infrastructure.Plc.Base
namespace Zeus.Infrastructure.Reports.Plcs.Base
{
internal abstract class BasePlcProcessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
using System.Threading.Tasks;
using AutoMapper;
using OfficeOpenXml;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Types.Base;
using Zeus.Infrastructure.Repositories;
using Zeus.Models.Devices.Dto;

namespace Zeus.Infrastructure.Plc.Base
namespace Zeus.Infrastructure.Reports.Plcs.Base
{
internal interface IPlcProcessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
using OfficeOpenXml;
using Zeus.Domain.Plcs.Meters;
using Zeus.Infrastructure.Mongo;
using Zeus.Infrastructure.Plc.Base;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Plcs.Base;
using Zeus.Infrastructure.Reports.Types.Base;
using Zeus.Infrastructure.Repositories;
using Zeus.Models.Devices.Dto;
using Zeus.Models.Plcs.Meters.Dto;
using Zeus.Models.Utilities;
using Zeus.Utilities.Extensions;

namespace Zeus.Infrastructure.Plc
namespace Zeus.Infrastructure.Reports.Plcs
{
internal sealed class MeterPlcProcessor : BasePlcProcessor, IPlcProcessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
using MongoDB.Driver;
using OfficeOpenXml;
using Zeus.Domain.Plcs.Rvds;
using Zeus.Infrastructure.Plc.Base;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Plcs.Base;
using Zeus.Infrastructure.Reports.Types.Base;
using Zeus.Infrastructure.Repositories;
using Zeus.Models.Devices.Dto;
using Zeus.Models.Plcs.Rvds.Dto;
using Zeus.Utilities.Extensions;

namespace Zeus.Infrastructure.Plc
namespace Zeus.Infrastructure.Reports.Plcs
{
internal sealed class Rvd145PlcProcessor : BasePlcProcessor, IPlcProcessor
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Zeus.Models.Utilities;

namespace Zeus.Infrastructure.Reports.Base
namespace Zeus.Infrastructure.Reports.Types.Base
{
internal abstract class BaseReportProcessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Zeus.Enums.Reports;
using Zeus.Models.Utilities;

namespace Zeus.Infrastructure.Reports.Base
namespace Zeus.Infrastructure.Reports.Types.Base
{
internal interface IReportProcessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Linq.Expressions;
using Zeus.Domain.Base;
using Zeus.Enums.Reports;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Types.Base;
using Zeus.Models.Utilities;

namespace Zeus.Infrastructure.Reports
namespace Zeus.Infrastructure.Reports.Types
{
internal sealed class DayOfYearReportProcessor : BaseReportProcessor, IReportProcessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Linq.Expressions;
using Zeus.Domain.Base;
using Zeus.Enums.Reports;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Types.Base;
using Zeus.Models.Utilities;

namespace Zeus.Infrastructure.Reports
namespace Zeus.Infrastructure.Reports.Types
{
internal sealed class DayReportProcessor : BaseReportProcessor, IReportProcessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Linq.Expressions;
using Zeus.Domain.Base;
using Zeus.Enums.Reports;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Types.Base;
using Zeus.Models.Utilities;

namespace Zeus.Infrastructure.Reports
namespace Zeus.Infrastructure.Reports.Types
{
internal sealed class MonthReportProcessor : BaseReportProcessor, IReportProcessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Linq.Expressions;
using Zeus.Domain.Base;
using Zeus.Enums.Reports;
using Zeus.Infrastructure.Reports.Base;
using Zeus.Infrastructure.Reports.Types.Base;
using Zeus.Models.Utilities;

namespace Zeus.Infrastructure.Reports
namespace Zeus.Infrastructure.Reports.Types
{
internal sealed class YearReportProcessor : BaseReportProcessor, IReportProcessor
{
Expand Down

0 comments on commit 53e439d

Please sign in to comment.