diff --git a/UserService/UserService.Application/Interfaces/ILogger.cs b/UserService/UserService.Application/Interfaces/ILogger.cs new file mode 100644 index 0000000..5a479a0 --- /dev/null +++ b/UserService/UserService.Application/Interfaces/ILogger.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace UserService.Application.Interfaces +{ + public interface ILogger + { + void Log(string message); + } +} \ No newline at end of file diff --git a/UserService/UserService.Application/Interfaces/Persistence/IUserRepository.cs b/UserService/UserService.Application/Interfaces/Persistence/IUserRepository.cs new file mode 100644 index 0000000..b52dcaa --- /dev/null +++ b/UserService/UserService.Application/Interfaces/Persistence/IUserRepository.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using UserService.Domain.Entities; + +namespace UserService.Application.Interfaces.Persistence +{ + + /* All concrete implementations for a user repository will implement this interface */ + public interface IUserRepository + { + + void CreateUser(string email, string password); + + User GetUser(string email); + + } +} \ No newline at end of file diff --git a/UserService/UserService.Application/Interfaces/Persistence/IUserService.cs b/UserService/UserService.Application/Interfaces/Persistence/IUserService.cs new file mode 100644 index 0000000..aa8aa7c --- /dev/null +++ b/UserService/UserService.Application/Interfaces/Persistence/IUserService.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using UserService.Domain.Entities; + +namespace UserService.Application.Interfaces.Persistence +{ + public interface IUserService + { + + void Register(string username, string password); + + User Login(string username, string password); + } +} \ No newline at end of file diff --git a/UserService/UserService.Application/Services/UserService.cs b/UserService/UserService.Application/Services/UserService.cs new file mode 100644 index 0000000..475482a --- /dev/null +++ b/UserService/UserService.Application/Services/UserService.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using UserService.Application.Interfaces; +using UserService.Application.Interfaces.Persistence; +using UserService.Domain.Entities; + +namespace UserService.Application.Services +{ + public class UserService : IUserService + { + + private readonly IUserRepository _userRepository; + private readonly ILogger _logger; + + public UserService(IUserRepository userRepository, ILogger logger) + { + this._userRepository = userRepository; + this._logger = logger; + } + + public void Register(string username, string password) + { + try { + + //logic + + } catch(Exception err) { + _logger.Log(err.Message); + } + } + + public User Login(string username, string password) + { + + throw new NotImplementedException(); + + } + } +} \ No newline at end of file diff --git a/UserService/UserService.Application/UserService.Application.csproj b/UserService/UserService.Application/UserService.Application.csproj index fa71b7a..ceb4a64 100644 --- a/UserService/UserService.Application/UserService.Application.csproj +++ b/UserService/UserService.Application/UserService.Application.csproj @@ -1,5 +1,9 @@  + + + + net8.0 enable diff --git a/UserService/UserService.Application/UserService.Application.sln b/UserService/UserService.Application/UserService.Application.sln new file mode 100644 index 0000000..029f7cf --- /dev/null +++ b/UserService/UserService.Application/UserService.Application.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UserService.Application", "UserService.Application.csproj", "{C43A8D5F-7F20-43D7-9D6F-275641EB9147}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C43A8D5F-7F20-43D7-9D6F-275641EB9147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C43A8D5F-7F20-43D7-9D6F-275641EB9147}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C43A8D5F-7F20-43D7-9D6F-275641EB9147}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C43A8D5F-7F20-43D7-9D6F-275641EB9147}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1E9CE0BC-CBEC-4B1D-BCEA-3E7D7FAFC1AB} + EndGlobalSection +EndGlobal diff --git a/UserService/UserService.Domain/Entities/User.cs b/UserService/UserService.Domain/Entities/User.cs index 9d76b19..522baf0 100644 --- a/UserService/UserService.Domain/Entities/User.cs +++ b/UserService/UserService.Domain/Entities/User.cs @@ -35,7 +35,5 @@ public HashSet GetFollowers() { return this._followers; } - - } \ No newline at end of file