From 81f156475d7e7f4dc774825dc865fad53460780e Mon Sep 17 00:00:00 2001 From: Jeff Leung Date: Tue, 28 Dec 2021 21:52:41 -0800 Subject: [PATCH] Continue to modularize even more components --- .../Interfaces/IMessageHandler.cs | 2 +- .../MessageHandlers}/BaseHandler.cs | 5 ++++- .../MessageHandlers}/MSTeamsHandler.cs | 4 +++- .../MessageHandlers}/SMTPHandler.cs | 6 ++++-- .../TwilioSMSReceiver.Common.csproj | 17 +++++++++++++++++ TwilioSMSReceiver.sln | 6 ++++++ .../Controllers/SMSReceiverController.cs | 3 ++- TwilioSMSReceiver/Program.cs | 3 ++- TwilioSMSReceiver/TwilioSMSReceiver.csproj | 6 +----- 9 files changed, 40 insertions(+), 12 deletions(-) rename {TwilioSMSReceiver => TwilioSMSReceiver.Common}/Interfaces/IMessageHandler.cs (76%) rename {TwilioSMSReceiver/Interfaces => TwilioSMSReceiver.Common/MessageHandlers}/BaseHandler.cs (88%) rename {TwilioSMSReceiver/Interfaces => TwilioSMSReceiver.Common/MessageHandlers}/MSTeamsHandler.cs (92%) rename {TwilioSMSReceiver/Interfaces => TwilioSMSReceiver.Common/MessageHandlers}/SMTPHandler.cs (67%) create mode 100644 TwilioSMSReceiver.Common/TwilioSMSReceiver.Common.csproj diff --git a/TwilioSMSReceiver/Interfaces/IMessageHandler.cs b/TwilioSMSReceiver.Common/Interfaces/IMessageHandler.cs similarity index 76% rename from TwilioSMSReceiver/Interfaces/IMessageHandler.cs rename to TwilioSMSReceiver.Common/Interfaces/IMessageHandler.cs index 5853803..cf9472d 100644 --- a/TwilioSMSReceiver/Interfaces/IMessageHandler.cs +++ b/TwilioSMSReceiver.Common/Interfaces/IMessageHandler.cs @@ -1,6 +1,6 @@ using TwilioSMSReceiver.Data.Models; -namespace TwilioSMSReceiver.Interfaces +namespace TwilioSMSReceiver.Common.Interfaces { public interface IMessageHandler { diff --git a/TwilioSMSReceiver/Interfaces/BaseHandler.cs b/TwilioSMSReceiver.Common/MessageHandlers/BaseHandler.cs similarity index 88% rename from TwilioSMSReceiver/Interfaces/BaseHandler.cs rename to TwilioSMSReceiver.Common/MessageHandlers/BaseHandler.cs index fe15287..ab53059 100644 --- a/TwilioSMSReceiver/Interfaces/BaseHandler.cs +++ b/TwilioSMSReceiver.Common/MessageHandlers/BaseHandler.cs @@ -1,8 +1,11 @@ #nullable disable +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using TwilioSMSReceiver.Common.Interfaces; using TwilioSMSReceiver.Data; using TwilioSMSReceiver.Data.Models; -namespace TwilioSMSReceiver.Interfaces +namespace TwilioSMSReceiver.Common.MessageHandlers { public abstract class BaseHandler : IMessageHandler { diff --git a/TwilioSMSReceiver/Interfaces/MSTeamsHandler.cs b/TwilioSMSReceiver.Common/MessageHandlers/MSTeamsHandler.cs similarity index 92% rename from TwilioSMSReceiver/Interfaces/MSTeamsHandler.cs rename to TwilioSMSReceiver.Common/MessageHandlers/MSTeamsHandler.cs index 7f44e29..eeea927 100644 --- a/TwilioSMSReceiver/Interfaces/MSTeamsHandler.cs +++ b/TwilioSMSReceiver.Common/MessageHandlers/MSTeamsHandler.cs @@ -1,7 +1,9 @@ using TwilioSMSReceiver.Data.Models; using TeamsHook.NET; +using Microsoft.Extensions.Logging; +using TwilioSMSReceiver.Common.MessageHandlers; -namespace TwilioSMSReceiver.Interfaces +namespace TwilioSMSReceiver.Common.Handlers { public class MSTeamsHandler : BaseHandler { diff --git a/TwilioSMSReceiver/Interfaces/SMTPHandler.cs b/TwilioSMSReceiver.Common/MessageHandlers/SMTPHandler.cs similarity index 67% rename from TwilioSMSReceiver/Interfaces/SMTPHandler.cs rename to TwilioSMSReceiver.Common/MessageHandlers/SMTPHandler.cs index 02a2d3d..7db3bb3 100644 --- a/TwilioSMSReceiver/Interfaces/SMTPHandler.cs +++ b/TwilioSMSReceiver.Common/MessageHandlers/SMTPHandler.cs @@ -1,6 +1,8 @@ -using TwilioSMSReceiver.Data.Models; +using Microsoft.Extensions.Logging; +using TwilioSMSReceiver.Common.MessageHandlers; +using TwilioSMSReceiver.Data.Models; -namespace TwilioSMSReceiver.Interfaces +namespace TwilioSMSReceiver.Common.Handlers { public class SMTPHandler : BaseHandler { diff --git a/TwilioSMSReceiver.Common/TwilioSMSReceiver.Common.csproj b/TwilioSMSReceiver.Common/TwilioSMSReceiver.Common.csproj new file mode 100644 index 0000000..bf72b9c --- /dev/null +++ b/TwilioSMSReceiver.Common/TwilioSMSReceiver.Common.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + diff --git a/TwilioSMSReceiver.sln b/TwilioSMSReceiver.sln index 1f428f8..bb8b53c 100644 --- a/TwilioSMSReceiver.sln +++ b/TwilioSMSReceiver.sln @@ -10,6 +10,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TwilioSMSReceiver", "Twilio EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TwilioSMSReceiver.Data", "TwilioSMSReceiver.Data\TwilioSMSReceiver.Data.csproj", "{642DADA5-E7A1-4754-A035-E2498C6CCF38}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TwilioSMSReceiver.Common", "TwilioSMSReceiver.Common\TwilioSMSReceiver.Common.csproj", "{09A6960F-AA69-4EF9-94DC-9BA5FDBB4E4A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -24,6 +26,10 @@ Global {642DADA5-E7A1-4754-A035-E2498C6CCF38}.Debug|Any CPU.Build.0 = Debug|Any CPU {642DADA5-E7A1-4754-A035-E2498C6CCF38}.Release|Any CPU.ActiveCfg = Release|Any CPU {642DADA5-E7A1-4754-A035-E2498C6CCF38}.Release|Any CPU.Build.0 = Release|Any CPU + {09A6960F-AA69-4EF9-94DC-9BA5FDBB4E4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {09A6960F-AA69-4EF9-94DC-9BA5FDBB4E4A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {09A6960F-AA69-4EF9-94DC-9BA5FDBB4E4A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {09A6960F-AA69-4EF9-94DC-9BA5FDBB4E4A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/TwilioSMSReceiver/Controllers/SMSReceiverController.cs b/TwilioSMSReceiver/Controllers/SMSReceiverController.cs index 259e2c4..31c5265 100644 --- a/TwilioSMSReceiver/Controllers/SMSReceiverController.cs +++ b/TwilioSMSReceiver/Controllers/SMSReceiverController.cs @@ -10,7 +10,8 @@ using Twilio.AspNet.Common; using TwilioSMSReceiver; using TwilioSMSReceiver.Data; using TwilioSMSReceiver.Data.Models; -using TwilioSMSReceiver.Interfaces; +using TwilioSMSReceiver.Common.Interfaces; +using TwilioSMSReceiver.Common.Handlers; namespace TwilioSMSReceiver.Controllers { diff --git a/TwilioSMSReceiver/Program.cs b/TwilioSMSReceiver/Program.cs index 53271b8..0b9a590 100644 --- a/TwilioSMSReceiver/Program.cs +++ b/TwilioSMSReceiver/Program.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using TwilioSMSReceiver; -using TwilioSMSReceiver.Interfaces; +using TwilioSMSReceiver.Common.Handlers; +using TwilioSMSReceiver.Common.Interfaces; using TwilioSMSReceiver.Data; var builder = WebApplication.CreateBuilder(args); diff --git a/TwilioSMSReceiver/TwilioSMSReceiver.csproj b/TwilioSMSReceiver/TwilioSMSReceiver.csproj index d2b0211..8400d44 100644 --- a/TwilioSMSReceiver/TwilioSMSReceiver.csproj +++ b/TwilioSMSReceiver/TwilioSMSReceiver.csproj @@ -25,11 +25,7 @@ - - - - - +