diff --git a/DDD_Bug_Tracking_ERD.png b/DDD_Bug_Tracking_ERD.png new file mode 100644 index 0000000..76202e4 Binary files /dev/null and b/DDD_Bug_Tracking_ERD.png differ diff --git a/SearchBugs.Application.UnitTests/UnitTest1.cs b/SearchBugs.Application.UnitTests/UnitTest1.cs deleted file mode 100644 index ff120a4..0000000 --- a/SearchBugs.Application.UnitTests/UnitTest1.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace SearchBugs.Application.UnitTests -{ - public class UnitTest1 - { - [Fact] - public void Test1() - { - - } - } -} \ No newline at end of file diff --git a/SearchBugs.Domain/Bugs/TimeTracingId.cs b/SearchBugs.Domain/Bugs/TimeTracingId.cs deleted file mode 100644 index 0506ad3..0000000 --- a/SearchBugs.Domain/Bugs/TimeTracingId.cs +++ /dev/null @@ -1,5 +0,0 @@ -using Shared.Primitives; - -namespace SearchBugs.Domain.Bugs; - -public record TimeTracingId(Guid Value) : IEntityId; diff --git a/SearchBugs.Domain/Projects/IProjectRepository.cs b/SearchBugs.Domain/Projects/IProjectRepository.cs deleted file mode 100644 index 6dfc687..0000000 --- a/SearchBugs.Domain/Projects/IProjectRepository.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Shared.Results; - -namespace SearchBugs.Domain.Projects; - -public interface IProjectRepository -{ - Task Add(Project project); - - Task> GetByIdAsync(ProjectId projectId, CancellationToken cancellationToken); -} diff --git a/SearchBugs.Domain/Repositories/IGitRepository.cs b/SearchBugs.Domain/Repositories/IGitRepository.cs deleted file mode 100644 index d909496..0000000 --- a/SearchBugs.Domain/Repositories/IGitRepository.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Shared.Results; - -namespace SearchBugs.Domain.Repositories; - -public interface IGitRepository -{ - Task Add(Repository git); - - Task> GetByIdAsync(RepositoryId id, CancellationToken cancellationToken = default); -} diff --git a/SearchBugs.Infrastructure.UnitTests/UnitTest1.cs b/SearchBugs.Infrastructure.UnitTests/UnitTest1.cs deleted file mode 100644 index 780d29a..0000000 --- a/SearchBugs.Infrastructure.UnitTests/UnitTest1.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace SearchBugs.Infrastructure.UnitTests -{ - public class UnitTest1 - { - [Fact] - public void Test1() - { - - } - } -} \ No newline at end of file diff --git a/SearchBugs.Persistence.UnitTests/UnitTest1.cs b/SearchBugs.Persistence.UnitTests/UnitTest1.cs deleted file mode 100644 index 6339b5d..0000000 --- a/SearchBugs.Persistence.UnitTests/UnitTest1.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace SearchBugs.Persistence.UnitTests -{ - public class UnitTest1 - { - [Fact] - public void Test1() - { - - } - } -} \ No newline at end of file diff --git a/SearchBugs.Persistence/Repositories/Repository.cs b/SearchBugs.Persistence/Repositories/Repository.cs deleted file mode 100644 index 2a8f0c5..0000000 --- a/SearchBugs.Persistence/Repositories/Repository.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Shared.Primitives; - -namespace SearchBugs.Persistence.Repositories; - -internal abstract class Repository - where TEntity : Entity - where TEntityId : class, IEntityId -{ - protected readonly ApplicationDbContext DbContext; - - protected Repository(ApplicationDbContext dbContext) - { - DbContext = dbContext; - } - - public virtual Task GetByIdAsync(TEntityId id) - { - return DbContext.Set() - .SingleOrDefaultAsync(p => p.Id == id); - } - - public async Task Add(TEntity entity) - { - await DbContext.Set().AddAsync(entity); - } - - public void Update(TEntity entity) - { - DbContext.Set().Update(entity); - } - - public void Remove(TEntity entity) - { - DbContext.Set().Remove(entity); - } -} \ No newline at end of file diff --git a/SearchBugs.sln b/SearchBugs.sln index e824f0f..7c29db9 100644 --- a/SearchBugs.sln +++ b/SearchBugs.sln @@ -3,113 +3,179 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.10.35027.167 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{50F08F0A-F7E8-4535-BA79-0D0EBB1DF851}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SearchBugs.Api", "SearchBugs.Api\SearchBugs.Api.csproj", "{C3EBC14A-19D9-4677-B40F-096C452126B6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SearchBugs.Application", "SearchBugs.Application\SearchBugs.Application.csproj", "{2718D6F7-5AEC-4B08-9241-1641A9944B09}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SearchBugs.Domain", "SearchBugs.Domain\SearchBugs.Domain.csproj", "{83894DF2-E283-4C8D-A336-FE1773BF8C0E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SearchBugs.Infrastructure", "SearchBugs.Infrastructure\SearchBugs.Infrastructure.csproj", "{3D5430A2-BE51-4430-AF63-83A418454CA6}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FF775789-F110-4C3A-8BA0-58A5C1741F57}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore Api.md = Api.md - ..\..\..\Downloads\DDD_Bug_Tracking_ERD.png = ..\..\..\Downloads\DDD_Bug_Tracking_ERD.png + DDD_Bug_Tracking_ERD.png Role.md = Role.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SearchBugs.Persistence", "SearchBugs.Persistence\SearchBugs.Persistence.csproj", "{7E917907-F9D9-48D1-8968-8AA8E88F13FD}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{BA111FF4-F6A7-4C71-9A97-2AAADBC65D59}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "Shared\Shared.csproj", "{91E839BC-EFCA-4057-9DE2-931533A4620C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchBugs.Api", "src\SearchBugs.Api\SearchBugs.Api.csproj", "{A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3D6F2D6C-C925-4D72-B84F-9371FF4AFDFD}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchBugs.Application", "src\SearchBugs.Application\SearchBugs.Application.csproj", "{D91FEF9E-0F95-47FB-A371-A648E4ED0459}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SearchBugs.Application.UnitTests", "SearchBugs.Application.UnitTests\SearchBugs.Application.UnitTests.csproj", "{25ED865B-5AEB-47FF-8242-03971ECA1426}" - ProjectSection(ProjectDependencies) = postProject - {2718D6F7-5AEC-4B08-9241-1641A9944B09} = {2718D6F7-5AEC-4B08-9241-1641A9944B09} - {83894DF2-E283-4C8D-A336-FE1773BF8C0E} = {83894DF2-E283-4C8D-A336-FE1773BF8C0E} - EndProjectSection +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchBugs.Domain", "src\SearchBugs.Domain\SearchBugs.Domain.csproj", "{82BFCAE3-866F-4308-9DF3-F1DE34170079}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SearchBugs.Domain.UnitTests", "SearchBugs.Domain.UnitTests\SearchBugs.Domain.UnitTests.csproj", "{4789BAED-FBB0-4F94-8F0A-B60EC82A4947}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchBugs.Infrastructure", "src\SearchBugs.Infrastructure\SearchBugs.Infrastructure.csproj", "{44451907-C84D-4F23-9672-DD05E7D16FE5}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SearchBugs.Infrastructure.UnitTests", "SearchBugs.Infrastructure.UnitTests\SearchBugs.Infrastructure.UnitTests.csproj", "{9A64B6F5-37EC-4938-BA12-0C69427FEB99}" - ProjectSection(ProjectDependencies) = postProject - {3D5430A2-BE51-4430-AF63-83A418454CA6} = {3D5430A2-BE51-4430-AF63-83A418454CA6} - {91E839BC-EFCA-4057-9DE2-931533A4620C} = {91E839BC-EFCA-4057-9DE2-931533A4620C} - EndProjectSection +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchBugs.Persistence", "src\SearchBugs.Persistence\SearchBugs.Persistence.csproj", "{8212425B-C312-451E-AE07-E8F2C056F10E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SearchBugs.Persistence.UnitTests", "SearchBugs.Persistence.UnitTests\SearchBugs.Persistence.UnitTests.csproj", "{214EDAB4-2261-49B2-A166-2DC93548C399}" - ProjectSection(ProjectDependencies) = postProject - {7E917907-F9D9-48D1-8968-8AA8E88F13FD} = {7E917907-F9D9-48D1-8968-8AA8E88F13FD} - {91E839BC-EFCA-4057-9DE2-931533A4620C} = {91E839BC-EFCA-4057-9DE2-931533A4620C} - EndProjectSection +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "src\Shared\Shared.csproj", "{23DF96AA-E548-4361-8F01-F1C7D20F1035}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{5906BAC3-BDF7-4DE7-8A3B-69288741593D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchBugs.Application.UnitTests", "test\SearchBugs.Application.UnitTests\SearchBugs.Application.UnitTests.csproj", "{85017282-46A0-4185-AC7E-56653BDDD975}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchBugs.Infrastructure.UnitTests", "test\SearchBugs.Infrastructure.UnitTests\SearchBugs.Infrastructure.UnitTests.csproj", "{B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchBugs.Persistence.UnitTests", "test\SearchBugs.Persistence.UnitTests\SearchBugs.Persistence.UnitTests.csproj", "{DB3336BD-DC48-48D9-9A59-E603D92C325B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchBugs.Domain.UnitTests", "test\SearchBugs.Domain.UnitTests\SearchBugs.Domain.UnitTests.csproj", "{E750EF46-3355-4296-AC53-47A7DD1B99FA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C3EBC14A-19D9-4677-B40F-096C452126B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C3EBC14A-19D9-4677-B40F-096C452126B6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C3EBC14A-19D9-4677-B40F-096C452126B6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C3EBC14A-19D9-4677-B40F-096C452126B6}.Release|Any CPU.Build.0 = Release|Any CPU - {2718D6F7-5AEC-4B08-9241-1641A9944B09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2718D6F7-5AEC-4B08-9241-1641A9944B09}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2718D6F7-5AEC-4B08-9241-1641A9944B09}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2718D6F7-5AEC-4B08-9241-1641A9944B09}.Release|Any CPU.Build.0 = Release|Any CPU - {83894DF2-E283-4C8D-A336-FE1773BF8C0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {83894DF2-E283-4C8D-A336-FE1773BF8C0E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {83894DF2-E283-4C8D-A336-FE1773BF8C0E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {83894DF2-E283-4C8D-A336-FE1773BF8C0E}.Release|Any CPU.Build.0 = Release|Any CPU - {3D5430A2-BE51-4430-AF63-83A418454CA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3D5430A2-BE51-4430-AF63-83A418454CA6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3D5430A2-BE51-4430-AF63-83A418454CA6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3D5430A2-BE51-4430-AF63-83A418454CA6}.Release|Any CPU.Build.0 = Release|Any CPU - {7E917907-F9D9-48D1-8968-8AA8E88F13FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E917907-F9D9-48D1-8968-8AA8E88F13FD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E917907-F9D9-48D1-8968-8AA8E88F13FD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E917907-F9D9-48D1-8968-8AA8E88F13FD}.Release|Any CPU.Build.0 = Release|Any CPU - {91E839BC-EFCA-4057-9DE2-931533A4620C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {91E839BC-EFCA-4057-9DE2-931533A4620C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {91E839BC-EFCA-4057-9DE2-931533A4620C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {91E839BC-EFCA-4057-9DE2-931533A4620C}.Release|Any CPU.Build.0 = Release|Any CPU - {25ED865B-5AEB-47FF-8242-03971ECA1426}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {25ED865B-5AEB-47FF-8242-03971ECA1426}.Debug|Any CPU.Build.0 = Debug|Any CPU - {25ED865B-5AEB-47FF-8242-03971ECA1426}.Release|Any CPU.ActiveCfg = Release|Any CPU - {25ED865B-5AEB-47FF-8242-03971ECA1426}.Release|Any CPU.Build.0 = Release|Any CPU - {4789BAED-FBB0-4F94-8F0A-B60EC82A4947}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4789BAED-FBB0-4F94-8F0A-B60EC82A4947}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4789BAED-FBB0-4F94-8F0A-B60EC82A4947}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4789BAED-FBB0-4F94-8F0A-B60EC82A4947}.Release|Any CPU.Build.0 = Release|Any CPU - {9A64B6F5-37EC-4938-BA12-0C69427FEB99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9A64B6F5-37EC-4938-BA12-0C69427FEB99}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9A64B6F5-37EC-4938-BA12-0C69427FEB99}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9A64B6F5-37EC-4938-BA12-0C69427FEB99}.Release|Any CPU.Build.0 = Release|Any CPU - {214EDAB4-2261-49B2-A166-2DC93548C399}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {214EDAB4-2261-49B2-A166-2DC93548C399}.Debug|Any CPU.Build.0 = Debug|Any CPU - {214EDAB4-2261-49B2-A166-2DC93548C399}.Release|Any CPU.ActiveCfg = Release|Any CPU - {214EDAB4-2261-49B2-A166-2DC93548C399}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Debug|x64.ActiveCfg = Debug|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Debug|x64.Build.0 = Debug|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Debug|x86.ActiveCfg = Debug|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Debug|x86.Build.0 = Debug|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Release|Any CPU.Build.0 = Release|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Release|x64.ActiveCfg = Release|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Release|x64.Build.0 = Release|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Release|x86.ActiveCfg = Release|Any CPU + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E}.Release|x86.Build.0 = Release|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Debug|x64.ActiveCfg = Debug|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Debug|x64.Build.0 = Debug|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Debug|x86.ActiveCfg = Debug|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Debug|x86.Build.0 = Debug|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Release|Any CPU.Build.0 = Release|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Release|x64.ActiveCfg = Release|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Release|x64.Build.0 = Release|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Release|x86.ActiveCfg = Release|Any CPU + {D91FEF9E-0F95-47FB-A371-A648E4ED0459}.Release|x86.Build.0 = Release|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Debug|x64.ActiveCfg = Debug|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Debug|x64.Build.0 = Debug|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Debug|x86.ActiveCfg = Debug|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Debug|x86.Build.0 = Debug|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Release|Any CPU.Build.0 = Release|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Release|x64.ActiveCfg = Release|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Release|x64.Build.0 = Release|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Release|x86.ActiveCfg = Release|Any CPU + {82BFCAE3-866F-4308-9DF3-F1DE34170079}.Release|x86.Build.0 = Release|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Debug|x64.ActiveCfg = Debug|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Debug|x64.Build.0 = Debug|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Debug|x86.ActiveCfg = Debug|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Debug|x86.Build.0 = Debug|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Release|Any CPU.Build.0 = Release|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Release|x64.ActiveCfg = Release|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Release|x64.Build.0 = Release|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Release|x86.ActiveCfg = Release|Any CPU + {44451907-C84D-4F23-9672-DD05E7D16FE5}.Release|x86.Build.0 = Release|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Debug|x64.ActiveCfg = Debug|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Debug|x64.Build.0 = Debug|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Debug|x86.ActiveCfg = Debug|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Debug|x86.Build.0 = Debug|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Release|Any CPU.Build.0 = Release|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Release|x64.ActiveCfg = Release|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Release|x64.Build.0 = Release|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Release|x86.ActiveCfg = Release|Any CPU + {8212425B-C312-451E-AE07-E8F2C056F10E}.Release|x86.Build.0 = Release|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Debug|Any CPU.Build.0 = Debug|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Debug|x64.ActiveCfg = Debug|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Debug|x64.Build.0 = Debug|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Debug|x86.ActiveCfg = Debug|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Debug|x86.Build.0 = Debug|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Release|Any CPU.ActiveCfg = Release|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Release|Any CPU.Build.0 = Release|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Release|x64.ActiveCfg = Release|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Release|x64.Build.0 = Release|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Release|x86.ActiveCfg = Release|Any CPU + {23DF96AA-E548-4361-8F01-F1C7D20F1035}.Release|x86.Build.0 = Release|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Debug|x64.ActiveCfg = Debug|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Debug|x64.Build.0 = Debug|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Debug|x86.ActiveCfg = Debug|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Debug|x86.Build.0 = Debug|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Release|Any CPU.Build.0 = Release|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Release|x64.ActiveCfg = Release|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Release|x64.Build.0 = Release|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Release|x86.ActiveCfg = Release|Any CPU + {85017282-46A0-4185-AC7E-56653BDDD975}.Release|x86.Build.0 = Release|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Debug|x64.ActiveCfg = Debug|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Debug|x64.Build.0 = Debug|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Debug|x86.ActiveCfg = Debug|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Debug|x86.Build.0 = Debug|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Release|Any CPU.Build.0 = Release|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Release|x64.ActiveCfg = Release|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Release|x64.Build.0 = Release|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Release|x86.ActiveCfg = Release|Any CPU + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38}.Release|x86.Build.0 = Release|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Debug|x64.ActiveCfg = Debug|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Debug|x64.Build.0 = Debug|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Debug|x86.ActiveCfg = Debug|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Debug|x86.Build.0 = Debug|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Release|Any CPU.Build.0 = Release|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Release|x64.ActiveCfg = Release|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Release|x64.Build.0 = Release|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Release|x86.ActiveCfg = Release|Any CPU + {DB3336BD-DC48-48D9-9A59-E603D92C325B}.Release|x86.Build.0 = Release|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Debug|x64.ActiveCfg = Debug|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Debug|x64.Build.0 = Debug|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Debug|x86.ActiveCfg = Debug|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Debug|x86.Build.0 = Debug|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Release|Any CPU.Build.0 = Release|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Release|x64.ActiveCfg = Release|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Release|x64.Build.0 = Release|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Release|x86.ActiveCfg = Release|Any CPU + {E750EF46-3355-4296-AC53-47A7DD1B99FA}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution - {C3EBC14A-19D9-4677-B40F-096C452126B6} = {50F08F0A-F7E8-4535-BA79-0D0EBB1DF851} - {2718D6F7-5AEC-4B08-9241-1641A9944B09} = {50F08F0A-F7E8-4535-BA79-0D0EBB1DF851} - {83894DF2-E283-4C8D-A336-FE1773BF8C0E} = {50F08F0A-F7E8-4535-BA79-0D0EBB1DF851} - {3D5430A2-BE51-4430-AF63-83A418454CA6} = {50F08F0A-F7E8-4535-BA79-0D0EBB1DF851} - {7E917907-F9D9-48D1-8968-8AA8E88F13FD} = {50F08F0A-F7E8-4535-BA79-0D0EBB1DF851} - {91E839BC-EFCA-4057-9DE2-931533A4620C} = {50F08F0A-F7E8-4535-BA79-0D0EBB1DF851} - {25ED865B-5AEB-47FF-8242-03971ECA1426} = {3D6F2D6C-C925-4D72-B84F-9371FF4AFDFD} - {4789BAED-FBB0-4F94-8F0A-B60EC82A4947} = {3D6F2D6C-C925-4D72-B84F-9371FF4AFDFD} - {9A64B6F5-37EC-4938-BA12-0C69427FEB99} = {3D6F2D6C-C925-4D72-B84F-9371FF4AFDFD} - {214EDAB4-2261-49B2-A166-2DC93548C399} = {3D6F2D6C-C925-4D72-B84F-9371FF4AFDFD} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {FE66C8F7-24C5-4D13-9065-9782B22FD818} + {A9C3D3AD-ED70-4CE3-ABA8-0997DBFAD45E} = {BA111FF4-F6A7-4C71-9A97-2AAADBC65D59} + {D91FEF9E-0F95-47FB-A371-A648E4ED0459} = {BA111FF4-F6A7-4C71-9A97-2AAADBC65D59} + {82BFCAE3-866F-4308-9DF3-F1DE34170079} = {BA111FF4-F6A7-4C71-9A97-2AAADBC65D59} + {44451907-C84D-4F23-9672-DD05E7D16FE5} = {BA111FF4-F6A7-4C71-9A97-2AAADBC65D59} + {8212425B-C312-451E-AE07-E8F2C056F10E} = {BA111FF4-F6A7-4C71-9A97-2AAADBC65D59} + {23DF96AA-E548-4361-8F01-F1C7D20F1035} = {BA111FF4-F6A7-4C71-9A97-2AAADBC65D59} + {85017282-46A0-4185-AC7E-56653BDDD975} = {5906BAC3-BDF7-4DE7-8A3B-69288741593D} + {B1ACFD57-1FD0-4BB4-9235-87562B5C0C38} = {5906BAC3-BDF7-4DE7-8A3B-69288741593D} + {DB3336BD-DC48-48D9-9A59-E603D92C325B} = {5906BAC3-BDF7-4DE7-8A3B-69288741593D} + {E750EF46-3355-4296-AC53-47A7DD1B99FA} = {5906BAC3-BDF7-4DE7-8A3B-69288741593D} EndGlobalSection EndGlobal diff --git a/SearchBugs.Api/Endpoints/AuthenticationsEndpoints.cs b/src/SearchBugs.Api/Endpoints/AuthenticationsEndpoints.cs similarity index 100% rename from SearchBugs.Api/Endpoints/AuthenticationsEndpoints.cs rename to src/SearchBugs.Api/Endpoints/AuthenticationsEndpoints.cs diff --git a/SearchBugs.Api/Endpoints/BugsEndpoints.cs b/src/SearchBugs.Api/Endpoints/BugsEndpoints.cs similarity index 100% rename from SearchBugs.Api/Endpoints/BugsEndpoints.cs rename to src/SearchBugs.Api/Endpoints/BugsEndpoints.cs diff --git a/SearchBugs.Api/Endpoints/ProjectsEndpoints.cs b/src/SearchBugs.Api/Endpoints/ProjectsEndpoints.cs similarity index 100% rename from SearchBugs.Api/Endpoints/ProjectsEndpoints.cs rename to src/SearchBugs.Api/Endpoints/ProjectsEndpoints.cs diff --git a/SearchBugs.Api/Endpoints/RepoEndpoints.cs b/src/SearchBugs.Api/Endpoints/RepoEndpoints.cs similarity index 100% rename from SearchBugs.Api/Endpoints/RepoEndpoints.cs rename to src/SearchBugs.Api/Endpoints/RepoEndpoints.cs diff --git a/SearchBugs.Api/Endpoints/UserEndpoints.cs b/src/SearchBugs.Api/Endpoints/UserEndpoints.cs similarity index 100% rename from SearchBugs.Api/Endpoints/UserEndpoints.cs rename to src/SearchBugs.Api/Endpoints/UserEndpoints.cs diff --git a/SearchBugs.Api/Extensions/MigrationExtensions.cs b/src/SearchBugs.Api/Extensions/MigrationExtensions.cs similarity index 100% rename from SearchBugs.Api/Extensions/MigrationExtensions.cs rename to src/SearchBugs.Api/Extensions/MigrationExtensions.cs diff --git a/SearchBugs.Api/Middleware/ExceptionHandlingMiddleware.cs b/src/SearchBugs.Api/Middleware/ExceptionHandlingMiddleware.cs similarity index 100% rename from SearchBugs.Api/Middleware/ExceptionHandlingMiddleware.cs rename to src/SearchBugs.Api/Middleware/ExceptionHandlingMiddleware.cs diff --git a/SearchBugs.Api/Program.cs b/src/SearchBugs.Api/Program.cs similarity index 100% rename from SearchBugs.Api/Program.cs rename to src/SearchBugs.Api/Program.cs diff --git a/SearchBugs.Api/Properties/launchSettings.json b/src/SearchBugs.Api/Properties/launchSettings.json similarity index 100% rename from SearchBugs.Api/Properties/launchSettings.json rename to src/SearchBugs.Api/Properties/launchSettings.json diff --git a/SearchBugs.Api/SearchBugs.Api.csproj b/src/SearchBugs.Api/SearchBugs.Api.csproj similarity index 83% rename from SearchBugs.Api/SearchBugs.Api.csproj rename to src/SearchBugs.Api/SearchBugs.Api.csproj index f51aa53..6ee2861 100644 --- a/SearchBugs.Api/SearchBugs.Api.csproj +++ b/src/SearchBugs.Api/SearchBugs.Api.csproj @@ -8,9 +8,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/SearchBugs.Api/SearchBugs.Api.http b/src/SearchBugs.Api/SearchBugs.Api.http similarity index 100% rename from SearchBugs.Api/SearchBugs.Api.http rename to src/SearchBugs.Api/SearchBugs.Api.http diff --git a/SearchBugs.Api/appsettings.Development.json b/src/SearchBugs.Api/appsettings.Development.json similarity index 100% rename from SearchBugs.Api/appsettings.Development.json rename to src/SearchBugs.Api/appsettings.Development.json diff --git a/SearchBugs.Api/appsettings.json b/src/SearchBugs.Api/appsettings.json similarity index 100% rename from SearchBugs.Api/appsettings.json rename to src/SearchBugs.Api/appsettings.json diff --git a/SearchBugs.Application/ApplicationAssemblyReference.cs b/src/SearchBugs.Application/ApplicationAssemblyReference.cs similarity index 100% rename from SearchBugs.Application/ApplicationAssemblyReference.cs rename to src/SearchBugs.Application/ApplicationAssemblyReference.cs diff --git a/SearchBugs.Application/Authentications/AuthValidationErrors.cs b/src/SearchBugs.Application/Authentications/AuthValidationErrors.cs similarity index 100% rename from SearchBugs.Application/Authentications/AuthValidationErrors.cs rename to src/SearchBugs.Application/Authentications/AuthValidationErrors.cs diff --git a/SearchBugs.Application/Authentications/Login/LoginCommand.cs b/src/SearchBugs.Application/Authentications/Login/LoginCommand.cs similarity index 100% rename from SearchBugs.Application/Authentications/Login/LoginCommand.cs rename to src/SearchBugs.Application/Authentications/Login/LoginCommand.cs diff --git a/SearchBugs.Application/Authentications/Login/LoginCommandHandler.cs b/src/SearchBugs.Application/Authentications/Login/LoginCommandHandler.cs similarity index 100% rename from SearchBugs.Application/Authentications/Login/LoginCommandHandler.cs rename to src/SearchBugs.Application/Authentications/Login/LoginCommandHandler.cs diff --git a/SearchBugs.Application/Authentications/Login/LoginCommandValidator.cs b/src/SearchBugs.Application/Authentications/Login/LoginCommandValidator.cs similarity index 100% rename from SearchBugs.Application/Authentications/Login/LoginCommandValidator.cs rename to src/SearchBugs.Application/Authentications/Login/LoginCommandValidator.cs diff --git a/SearchBugs.Application/Authentications/Login/LoginResponse.cs b/src/SearchBugs.Application/Authentications/Login/LoginResponse.cs similarity index 100% rename from SearchBugs.Application/Authentications/Login/LoginResponse.cs rename to src/SearchBugs.Application/Authentications/Login/LoginResponse.cs diff --git a/SearchBugs.Application/Authentications/Register/RegisterCommand.cs b/src/SearchBugs.Application/Authentications/Register/RegisterCommand.cs similarity index 100% rename from SearchBugs.Application/Authentications/Register/RegisterCommand.cs rename to src/SearchBugs.Application/Authentications/Register/RegisterCommand.cs diff --git a/SearchBugs.Application/Authentications/Register/RegisterCommandHandler.cs b/src/SearchBugs.Application/Authentications/Register/RegisterCommandHandler.cs similarity index 100% rename from SearchBugs.Application/Authentications/Register/RegisterCommandHandler.cs rename to src/SearchBugs.Application/Authentications/Register/RegisterCommandHandler.cs diff --git a/SearchBugs.Application/Authentications/Register/RegisterCommandValidator.cs b/src/SearchBugs.Application/Authentications/Register/RegisterCommandValidator.cs similarity index 100% rename from SearchBugs.Application/Authentications/Register/RegisterCommandValidator.cs rename to src/SearchBugs.Application/Authentications/Register/RegisterCommandValidator.cs diff --git a/SearchBugs.Application/BugTracking/BugValidationErrors.cs b/src/SearchBugs.Application/BugTracking/BugValidationErrors.cs similarity index 100% rename from SearchBugs.Application/BugTracking/BugValidationErrors.cs rename to src/SearchBugs.Application/BugTracking/BugValidationErrors.cs diff --git a/SearchBugs.Application/BugTracking/Create/CreateBugCommand.cs b/src/SearchBugs.Application/BugTracking/Create/CreateBugCommand.cs similarity index 100% rename from SearchBugs.Application/BugTracking/Create/CreateBugCommand.cs rename to src/SearchBugs.Application/BugTracking/Create/CreateBugCommand.cs diff --git a/SearchBugs.Application/BugTracking/Create/CreateBugCommandHandler.cs b/src/SearchBugs.Application/BugTracking/Create/CreateBugCommandHandler.cs similarity index 100% rename from SearchBugs.Application/BugTracking/Create/CreateBugCommandHandler.cs rename to src/SearchBugs.Application/BugTracking/Create/CreateBugCommandHandler.cs diff --git a/SearchBugs.Application/BugTracking/Create/CreateBugCommandValidator.cs b/src/SearchBugs.Application/BugTracking/Create/CreateBugCommandValidator.cs similarity index 100% rename from SearchBugs.Application/BugTracking/Create/CreateBugCommandValidator.cs rename to src/SearchBugs.Application/BugTracking/Create/CreateBugCommandValidator.cs diff --git a/SearchBugs.Application/BugTracking/GetBugs/BugsResponse.cs b/src/SearchBugs.Application/BugTracking/GetBugs/BugsResponse.cs similarity index 100% rename from SearchBugs.Application/BugTracking/GetBugs/BugsResponse.cs rename to src/SearchBugs.Application/BugTracking/GetBugs/BugsResponse.cs diff --git a/SearchBugs.Application/BugTracking/GetBugs/GetBugsQuery.cs b/src/SearchBugs.Application/BugTracking/GetBugs/GetBugsQuery.cs similarity index 100% rename from SearchBugs.Application/BugTracking/GetBugs/GetBugsQuery.cs rename to src/SearchBugs.Application/BugTracking/GetBugs/GetBugsQuery.cs diff --git a/SearchBugs.Application/BugTracking/GetBugs/GetBugsQueryHandler.cs b/src/SearchBugs.Application/BugTracking/GetBugs/GetBugsQueryHandler.cs similarity index 51% rename from SearchBugs.Application/BugTracking/GetBugs/GetBugsQueryHandler.cs rename to src/SearchBugs.Application/BugTracking/GetBugs/GetBugsQueryHandler.cs index 5ccdd84..ab22e51 100644 --- a/SearchBugs.Application/BugTracking/GetBugs/GetBugsQueryHandler.cs +++ b/src/SearchBugs.Application/BugTracking/GetBugs/GetBugsQueryHandler.cs @@ -1,5 +1,4 @@ - -using Shared.Data; +using Shared.Data; using Shared.Messaging; using Shared.Results; @@ -21,20 +20,20 @@ public Task>> Handle(GetBugsQuery request, Cancellatio public async Task?> GetBugsByProjectIdAsync(Guid projectId) => await _sqlQueryExecutor.QueryAsync(@" SELECT - b.id as Id, - b.title as Title, - b.description as Description, - s.name as Status, - p.name as Priority, - b.severity as Severity, - p.name as ProjectName, - CONCAT(u.name_first_name,' ',u.name_last_name) as Assignee, - CONCAT(u.name_first_name,' ',u.name_last_name) as Reporter, - b.created_on_utc as CreatedOnUtc, - b.modified_on_utc as UpdatedOnUtc -FROM bug b -JOIN bug_status s ON b.status_id = s.id -JOIN bug_priority p ON b.priority_id = p.id -JOIN ""user"" u ON b.assignee_id = u.id -ORDER BY b.created_on_utc DESC", new { projectId }); + b.id as Id, + b.title as Title, + b.description as Description, + s.name as Status, + p.name as Priority, + b.severity as Severity, + p.name as ProjectName, + CONCAT(u.name_first_name,' ',u.name_last_name) as Assignee, + CONCAT(u.name_first_name,' ',u.name_last_name) as Reporter, + b.created_on_utc as CreatedOnUtc, + b.modified_on_utc as UpdatedOnUtc + FROM bug b + JOIN bug_status s ON b.status_id = s.id + JOIN bug_priority p ON b.priority_id = p.id + JOIN ""user"" u ON b.assignee_id = u.id + ORDER BY b.created_on_utc DESC", new { projectId }); } diff --git a/SearchBugs.Application/DependencyInjection.cs b/src/SearchBugs.Application/DependencyInjection.cs similarity index 78% rename from SearchBugs.Application/DependencyInjection.cs rename to src/SearchBugs.Application/DependencyInjection.cs index 0d0ae5b..cc4e856 100644 --- a/SearchBugs.Application/DependencyInjection.cs +++ b/src/SearchBugs.Application/DependencyInjection.cs @@ -9,12 +9,12 @@ public static IServiceCollection AddApplication(this IServiceCollection services { services.AddMediatR(config => { - config.RegisterServicesFromAssemblyContaining(); + config.RegisterServicesFromAssembly(ApplicationAssemblyReference.Assembly); config.AddOpenBehavior(typeof(ValidationPipelineBehavior<,>)); }); - services.AddValidatorsFromAssembly(ApplicationAssemblyReference.Assembly); + services.AddValidatorsFromAssembly(ApplicationAssemblyReference.Assembly, includeInternalTypes: true); return services; } diff --git a/SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommand.cs b/src/SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommand.cs similarity index 100% rename from SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommand.cs rename to src/SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommand.cs diff --git a/SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommandHandler.cs b/src/SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommandHandler.cs similarity index 100% rename from SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommandHandler.cs rename to src/SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommandHandler.cs diff --git a/SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommandValidator.cs b/src/SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommandValidator.cs similarity index 100% rename from SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommandValidator.cs rename to src/SearchBugs.Application/Git/CreateGitRepo/CreateGitRepoCommandValidator.cs diff --git a/src/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitCommandValidator.cs b/src/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitCommandValidator.cs new file mode 100644 index 0000000..431ef26 --- /dev/null +++ b/src/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitCommandValidator.cs @@ -0,0 +1,14 @@ +using FluentValidation; +using Shared.Extensions; + +namespace SearchBugs.Application.Git.DeleteGitRepo; + +internal sealed class DeleteGitCommandValidator : AbstractValidator +{ + public DeleteGitCommandValidator() + { + RuleFor(x => x.Url) + .NotEmpty() + .WithError(GitValidationErrors.UrlIsRequired); + } +} diff --git a/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitRepoCommand.cs b/src/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitRepoCommand.cs similarity index 55% rename from SearchBugs.Application/Git/DeleteGitRepo/DeleteGitRepoCommand.cs rename to src/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitRepoCommand.cs index 2e95d55..a1dead4 100644 --- a/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitRepoCommand.cs +++ b/src/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitRepoCommand.cs @@ -2,4 +2,4 @@ namespace SearchBugs.Application.Git.DeleteGitRepo; -public sealed class DeleteGitRepoCommand(string Url) : ICommand; +public record DeleteGitRepoCommand(string Url) : ICommand; diff --git a/src/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitRepoCommandHandler.cs b/src/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitRepoCommandHandler.cs new file mode 100644 index 0000000..8638526 --- /dev/null +++ b/src/SearchBugs.Application/Git/DeleteGitRepo/DeleteGitRepoCommandHandler.cs @@ -0,0 +1,34 @@ +using SearchBugs.Domain; +using SearchBugs.Domain.Repositories; +using Shared.Messaging; +using Shared.Results; + +namespace SearchBugs.Application.Git.DeleteGitRepo; + +public sealed class DeleteGitRepoCommandHandler : ICommandHandler +{ + private readonly IGitRepository _gitRepository; + private readonly IUnitOfWork _unitOfWork; + + public DeleteGitRepoCommandHandler(IGitRepository gitRepository, IUnitOfWork unitOfWork) + { + _gitRepository = gitRepository; + _unitOfWork = unitOfWork; + } + + public async Task Handle(DeleteGitRepoCommand request, CancellationToken cancellationToken) + { + var gitRepo = await _gitRepository.GetByUrlAsync(request.Url, cancellationToken); + + if (gitRepo.IsFailure) + { + return Result.Failure(GitValidationErrors.GitRepoNotFound); + } + + await _gitRepository.Remove(gitRepo.Value); + + await _unitOfWork.SaveChangesAsync(cancellationToken); + + return Result.Success(); + } +} diff --git a/SearchBugs.Application/Git/GetGitRepo/GetGitRepoQuery.cs b/src/SearchBugs.Application/Git/GetGitRepo/GetGitRepoQuery.cs similarity index 100% rename from SearchBugs.Application/Git/GetGitRepo/GetGitRepoQuery.cs rename to src/SearchBugs.Application/Git/GetGitRepo/GetGitRepoQuery.cs diff --git a/SearchBugs.Application/Git/GetGitRepo/GetGitRepoQueryHandler.cs b/src/SearchBugs.Application/Git/GetGitRepo/GetGitRepoQueryHandler.cs similarity index 100% rename from SearchBugs.Application/Git/GetGitRepo/GetGitRepoQueryHandler.cs rename to src/SearchBugs.Application/Git/GetGitRepo/GetGitRepoQueryHandler.cs diff --git a/SearchBugs.Application/Git/GetGitRepo/GetGitRepoQueryResult.cs b/src/SearchBugs.Application/Git/GetGitRepo/GetGitRepoQueryResult.cs similarity index 100% rename from SearchBugs.Application/Git/GetGitRepo/GetGitRepoQueryResult.cs rename to src/SearchBugs.Application/Git/GetGitRepo/GetGitRepoQueryResult.cs diff --git a/SearchBugs.Application/Git/GetGitReposDetails/GetGitReposDetailsQuery.cs b/src/SearchBugs.Application/Git/GetGitReposDetails/GetGitReposDetailsQuery.cs similarity index 100% rename from SearchBugs.Application/Git/GetGitReposDetails/GetGitReposDetailsQuery.cs rename to src/SearchBugs.Application/Git/GetGitReposDetails/GetGitReposDetailsQuery.cs diff --git a/SearchBugs.Application/Git/GetGitReposDetails/GetGitReposDetailsQueryHandler.cs b/src/SearchBugs.Application/Git/GetGitReposDetails/GetGitReposDetailsQueryHandler.cs similarity index 100% rename from SearchBugs.Application/Git/GetGitReposDetails/GetGitReposDetailsQueryHandler.cs rename to src/SearchBugs.Application/Git/GetGitReposDetails/GetGitReposDetailsQueryHandler.cs diff --git a/SearchBugs.Application/Git/GetGitReposDetails/GitRepoTreeResult.cs b/src/SearchBugs.Application/Git/GetGitReposDetails/GitRepoTreeResult.cs similarity index 100% rename from SearchBugs.Application/Git/GetGitReposDetails/GitRepoTreeResult.cs rename to src/SearchBugs.Application/Git/GetGitReposDetails/GitRepoTreeResult.cs diff --git a/SearchBugs.Application/Git/GitHttpServer/GitHttpServerCommand.cs b/src/SearchBugs.Application/Git/GitHttpServer/GitHttpServerCommand.cs similarity index 100% rename from SearchBugs.Application/Git/GitHttpServer/GitHttpServerCommand.cs rename to src/SearchBugs.Application/Git/GitHttpServer/GitHttpServerCommand.cs diff --git a/SearchBugs.Application/Git/GitHttpServer/GitHttpServerCommandHandler.cs b/src/SearchBugs.Application/Git/GitHttpServer/GitHttpServerCommandHandler.cs similarity index 100% rename from SearchBugs.Application/Git/GitHttpServer/GitHttpServerCommandHandler.cs rename to src/SearchBugs.Application/Git/GitHttpServer/GitHttpServerCommandHandler.cs diff --git a/SearchBugs.Application/Git/GitValidationErrors.cs b/src/SearchBugs.Application/Git/GitValidationErrors.cs similarity index 79% rename from SearchBugs.Application/Git/GitValidationErrors.cs rename to src/SearchBugs.Application/Git/GitValidationErrors.cs index 25a2fa6..3201d38 100644 --- a/SearchBugs.Application/Git/GitValidationErrors.cs +++ b/src/SearchBugs.Application/Git/GitValidationErrors.cs @@ -8,4 +8,6 @@ internal static class GitValidationErrors internal static Error DescriptionIsRequired => new("Git.DescriptionIsRequired", "The git's description is required."); internal static Error UrlIsRequired => new("Git.UrlIsRequired", "The git's url is required."); + internal static Error GitRepoNotFound => new("Git.GitRepoNotFound", "The git repository was not found."); + } diff --git a/SearchBugs.Application/Projects/CreateProject/CreateProjectCommand.cs b/src/SearchBugs.Application/Projects/CreateProject/CreateProjectCommand.cs similarity index 100% rename from SearchBugs.Application/Projects/CreateProject/CreateProjectCommand.cs rename to src/SearchBugs.Application/Projects/CreateProject/CreateProjectCommand.cs diff --git a/SearchBugs.Application/Projects/CreateProject/CreateProjectCommandHandler.cs b/src/SearchBugs.Application/Projects/CreateProject/CreateProjectCommandHandler.cs similarity index 100% rename from SearchBugs.Application/Projects/CreateProject/CreateProjectCommandHandler.cs rename to src/SearchBugs.Application/Projects/CreateProject/CreateProjectCommandHandler.cs diff --git a/SearchBugs.Application/Projects/CreateProject/CreateProjectCommandValidator.cs b/src/SearchBugs.Application/Projects/CreateProject/CreateProjectCommandValidator.cs similarity index 100% rename from SearchBugs.Application/Projects/CreateProject/CreateProjectCommandValidator.cs rename to src/SearchBugs.Application/Projects/CreateProject/CreateProjectCommandValidator.cs diff --git a/SearchBugs.Application/Projects/GetProjects/GetProjectsQuery.cs b/src/SearchBugs.Application/Projects/GetProjects/GetProjectsQuery.cs similarity index 100% rename from SearchBugs.Application/Projects/GetProjects/GetProjectsQuery.cs rename to src/SearchBugs.Application/Projects/GetProjects/GetProjectsQuery.cs diff --git a/SearchBugs.Application/Projects/GetProjects/GetProjectsQueryHandler.cs b/src/SearchBugs.Application/Projects/GetProjects/GetProjectsQueryHandler.cs similarity index 100% rename from SearchBugs.Application/Projects/GetProjects/GetProjectsQueryHandler.cs rename to src/SearchBugs.Application/Projects/GetProjects/GetProjectsQueryHandler.cs diff --git a/SearchBugs.Application/Projects/GetProjects/GetProjectsResponse.cs b/src/SearchBugs.Application/Projects/GetProjects/GetProjectsResponse.cs similarity index 100% rename from SearchBugs.Application/Projects/GetProjects/GetProjectsResponse.cs rename to src/SearchBugs.Application/Projects/GetProjects/GetProjectsResponse.cs diff --git a/SearchBugs.Application/SearchBugs.Application.csproj b/src/SearchBugs.Application/SearchBugs.Application.csproj similarity index 91% rename from SearchBugs.Application/SearchBugs.Application.csproj rename to src/SearchBugs.Application/SearchBugs.Application.csproj index f7e05d3..a503532 100644 --- a/SearchBugs.Application/SearchBugs.Application.csproj +++ b/src/SearchBugs.Application/SearchBugs.Application.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/SearchBugs.Application/Users/GetUserDetail/GetUserDetailQuery.cs b/src/SearchBugs.Application/Users/GetUserDetail/GetUserDetailQuery.cs similarity index 100% rename from SearchBugs.Application/Users/GetUserDetail/GetUserDetailQuery.cs rename to src/SearchBugs.Application/Users/GetUserDetail/GetUserDetailQuery.cs diff --git a/SearchBugs.Application/Users/GetUserDetail/GetUserDetailQueryHandler.cs b/src/SearchBugs.Application/Users/GetUserDetail/GetUserDetailQueryHandler.cs similarity index 100% rename from SearchBugs.Application/Users/GetUserDetail/GetUserDetailQueryHandler.cs rename to src/SearchBugs.Application/Users/GetUserDetail/GetUserDetailQueryHandler.cs diff --git a/SearchBugs.Application/Users/GetUserDetail/GetUserDetailResponse.cs b/src/SearchBugs.Application/Users/GetUserDetail/GetUserDetailResponse.cs similarity index 100% rename from SearchBugs.Application/Users/GetUserDetail/GetUserDetailResponse.cs rename to src/SearchBugs.Application/Users/GetUserDetail/GetUserDetailResponse.cs diff --git a/SearchBugs.Application/Users/GetUsers/GetUsersQuery.cs b/src/SearchBugs.Application/Users/GetUsers/GetUsersQuery.cs similarity index 100% rename from SearchBugs.Application/Users/GetUsers/GetUsersQuery.cs rename to src/SearchBugs.Application/Users/GetUsers/GetUsersQuery.cs diff --git a/SearchBugs.Application/Users/GetUsers/GetUsersQueryHandler.cs b/src/SearchBugs.Application/Users/GetUsers/GetUsersQueryHandler.cs similarity index 100% rename from SearchBugs.Application/Users/GetUsers/GetUsersQueryHandler.cs rename to src/SearchBugs.Application/Users/GetUsers/GetUsersQueryHandler.cs diff --git a/SearchBugs.Application/Users/GetUsers/GetUsersResponse.cs b/src/SearchBugs.Application/Users/GetUsers/GetUsersResponse.cs similarity index 100% rename from SearchBugs.Application/Users/GetUsers/GetUsersResponse.cs rename to src/SearchBugs.Application/Users/GetUsers/GetUsersResponse.cs diff --git a/SearchBugs.Application/Users/UpdateUser/UpdateUserCommand.cs b/src/SearchBugs.Application/Users/UpdateUser/UpdateUserCommand.cs similarity index 100% rename from SearchBugs.Application/Users/UpdateUser/UpdateUserCommand.cs rename to src/SearchBugs.Application/Users/UpdateUser/UpdateUserCommand.cs diff --git a/SearchBugs.Application/Users/UpdateUser/UpdateUserCommandHandler.cs b/src/SearchBugs.Application/Users/UpdateUser/UpdateUserCommandHandler.cs similarity index 90% rename from SearchBugs.Application/Users/UpdateUser/UpdateUserCommandHandler.cs rename to src/SearchBugs.Application/Users/UpdateUser/UpdateUserCommandHandler.cs index b2817cc..89ac131 100644 --- a/SearchBugs.Application/Users/UpdateUser/UpdateUserCommandHandler.cs +++ b/src/SearchBugs.Application/Users/UpdateUser/UpdateUserCommandHandler.cs @@ -18,7 +18,7 @@ public UpdateUserCommandHandler(IUnitOfWork unitOfWork, IUserRepository userRepo public async Task Handle(UpdateUserCommand request, CancellationToken cancellationToken) { - var user = await _userRepository.GetByIdAsync(request.Id, cancellationToken); + var user = await _userRepository.GetByIdAsync(new UserId(request.Id), cancellationToken); if (user.IsFailure) { return Result.Failure(user.Error); diff --git a/SearchBugs.Application/Users/UpdateUser/UpdateUserCommandValidator.cs b/src/SearchBugs.Application/Users/UpdateUser/UpdateUserCommandValidator.cs similarity index 100% rename from SearchBugs.Application/Users/UpdateUser/UpdateUserCommandValidator.cs rename to src/SearchBugs.Application/Users/UpdateUser/UpdateUserCommandValidator.cs diff --git a/SearchBugs.Application/Users/UserValidationErrors.cs b/src/SearchBugs.Application/Users/UserValidationErrors.cs similarity index 100% rename from SearchBugs.Application/Users/UserValidationErrors.cs rename to src/SearchBugs.Application/Users/UserValidationErrors.cs diff --git a/SearchBugs.Domain/Bugs/Attachment.cs b/src/SearchBugs.Domain/Bugs/Attachment.cs similarity index 100% rename from SearchBugs.Domain/Bugs/Attachment.cs rename to src/SearchBugs.Domain/Bugs/Attachment.cs diff --git a/SearchBugs.Domain/Bugs/AttachmentId.cs b/src/SearchBugs.Domain/Bugs/AttachmentId.cs similarity index 100% rename from SearchBugs.Domain/Bugs/AttachmentId.cs rename to src/SearchBugs.Domain/Bugs/AttachmentId.cs diff --git a/SearchBugs.Domain/Bugs/Bug.cs b/src/SearchBugs.Domain/Bugs/Bug.cs similarity index 100% rename from SearchBugs.Domain/Bugs/Bug.cs rename to src/SearchBugs.Domain/Bugs/Bug.cs diff --git a/SearchBugs.Domain/Bugs/BugCustomField.cs b/src/SearchBugs.Domain/Bugs/BugCustomField.cs similarity index 100% rename from SearchBugs.Domain/Bugs/BugCustomField.cs rename to src/SearchBugs.Domain/Bugs/BugCustomField.cs diff --git a/SearchBugs.Domain/Bugs/BugCustomFieldId.cs b/src/SearchBugs.Domain/Bugs/BugCustomFieldId.cs similarity index 100% rename from SearchBugs.Domain/Bugs/BugCustomFieldId.cs rename to src/SearchBugs.Domain/Bugs/BugCustomFieldId.cs diff --git a/SearchBugs.Domain/Bugs/BugHistory.cs b/src/SearchBugs.Domain/Bugs/BugHistory.cs similarity index 100% rename from SearchBugs.Domain/Bugs/BugHistory.cs rename to src/SearchBugs.Domain/Bugs/BugHistory.cs diff --git a/SearchBugs.Domain/Bugs/BugId.cs b/src/SearchBugs.Domain/Bugs/BugId.cs similarity index 100% rename from SearchBugs.Domain/Bugs/BugId.cs rename to src/SearchBugs.Domain/Bugs/BugId.cs diff --git a/SearchBugs.Domain/Bugs/BugPriority.cs b/src/SearchBugs.Domain/Bugs/BugPriority.cs similarity index 100% rename from SearchBugs.Domain/Bugs/BugPriority.cs rename to src/SearchBugs.Domain/Bugs/BugPriority.cs diff --git a/SearchBugs.Domain/Bugs/BugSeverity.cs b/src/SearchBugs.Domain/Bugs/BugSeverity.cs similarity index 100% rename from SearchBugs.Domain/Bugs/BugSeverity.cs rename to src/SearchBugs.Domain/Bugs/BugSeverity.cs diff --git a/SearchBugs.Domain/Bugs/BugStatus.cs b/src/SearchBugs.Domain/Bugs/BugStatus.cs similarity index 100% rename from SearchBugs.Domain/Bugs/BugStatus.cs rename to src/SearchBugs.Domain/Bugs/BugStatus.cs diff --git a/src/SearchBugs.Domain/Bugs/BugsErrors.cs b/src/SearchBugs.Domain/Bugs/BugsErrors.cs new file mode 100644 index 0000000..c9a1e88 --- /dev/null +++ b/src/SearchBugs.Domain/Bugs/BugsErrors.cs @@ -0,0 +1,21 @@ +using Shared.Errors; + +namespace SearchBugs.Domain.Bugs; + +internal static class BugsErrors +{ + internal static Error TitleIsRequired => new Error("Bug.TitleIsRequired", "Title is required"); + internal static Error InvalidBugStatus => new Error("Bug.InvalidStatus", "Invalid bug status"); + + internal static Error InvalidBugPriority => new Error("Bug.InvalidPriority", "Invalid bug priority"); + + internal static Error InvalidBugSeverity => new Error("Bug.InvalidSeverity", "Invalid bug severity"); + + internal static Error InvalidProjectId => new Error("Bug.InvalidProjectId", "Invalid project id"); + + internal static Error InvalidAssigneeId => new Error("Bug.InvalidAssigneeId", "Invalid assignee id"); + + internal static Error InvalidReporterId => new Error("Bug.InvalidReporterId", "Invalid reporter id"); + + internal static Error InvalidTitle => new Error("Bug.InvalidTitle", "Invalid title"); +} diff --git a/SearchBugs.Domain/Bugs/Comment.cs b/src/SearchBugs.Domain/Bugs/Comment.cs similarity index 100% rename from SearchBugs.Domain/Bugs/Comment.cs rename to src/SearchBugs.Domain/Bugs/Comment.cs diff --git a/SearchBugs.Domain/Bugs/CommentId.cs b/src/SearchBugs.Domain/Bugs/CommentId.cs similarity index 100% rename from SearchBugs.Domain/Bugs/CommentId.cs rename to src/SearchBugs.Domain/Bugs/CommentId.cs diff --git a/SearchBugs.Domain/Bugs/CustomField.cs b/src/SearchBugs.Domain/Bugs/CustomField.cs similarity index 100% rename from SearchBugs.Domain/Bugs/CustomField.cs rename to src/SearchBugs.Domain/Bugs/CustomField.cs diff --git a/SearchBugs.Domain/Bugs/CustomFieldId.cs b/src/SearchBugs.Domain/Bugs/CustomFieldId.cs similarity index 100% rename from SearchBugs.Domain/Bugs/CustomFieldId.cs rename to src/SearchBugs.Domain/Bugs/CustomFieldId.cs diff --git a/SearchBugs.Domain/Bugs/HistoryId.cs b/src/SearchBugs.Domain/Bugs/HistoryId.cs similarity index 100% rename from SearchBugs.Domain/Bugs/HistoryId.cs rename to src/SearchBugs.Domain/Bugs/HistoryId.cs diff --git a/SearchBugs.Domain/Bugs/IBugRepository.cs b/src/SearchBugs.Domain/Bugs/IBugRepository.cs similarity index 65% rename from SearchBugs.Domain/Bugs/IBugRepository.cs rename to src/SearchBugs.Domain/Bugs/IBugRepository.cs index 21088b1..d5be042 100644 --- a/SearchBugs.Domain/Bugs/IBugRepository.cs +++ b/src/SearchBugs.Domain/Bugs/IBugRepository.cs @@ -2,13 +2,9 @@ namespace SearchBugs.Domain.Bugs; -public interface IBugRepository +public interface IBugRepository : IRepository { - Task> GetByIdAsync(BugId id, CancellationToken cancellationToken); - Task Add(Bug bug); - Task> GetBugStatusByName(string name, CancellationToken cancellationToken); Task> GetBugPriorityByName(string name, CancellationToken cancellationToken); - } diff --git a/src/SearchBugs.Domain/Bugs/TimeTracingId.cs b/src/SearchBugs.Domain/Bugs/TimeTracingId.cs new file mode 100644 index 0000000..d414f7d --- /dev/null +++ b/src/SearchBugs.Domain/Bugs/TimeTracingId.cs @@ -0,0 +1,8 @@ +using Shared.Primitives; + +namespace SearchBugs.Domain.Bugs; + +public record TimeTracingId(Guid Value) : IEntityId +{ + public static TimeTracingId New => new(Guid.NewGuid()); +} diff --git a/SearchBugs.Domain/Bugs/TimeTracking.cs b/src/SearchBugs.Domain/Bugs/TimeTracking.cs similarity index 100% rename from SearchBugs.Domain/Bugs/TimeTracking.cs rename to src/SearchBugs.Domain/Bugs/TimeTracking.cs diff --git a/SearchBugs.Domain/IApplicationDbContext.cs b/src/SearchBugs.Domain/IApplicationDbContext.cs similarity index 100% rename from SearchBugs.Domain/IApplicationDbContext.cs rename to src/SearchBugs.Domain/IApplicationDbContext.cs diff --git a/src/SearchBugs.Domain/IRepository.cs b/src/SearchBugs.Domain/IRepository.cs new file mode 100644 index 0000000..b184006 --- /dev/null +++ b/src/SearchBugs.Domain/IRepository.cs @@ -0,0 +1,18 @@ +using Shared.Primitives; +using Shared.Results; +using System.Linq.Expressions; + +namespace SearchBugs.Domain; + +public interface IRepository + where TEntity : Entity + where TEntityId : class, IEntityId +{ + Task Add(TEntity entity); + + Task> GetByIdAsync(IEntityId id, CancellationToken cancellationToken = default, params Expression>[] includes); + + Task Remove(TEntity entity); + + Task Update(TEntity entity); +} \ No newline at end of file diff --git a/SearchBugs.Domain/IUnitOfWork.cs b/src/SearchBugs.Domain/IUnitOfWork.cs similarity index 100% rename from SearchBugs.Domain/IUnitOfWork.cs rename to src/SearchBugs.Domain/IUnitOfWork.cs diff --git a/SearchBugs.Domain/Notifications/Notification.cs b/src/SearchBugs.Domain/Notifications/Notification.cs similarity index 100% rename from SearchBugs.Domain/Notifications/Notification.cs rename to src/SearchBugs.Domain/Notifications/Notification.cs diff --git a/SearchBugs.Domain/Notifications/NotificationId.cs b/src/SearchBugs.Domain/Notifications/NotificationId.cs similarity index 100% rename from SearchBugs.Domain/Notifications/NotificationId.cs rename to src/SearchBugs.Domain/Notifications/NotificationId.cs diff --git a/src/SearchBugs.Domain/Projects/IProjectRepository.cs b/src/SearchBugs.Domain/Projects/IProjectRepository.cs new file mode 100644 index 0000000..a442866 --- /dev/null +++ b/src/SearchBugs.Domain/Projects/IProjectRepository.cs @@ -0,0 +1,5 @@ +namespace SearchBugs.Domain.Projects; + +public interface IProjectRepository : IRepository +{ +} diff --git a/SearchBugs.Domain/Projects/Project.cs b/src/SearchBugs.Domain/Projects/Project.cs similarity index 100% rename from SearchBugs.Domain/Projects/Project.cs rename to src/SearchBugs.Domain/Projects/Project.cs diff --git a/SearchBugs.Domain/Projects/ProjectId.cs b/src/SearchBugs.Domain/Projects/ProjectId.cs similarity index 100% rename from SearchBugs.Domain/Projects/ProjectId.cs rename to src/SearchBugs.Domain/Projects/ProjectId.cs diff --git a/SearchBugs.Domain/Projects/ProjectRole.cs b/src/SearchBugs.Domain/Projects/ProjectRole.cs similarity index 100% rename from SearchBugs.Domain/Projects/ProjectRole.cs rename to src/SearchBugs.Domain/Projects/ProjectRole.cs diff --git a/SearchBugs.Domain/Projects/ProjectRoleUser.cs b/src/SearchBugs.Domain/Projects/ProjectRoleUser.cs similarity index 100% rename from SearchBugs.Domain/Projects/ProjectRoleUser.cs rename to src/SearchBugs.Domain/Projects/ProjectRoleUser.cs diff --git a/SearchBugs.Domain/Repositories/BugRepo.cs b/src/SearchBugs.Domain/Repositories/BugRepo.cs similarity index 100% rename from SearchBugs.Domain/Repositories/BugRepo.cs rename to src/SearchBugs.Domain/Repositories/BugRepo.cs diff --git a/SearchBugs.Domain/Repositories/GitTreeItem.cs b/src/SearchBugs.Domain/Repositories/GitTreeItem.cs similarity index 100% rename from SearchBugs.Domain/Repositories/GitTreeItem.cs rename to src/SearchBugs.Domain/Repositories/GitTreeItem.cs diff --git a/src/SearchBugs.Domain/Repositories/IGitRepository.cs b/src/SearchBugs.Domain/Repositories/IGitRepository.cs new file mode 100644 index 0000000..d87d96a --- /dev/null +++ b/src/SearchBugs.Domain/Repositories/IGitRepository.cs @@ -0,0 +1,8 @@ +using Shared.Results; + +namespace SearchBugs.Domain.Repositories; + +public interface IGitRepository : IRepository +{ + Task> GetByUrlAsync(string url, CancellationToken cancellationToken = default); +} diff --git a/SearchBugs.Domain/Repositories/IGitRepositoryService.cs b/src/SearchBugs.Domain/Repositories/IGitRepositoryService.cs similarity index 100% rename from SearchBugs.Domain/Repositories/IGitRepositoryService.cs rename to src/SearchBugs.Domain/Repositories/IGitRepositoryService.cs diff --git a/SearchBugs.Domain/Repositories/IGitService.cs b/src/SearchBugs.Domain/Repositories/IGitService.cs similarity index 100% rename from SearchBugs.Domain/Repositories/IGitService.cs rename to src/SearchBugs.Domain/Repositories/IGitService.cs diff --git a/SearchBugs.Domain/Repositories/Repository.cs b/src/SearchBugs.Domain/Repositories/Repository.cs similarity index 100% rename from SearchBugs.Domain/Repositories/Repository.cs rename to src/SearchBugs.Domain/Repositories/Repository.cs diff --git a/SearchBugs.Domain/Repositories/RepositoryId.cs b/src/SearchBugs.Domain/Repositories/RepositoryId.cs similarity index 100% rename from SearchBugs.Domain/Repositories/RepositoryId.cs rename to src/SearchBugs.Domain/Repositories/RepositoryId.cs diff --git a/SearchBugs.Domain/Roles/Permission.cs b/src/SearchBugs.Domain/Roles/Permission.cs similarity index 100% rename from SearchBugs.Domain/Roles/Permission.cs rename to src/SearchBugs.Domain/Roles/Permission.cs diff --git a/SearchBugs.Domain/Roles/Role.cs b/src/SearchBugs.Domain/Roles/Role.cs similarity index 100% rename from SearchBugs.Domain/Roles/Role.cs rename to src/SearchBugs.Domain/Roles/Role.cs diff --git a/SearchBugs.Domain/Roles/RolePermission.cs b/src/SearchBugs.Domain/Roles/RolePermission.cs similarity index 100% rename from SearchBugs.Domain/Roles/RolePermission.cs rename to src/SearchBugs.Domain/Roles/RolePermission.cs diff --git a/SearchBugs.Domain/SearchBugs.Domain.csproj b/src/SearchBugs.Domain/SearchBugs.Domain.csproj similarity index 100% rename from SearchBugs.Domain/SearchBugs.Domain.csproj rename to src/SearchBugs.Domain/SearchBugs.Domain.csproj diff --git a/src/SearchBugs.Domain/Services/Ensure.cs b/src/SearchBugs.Domain/Services/Ensure.cs new file mode 100644 index 0000000..7d39ccb --- /dev/null +++ b/src/SearchBugs.Domain/Services/Ensure.cs @@ -0,0 +1,32 @@ +using Shared.Errors; + +namespace SearchBugs.Domain.Services; + +public static class Ensure +{ + public static Error NotNull(T value, Error error) + { + return value == null ? error : Error.None; + } + + public static Error NotNullOrEmpty(T value, Error error) + { + return value == null || string.IsNullOrEmpty(value.ToString()) ? error : Error.None; + } + + public static Error NotNullOrWhiteSpace(string value, Error error) + { + return string.IsNullOrWhiteSpace(value) ? error : Error.None; + } + + public static Error NotNegative(T value, Error error) + { + return value switch + { + int i when i < 0 => error, + long l when l < 0 => error, + decimal d when d < 0 => error, + _ => Error.None + }; + } +} diff --git a/SearchBugs.Domain/Services/IDataEncryptionService.cs b/src/SearchBugs.Domain/Services/IDataEncryptionService.cs similarity index 100% rename from SearchBugs.Domain/Services/IDataEncryptionService.cs rename to src/SearchBugs.Domain/Services/IDataEncryptionService.cs diff --git a/SearchBugs.Domain/Services/IPasswordHashingService.cs b/src/SearchBugs.Domain/Services/IPasswordHashingService.cs similarity index 100% rename from SearchBugs.Domain/Services/IPasswordHashingService.cs rename to src/SearchBugs.Domain/Services/IPasswordHashingService.cs diff --git a/SearchBugs.Domain/Users/Email.cs b/src/SearchBugs.Domain/Users/Email.cs similarity index 100% rename from SearchBugs.Domain/Users/Email.cs rename to src/SearchBugs.Domain/Users/Email.cs diff --git a/SearchBugs.Domain/Users/Events/UserUpdatedEvent.cs b/src/SearchBugs.Domain/Users/Events/UserUpdatedEvent.cs similarity index 100% rename from SearchBugs.Domain/Users/Events/UserUpdatedEvent.cs rename to src/SearchBugs.Domain/Users/Events/UserUpdatedEvent.cs diff --git a/SearchBugs.Domain/Users/IJwtProvider.cs b/src/SearchBugs.Domain/Users/IJwtProvider.cs similarity index 100% rename from SearchBugs.Domain/Users/IJwtProvider.cs rename to src/SearchBugs.Domain/Users/IJwtProvider.cs diff --git a/SearchBugs.Domain/Users/IUserRepository.cs b/src/SearchBugs.Domain/Users/IUserRepository.cs similarity index 71% rename from SearchBugs.Domain/Users/IUserRepository.cs rename to src/SearchBugs.Domain/Users/IUserRepository.cs index 480a237..c489ce8 100644 --- a/SearchBugs.Domain/Users/IUserRepository.cs +++ b/src/SearchBugs.Domain/Users/IUserRepository.cs @@ -3,15 +3,11 @@ namespace SearchBugs.Domain.Users; -public interface IUserRepository +public interface IUserRepository : IRepository { Task> GetUserByEmailAsync(string email, CancellationToken cancellationToken); - Task Add(User user); - Task> GetRoleByIdAsync(int roleId, CancellationToken cancellationToken); Task> IsEmailUniqueAsync(Email email, CancellationToken cancellationToken); - - Task> GetByIdAsync(Guid id, CancellationToken cancellationToken = default); } diff --git a/SearchBugs.Domain/Users/Name.cs b/src/SearchBugs.Domain/Users/Name.cs similarity index 100% rename from SearchBugs.Domain/Users/Name.cs rename to src/SearchBugs.Domain/Users/Name.cs diff --git a/SearchBugs.Domain/Users/User.cs b/src/SearchBugs.Domain/Users/User.cs similarity index 100% rename from SearchBugs.Domain/Users/User.cs rename to src/SearchBugs.Domain/Users/User.cs diff --git a/SearchBugs.Domain/Users/UserErrors.cs b/src/SearchBugs.Domain/Users/UserErrors.cs similarity index 100% rename from SearchBugs.Domain/Users/UserErrors.cs rename to src/SearchBugs.Domain/Users/UserErrors.cs diff --git a/SearchBugs.Domain/Users/UserId.cs b/src/SearchBugs.Domain/Users/UserId.cs similarity index 100% rename from SearchBugs.Domain/Users/UserId.cs rename to src/SearchBugs.Domain/Users/UserId.cs diff --git a/SearchBugs.Domain/Users/UserRole.cs b/src/SearchBugs.Domain/Users/UserRole.cs similarity index 100% rename from SearchBugs.Domain/Users/UserRole.cs rename to src/SearchBugs.Domain/Users/UserRole.cs diff --git a/SearchBugs.Infrastructure/Authentication/JwtBearerOptionsSetup.cs b/src/SearchBugs.Infrastructure/Authentication/JwtBearerOptionsSetup.cs similarity index 100% rename from SearchBugs.Infrastructure/Authentication/JwtBearerOptionsSetup.cs rename to src/SearchBugs.Infrastructure/Authentication/JwtBearerOptionsSetup.cs diff --git a/SearchBugs.Infrastructure/Authentication/JwtOptions.cs b/src/SearchBugs.Infrastructure/Authentication/JwtOptions.cs similarity index 100% rename from SearchBugs.Infrastructure/Authentication/JwtOptions.cs rename to src/SearchBugs.Infrastructure/Authentication/JwtOptions.cs diff --git a/SearchBugs.Infrastructure/Authentication/JwtOptionsSetup.cs b/src/SearchBugs.Infrastructure/Authentication/JwtOptionsSetup.cs similarity index 100% rename from SearchBugs.Infrastructure/Authentication/JwtOptionsSetup.cs rename to src/SearchBugs.Infrastructure/Authentication/JwtOptionsSetup.cs diff --git a/SearchBugs.Infrastructure/Authentication/JwtProvider.cs b/src/SearchBugs.Infrastructure/Authentication/JwtProvider.cs similarity index 100% rename from SearchBugs.Infrastructure/Authentication/JwtProvider.cs rename to src/SearchBugs.Infrastructure/Authentication/JwtProvider.cs diff --git a/SearchBugs.Infrastructure/DependencyInjection.cs b/src/SearchBugs.Infrastructure/DependencyInjection.cs similarity index 100% rename from SearchBugs.Infrastructure/DependencyInjection.cs rename to src/SearchBugs.Infrastructure/DependencyInjection.cs diff --git a/SearchBugs.Infrastructure/LoggingBackgroundJob.cs b/src/SearchBugs.Infrastructure/LoggingBackgroundJob.cs similarity index 100% rename from SearchBugs.Infrastructure/LoggingBackgroundJob.cs rename to src/SearchBugs.Infrastructure/LoggingBackgroundJob.cs diff --git a/SearchBugs.Infrastructure/LoggingBackgroundJobSetup.cs b/src/SearchBugs.Infrastructure/LoggingBackgroundJobSetup.cs similarity index 100% rename from SearchBugs.Infrastructure/LoggingBackgroundJobSetup.cs rename to src/SearchBugs.Infrastructure/LoggingBackgroundJobSetup.cs diff --git a/SearchBugs.Infrastructure/Options/GitOptions.cs b/src/SearchBugs.Infrastructure/Options/GitOptions.cs similarity index 100% rename from SearchBugs.Infrastructure/Options/GitOptions.cs rename to src/SearchBugs.Infrastructure/Options/GitOptions.cs diff --git a/SearchBugs.Infrastructure/Options/GitOptionsSetup.cs b/src/SearchBugs.Infrastructure/Options/GitOptionsSetup.cs similarity index 100% rename from SearchBugs.Infrastructure/Options/GitOptionsSetup.cs rename to src/SearchBugs.Infrastructure/Options/GitOptionsSetup.cs diff --git a/SearchBugs.Infrastructure/SearchBugs.Infrastructure.csproj b/src/SearchBugs.Infrastructure/SearchBugs.Infrastructure.csproj similarity index 93% rename from SearchBugs.Infrastructure/SearchBugs.Infrastructure.csproj rename to src/SearchBugs.Infrastructure/SearchBugs.Infrastructure.csproj index 555e55c..707297e 100644 --- a/SearchBugs.Infrastructure/SearchBugs.Infrastructure.csproj +++ b/src/SearchBugs.Infrastructure/SearchBugs.Infrastructure.csproj @@ -8,12 +8,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/SearchBugs.Infrastructure/Services/DataEncryptionService.cs b/src/SearchBugs.Infrastructure/Services/DataEncryptionService.cs similarity index 100% rename from SearchBugs.Infrastructure/Services/DataEncryptionService.cs rename to src/SearchBugs.Infrastructure/Services/DataEncryptionService.cs diff --git a/SearchBugs.Infrastructure/Services/GitRepositoryService.cs b/src/SearchBugs.Infrastructure/Services/GitRepositoryService.cs similarity index 100% rename from SearchBugs.Infrastructure/Services/GitRepositoryService.cs rename to src/SearchBugs.Infrastructure/Services/GitRepositoryService.cs diff --git a/SearchBugs.Infrastructure/Services/GitService.cs b/src/SearchBugs.Infrastructure/Services/GitService.cs similarity index 100% rename from SearchBugs.Infrastructure/Services/GitService.cs rename to src/SearchBugs.Infrastructure/Services/GitService.cs diff --git a/SearchBugs.Infrastructure/Services/PasswordHashingService.cs b/src/SearchBugs.Infrastructure/Services/PasswordHashingService.cs similarity index 100% rename from SearchBugs.Infrastructure/Services/PasswordHashingService.cs rename to src/SearchBugs.Infrastructure/Services/PasswordHashingService.cs diff --git a/SearchBugs.Persistence/ApplicationDbContext.cs b/src/SearchBugs.Persistence/ApplicationDbContext.cs similarity index 100% rename from SearchBugs.Persistence/ApplicationDbContext.cs rename to src/SearchBugs.Persistence/ApplicationDbContext.cs diff --git a/SearchBugs.Persistence/Configurations/AttachmentConfiguration.cs b/src/SearchBugs.Persistence/Configurations/AttachmentConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/AttachmentConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/AttachmentConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/BugConfiguration.cs b/src/SearchBugs.Persistence/Configurations/BugConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/BugConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/BugConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/BugCustomFieldConfiguration.cs b/src/SearchBugs.Persistence/Configurations/BugCustomFieldConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/BugCustomFieldConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/BugCustomFieldConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/BugHistoryConfiguration.cs b/src/SearchBugs.Persistence/Configurations/BugHistoryConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/BugHistoryConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/BugHistoryConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/BugPriorityConfiguration.cs b/src/SearchBugs.Persistence/Configurations/BugPriorityConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/BugPriorityConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/BugPriorityConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/BugRepositoryConfiguration.cs b/src/SearchBugs.Persistence/Configurations/BugRepositoryConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/BugRepositoryConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/BugRepositoryConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/BugStatusConfiguration.cs b/src/SearchBugs.Persistence/Configurations/BugStatusConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/BugStatusConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/BugStatusConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/CommentConfiguration.cs b/src/SearchBugs.Persistence/Configurations/CommentConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/CommentConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/CommentConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/CustomFieldConfiguration.cs b/src/SearchBugs.Persistence/Configurations/CustomFieldConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/CustomFieldConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/CustomFieldConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/NotificationConfiguration.cs b/src/SearchBugs.Persistence/Configurations/NotificationConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/NotificationConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/NotificationConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/PermissionConfiguration.cs b/src/SearchBugs.Persistence/Configurations/PermissionConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/PermissionConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/PermissionConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/ProjectConfiguration.cs b/src/SearchBugs.Persistence/Configurations/ProjectConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/ProjectConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/ProjectConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/ProjectRoleConfiguration.cs b/src/SearchBugs.Persistence/Configurations/ProjectRoleConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/ProjectRoleConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/ProjectRoleConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/ProjectRoleUserConfiguration.cs b/src/SearchBugs.Persistence/Configurations/ProjectRoleUserConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/ProjectRoleUserConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/ProjectRoleUserConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/RepositoryConfiguration.cs b/src/SearchBugs.Persistence/Configurations/RepositoryConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/RepositoryConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/RepositoryConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/RoleConfiguration.cs b/src/SearchBugs.Persistence/Configurations/RoleConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/RoleConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/RoleConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/RolePermissionConfiguration.cs b/src/SearchBugs.Persistence/Configurations/RolePermissionConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/RolePermissionConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/RolePermissionConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/TimeTrackingConfiguration.cs b/src/SearchBugs.Persistence/Configurations/TimeTrackingConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/TimeTrackingConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/TimeTrackingConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/UserConfiguration.cs b/src/SearchBugs.Persistence/Configurations/UserConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/UserConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/UserConfiguration.cs diff --git a/SearchBugs.Persistence/Configurations/UserRoleConfiguration.cs b/src/SearchBugs.Persistence/Configurations/UserRoleConfiguration.cs similarity index 100% rename from SearchBugs.Persistence/Configurations/UserRoleConfiguration.cs rename to src/SearchBugs.Persistence/Configurations/UserRoleConfiguration.cs diff --git a/SearchBugs.Persistence/Constants/Schemas.cs b/src/SearchBugs.Persistence/Constants/Schemas.cs similarity index 100% rename from SearchBugs.Persistence/Constants/Schemas.cs rename to src/SearchBugs.Persistence/Constants/Schemas.cs diff --git a/SearchBugs.Persistence/Constants/TableNames.cs b/src/SearchBugs.Persistence/Constants/TableNames.cs similarity index 100% rename from SearchBugs.Persistence/Constants/TableNames.cs rename to src/SearchBugs.Persistence/Constants/TableNames.cs diff --git a/SearchBugs.Persistence/DependencyInjection.cs b/src/SearchBugs.Persistence/DependencyInjection.cs similarity index 100% rename from SearchBugs.Persistence/DependencyInjection.cs rename to src/SearchBugs.Persistence/DependencyInjection.cs diff --git a/SearchBugs.Persistence/Migrations/20240729051953_Init.Designer.cs b/src/SearchBugs.Persistence/Migrations/20240729051953_Init.Designer.cs similarity index 100% rename from SearchBugs.Persistence/Migrations/20240729051953_Init.Designer.cs rename to src/SearchBugs.Persistence/Migrations/20240729051953_Init.Designer.cs diff --git a/SearchBugs.Persistence/Migrations/20240729051953_Init.cs b/src/SearchBugs.Persistence/Migrations/20240729051953_Init.cs similarity index 100% rename from SearchBugs.Persistence/Migrations/20240729051953_Init.cs rename to src/SearchBugs.Persistence/Migrations/20240729051953_Init.cs diff --git a/SearchBugs.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs b/src/SearchBugs.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs similarity index 100% rename from SearchBugs.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs rename to src/SearchBugs.Persistence/Migrations/ApplicationDbContextModelSnapshot.cs diff --git a/SearchBugs.Persistence/Repositories/BugRepository.cs b/src/SearchBugs.Persistence/Repositories/BugRepository.cs similarity index 65% rename from SearchBugs.Persistence/Repositories/BugRepository.cs rename to src/SearchBugs.Persistence/Repositories/BugRepository.cs index d7b702c..1231bed 100644 --- a/SearchBugs.Persistence/Repositories/BugRepository.cs +++ b/src/SearchBugs.Persistence/Repositories/BugRepository.cs @@ -11,11 +11,11 @@ public BugRepository(ApplicationDbContext dbContext) : base(dbContext) } public async Task> GetByIdAsync(BugId id, CancellationToken cancellationToken = default) => - Result.Create(await DbContext.Set().FirstOrDefaultAsync(b => b.Id == id, cancellationToken)); + Result.Create(await _context.Set().FirstOrDefaultAsync(b => b.Id == id, cancellationToken)); public async Task> GetBugStatusByName(string name, CancellationToken cancellationToken = default) => - Result.Create(await DbContext.Set().FirstOrDefaultAsync(s => s.Name == name, cancellationToken)); + Result.Create(await _context.Set().FirstOrDefaultAsync(s => s.Name == name, cancellationToken)); public async Task> GetBugPriorityByName(string name, CancellationToken cancellationToken) => - Result.Create(await DbContext.Set().FirstOrDefaultAsync(p => p.Name == name, cancellationToken)); + Result.Create(await _context.Set().FirstOrDefaultAsync(p => p.Name == name, cancellationToken)); } diff --git a/SearchBugs.Persistence/Repositories/GitRepository.cs b/src/SearchBugs.Persistence/Repositories/GitRepository.cs similarity index 56% rename from SearchBugs.Persistence/Repositories/GitRepository.cs rename to src/SearchBugs.Persistence/Repositories/GitRepository.cs index e5bfd0a..e1f2c37 100644 --- a/SearchBugs.Persistence/Repositories/GitRepository.cs +++ b/src/SearchBugs.Persistence/Repositories/GitRepository.cs @@ -11,6 +11,9 @@ public GitRepository(ApplicationDbContext dbContext) : base(dbContext) } public async Task> GetByIdAsync(RepositoryId id, CancellationToken cancellationToken = default) => - Result.Create(await DbContext.Set().FirstOrDefaultAsync(r => r.Id == id, cancellationToken)); + Result.Create(await _context.Set().FirstOrDefaultAsync(r => r.Id == id, cancellationToken)); + + public async Task> GetByUrlAsync(string url, CancellationToken cancellationToken = default) => + Result.Create(await _context.Set().FirstOrDefaultAsync(r => r.Url == url, cancellationToken)); } diff --git a/SearchBugs.Persistence/Repositories/ProjectRepository.cs b/src/SearchBugs.Persistence/Repositories/ProjectRepository.cs similarity index 78% rename from SearchBugs.Persistence/Repositories/ProjectRepository.cs rename to src/SearchBugs.Persistence/Repositories/ProjectRepository.cs index fd98014..28815dc 100644 --- a/SearchBugs.Persistence/Repositories/ProjectRepository.cs +++ b/src/SearchBugs.Persistence/Repositories/ProjectRepository.cs @@ -11,5 +11,5 @@ public ProjectRepository(ApplicationDbContext dbContext) : base(dbContext) } public async Task> GetByIdAsync(ProjectId projectId, CancellationToken cancellationToken) => - Result.Create(await DbContext.Set().FirstOrDefaultAsync(p => p.Id == projectId, cancellationToken)); + Result.Create(await _context.Set().FirstOrDefaultAsync(p => p.Id == projectId, cancellationToken)); } diff --git a/src/SearchBugs.Persistence/Repositories/Repository.cs b/src/SearchBugs.Persistence/Repositories/Repository.cs new file mode 100644 index 0000000..306b60f --- /dev/null +++ b/src/SearchBugs.Persistence/Repositories/Repository.cs @@ -0,0 +1,32 @@ +using Microsoft.EntityFrameworkCore; +using SearchBugs.Domain; +using Shared.Primitives; +using Shared.Results; +using System.Linq.Expressions; +namespace SearchBugs.Persistence.Repositories; + +public abstract class Repository : IRepository + where TEntity : Entity + where TEntityId : class, IEntityId +{ + protected readonly ApplicationDbContext _context; + + protected Repository(ApplicationDbContext dbContext) => _context = dbContext; + + public async Task Add(TEntity entity) => Result.Create(_context.Set().Add(entity)); + + public async Task Update(TEntity entity) => Result.Create(_context.Set().Update(entity)); + + public async Task Remove(TEntity entity) => Result.Create(_context.Set().Remove(entity)); + + public async Task> GetByIdAsync(IEntityId id, CancellationToken cancellationToken = default, params Expression>[] includes) + { + IQueryable query = _context.Set(); + if (includes.Length == 0) + { + query = includes.Aggregate(query, (current, include) => current.Include(include)); + } + + return Result.Create(await query.FirstOrDefaultAsync(entity => entity.Id == id)); + } +} \ No newline at end of file diff --git a/SearchBugs.Persistence/Repositories/UserRepository.cs b/src/SearchBugs.Persistence/Repositories/UserRepository.cs similarity index 55% rename from SearchBugs.Persistence/Repositories/UserRepository.cs rename to src/SearchBugs.Persistence/Repositories/UserRepository.cs index 295ad07..3505b90 100644 --- a/SearchBugs.Persistence/Repositories/UserRepository.cs +++ b/src/SearchBugs.Persistence/Repositories/UserRepository.cs @@ -11,17 +11,12 @@ public UserRepository(ApplicationDbContext dbContext) : base(dbContext) { } - public Task> GetByIdAsync(Guid id, CancellationToken cancellationToken = default) - { - throw new NotImplementedException(); - } - public async Task> GetRoleByIdAsync(int roleId, CancellationToken cancellationToken) => - Result.Create(await DbContext.Set().FirstOrDefaultAsync(role => role.Id == roleId, cancellationToken)); + Result.Create(await _context.Set().FirstOrDefaultAsync(role => role.Id == roleId, cancellationToken)); public async Task> GetUserByEmailAsync(string email, CancellationToken cancellationToken) => - Result.Create(await DbContext.Set().FirstOrDefaultAsync(user => user.Email.Value == email, cancellationToken)); + Result.Create(await _context.Set().FirstOrDefaultAsync(user => user.Email.Value == email, cancellationToken)); public async Task> IsEmailUniqueAsync(Email email, CancellationToken cancellationToken) => - Result.Create(await DbContext.Set().FirstOrDefaultAsync(user => user.Email.Value == email.Value, cancellationToken)); + Result.Create(await _context.Set().FirstOrDefaultAsync(user => user.Email.Value == email.Value, cancellationToken)); } diff --git a/SearchBugs.Persistence/SearchBugs.Persistence.csproj b/src/SearchBugs.Persistence/SearchBugs.Persistence.csproj similarity index 96% rename from SearchBugs.Persistence/SearchBugs.Persistence.csproj rename to src/SearchBugs.Persistence/SearchBugs.Persistence.csproj index 462d1cc..7d3e084 100644 --- a/SearchBugs.Persistence/SearchBugs.Persistence.csproj +++ b/src/SearchBugs.Persistence/SearchBugs.Persistence.csproj @@ -7,8 +7,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SearchBugs.Ui/.eslintrc.cjs b/src/SearchBugs.Ui/.eslintrc.cjs similarity index 100% rename from SearchBugs.Ui/.eslintrc.cjs rename to src/SearchBugs.Ui/.eslintrc.cjs diff --git a/SearchBugs.Ui/.gitignore b/src/SearchBugs.Ui/.gitignore similarity index 100% rename from SearchBugs.Ui/.gitignore rename to src/SearchBugs.Ui/.gitignore diff --git a/SearchBugs.Ui/README.md b/src/SearchBugs.Ui/README.md similarity index 100% rename from SearchBugs.Ui/README.md rename to src/SearchBugs.Ui/README.md diff --git a/SearchBugs.Ui/components.json b/src/SearchBugs.Ui/components.json similarity index 100% rename from SearchBugs.Ui/components.json rename to src/SearchBugs.Ui/components.json diff --git a/SearchBugs.Ui/index.html b/src/SearchBugs.Ui/index.html similarity index 100% rename from SearchBugs.Ui/index.html rename to src/SearchBugs.Ui/index.html diff --git a/SearchBugs.Ui/package-lock.json b/src/SearchBugs.Ui/package-lock.json similarity index 100% rename from SearchBugs.Ui/package-lock.json rename to src/SearchBugs.Ui/package-lock.json diff --git a/SearchBugs.Ui/package.json b/src/SearchBugs.Ui/package.json similarity index 100% rename from SearchBugs.Ui/package.json rename to src/SearchBugs.Ui/package.json diff --git a/SearchBugs.Ui/postcss.config.js b/src/SearchBugs.Ui/postcss.config.js similarity index 100% rename from SearchBugs.Ui/postcss.config.js rename to src/SearchBugs.Ui/postcss.config.js diff --git a/SearchBugs.Ui/public/logo.svg b/src/SearchBugs.Ui/public/logo.svg similarity index 100% rename from SearchBugs.Ui/public/logo.svg rename to src/SearchBugs.Ui/public/logo.svg diff --git a/SearchBugs.Ui/src/App.tsx b/src/SearchBugs.Ui/src/App.tsx similarity index 100% rename from SearchBugs.Ui/src/App.tsx rename to src/SearchBugs.Ui/src/App.tsx diff --git a/SearchBugs.Ui/src/Route.tsx b/src/SearchBugs.Ui/src/Route.tsx similarity index 100% rename from SearchBugs.Ui/src/Route.tsx rename to src/SearchBugs.Ui/src/Route.tsx diff --git a/SearchBugs.Ui/src/assets/react.svg b/src/SearchBugs.Ui/src/assets/react.svg similarity index 100% rename from SearchBugs.Ui/src/assets/react.svg rename to src/SearchBugs.Ui/src/assets/react.svg diff --git a/SearchBugs.Ui/src/components/ui/badge.tsx b/src/SearchBugs.Ui/src/components/ui/badge.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/badge.tsx rename to src/SearchBugs.Ui/src/components/ui/badge.tsx diff --git a/SearchBugs.Ui/src/components/ui/button.tsx b/src/SearchBugs.Ui/src/components/ui/button.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/button.tsx rename to src/SearchBugs.Ui/src/components/ui/button.tsx diff --git a/SearchBugs.Ui/src/components/ui/card.tsx b/src/SearchBugs.Ui/src/components/ui/card.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/card.tsx rename to src/SearchBugs.Ui/src/components/ui/card.tsx diff --git a/SearchBugs.Ui/src/components/ui/checkbox.tsx b/src/SearchBugs.Ui/src/components/ui/checkbox.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/checkbox.tsx rename to src/SearchBugs.Ui/src/components/ui/checkbox.tsx diff --git a/SearchBugs.Ui/src/components/ui/dropdown-menu.tsx b/src/SearchBugs.Ui/src/components/ui/dropdown-menu.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/dropdown-menu.tsx rename to src/SearchBugs.Ui/src/components/ui/dropdown-menu.tsx diff --git a/SearchBugs.Ui/src/components/ui/input.tsx b/src/SearchBugs.Ui/src/components/ui/input.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/input.tsx rename to src/SearchBugs.Ui/src/components/ui/input.tsx diff --git a/SearchBugs.Ui/src/components/ui/label.tsx b/src/SearchBugs.Ui/src/components/ui/label.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/label.tsx rename to src/SearchBugs.Ui/src/components/ui/label.tsx diff --git a/SearchBugs.Ui/src/components/ui/select.tsx b/src/SearchBugs.Ui/src/components/ui/select.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/select.tsx rename to src/SearchBugs.Ui/src/components/ui/select.tsx diff --git a/SearchBugs.Ui/src/components/ui/sheet.tsx b/src/SearchBugs.Ui/src/components/ui/sheet.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/sheet.tsx rename to src/SearchBugs.Ui/src/components/ui/sheet.tsx diff --git a/SearchBugs.Ui/src/components/ui/table.tsx b/src/SearchBugs.Ui/src/components/ui/table.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/table.tsx rename to src/SearchBugs.Ui/src/components/ui/table.tsx diff --git a/SearchBugs.Ui/src/components/ui/tabs.tsx b/src/SearchBugs.Ui/src/components/ui/tabs.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/tabs.tsx rename to src/SearchBugs.Ui/src/components/ui/tabs.tsx diff --git a/SearchBugs.Ui/src/components/ui/textarea.tsx b/src/SearchBugs.Ui/src/components/ui/textarea.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/textarea.tsx rename to src/SearchBugs.Ui/src/components/ui/textarea.tsx diff --git a/SearchBugs.Ui/src/components/ui/toast.tsx b/src/SearchBugs.Ui/src/components/ui/toast.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/toast.tsx rename to src/SearchBugs.Ui/src/components/ui/toast.tsx diff --git a/SearchBugs.Ui/src/components/ui/toaster.tsx b/src/SearchBugs.Ui/src/components/ui/toaster.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/toaster.tsx rename to src/SearchBugs.Ui/src/components/ui/toaster.tsx diff --git a/SearchBugs.Ui/src/components/ui/toggle-group.tsx b/src/SearchBugs.Ui/src/components/ui/toggle-group.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/toggle-group.tsx rename to src/SearchBugs.Ui/src/components/ui/toggle-group.tsx diff --git a/SearchBugs.Ui/src/components/ui/toggle.tsx b/src/SearchBugs.Ui/src/components/ui/toggle.tsx similarity index 100% rename from SearchBugs.Ui/src/components/ui/toggle.tsx rename to src/SearchBugs.Ui/src/components/ui/toggle.tsx diff --git a/SearchBugs.Ui/src/components/ui/use-toast.ts b/src/SearchBugs.Ui/src/components/ui/use-toast.ts similarity index 100% rename from SearchBugs.Ui/src/components/ui/use-toast.ts rename to src/SearchBugs.Ui/src/components/ui/use-toast.ts diff --git a/SearchBugs.Ui/src/hooks/useApi.ts b/src/SearchBugs.Ui/src/hooks/useApi.ts similarity index 100% rename from SearchBugs.Ui/src/hooks/useApi.ts rename to src/SearchBugs.Ui/src/hooks/useApi.ts diff --git a/SearchBugs.Ui/src/index.css b/src/SearchBugs.Ui/src/index.css similarity index 100% rename from SearchBugs.Ui/src/index.css rename to src/SearchBugs.Ui/src/index.css diff --git a/SearchBugs.Ui/src/layout.tsx b/src/SearchBugs.Ui/src/layout.tsx similarity index 100% rename from SearchBugs.Ui/src/layout.tsx rename to src/SearchBugs.Ui/src/layout.tsx diff --git a/SearchBugs.Ui/src/layouts/Main.tsx b/src/SearchBugs.Ui/src/layouts/Main.tsx similarity index 100% rename from SearchBugs.Ui/src/layouts/Main.tsx rename to src/SearchBugs.Ui/src/layouts/Main.tsx diff --git a/SearchBugs.Ui/src/layouts/MobileSidebar.tsx b/src/SearchBugs.Ui/src/layouts/MobileSidebar.tsx similarity index 100% rename from SearchBugs.Ui/src/layouts/MobileSidebar.tsx rename to src/SearchBugs.Ui/src/layouts/MobileSidebar.tsx diff --git a/SearchBugs.Ui/src/layouts/Sidebar.tsx b/src/SearchBugs.Ui/src/layouts/Sidebar.tsx similarity index 100% rename from SearchBugs.Ui/src/layouts/Sidebar.tsx rename to src/SearchBugs.Ui/src/layouts/Sidebar.tsx diff --git a/SearchBugs.Ui/src/lib/api.ts b/src/SearchBugs.Ui/src/lib/api.ts similarity index 100% rename from SearchBugs.Ui/src/lib/api.ts rename to src/SearchBugs.Ui/src/lib/api.ts diff --git a/SearchBugs.Ui/src/lib/constants.ts b/src/SearchBugs.Ui/src/lib/constants.ts similarity index 100% rename from SearchBugs.Ui/src/lib/constants.ts rename to src/SearchBugs.Ui/src/lib/constants.ts diff --git a/SearchBugs.Ui/src/lib/defaultQueryFn.ts b/src/SearchBugs.Ui/src/lib/defaultQueryFn.ts similarity index 100% rename from SearchBugs.Ui/src/lib/defaultQueryFn.ts rename to src/SearchBugs.Ui/src/lib/defaultQueryFn.ts diff --git a/SearchBugs.Ui/src/lib/queryClient.ts b/src/SearchBugs.Ui/src/lib/queryClient.ts similarity index 100% rename from SearchBugs.Ui/src/lib/queryClient.ts rename to src/SearchBugs.Ui/src/lib/queryClient.ts diff --git a/SearchBugs.Ui/src/lib/utils.ts b/src/SearchBugs.Ui/src/lib/utils.ts similarity index 100% rename from SearchBugs.Ui/src/lib/utils.ts rename to src/SearchBugs.Ui/src/lib/utils.ts diff --git a/SearchBugs.Ui/src/main.tsx b/src/SearchBugs.Ui/src/main.tsx similarity index 100% rename from SearchBugs.Ui/src/main.tsx rename to src/SearchBugs.Ui/src/main.tsx diff --git a/SearchBugs.Ui/src/models/Bug.ts b/src/SearchBugs.Ui/src/models/Bug.ts similarity index 100% rename from SearchBugs.Ui/src/models/Bug.ts rename to src/SearchBugs.Ui/src/models/Bug.ts diff --git a/SearchBugs.Ui/src/models/Project.ts b/src/SearchBugs.Ui/src/models/Project.ts similarity index 100% rename from SearchBugs.Ui/src/models/Project.ts rename to src/SearchBugs.Ui/src/models/Project.ts diff --git a/SearchBugs.Ui/src/pages/BugAddPage.tsx b/src/SearchBugs.Ui/src/pages/BugAddPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/BugAddPage.tsx rename to src/SearchBugs.Ui/src/pages/BugAddPage.tsx diff --git a/SearchBugs.Ui/src/pages/BugDetailsPage.tsx b/src/SearchBugs.Ui/src/pages/BugDetailsPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/BugDetailsPage.tsx rename to src/SearchBugs.Ui/src/pages/BugDetailsPage.tsx diff --git a/SearchBugs.Ui/src/pages/BugsPage.tsx b/src/SearchBugs.Ui/src/pages/BugsPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/BugsPage.tsx rename to src/SearchBugs.Ui/src/pages/BugsPage.tsx diff --git a/SearchBugs.Ui/src/pages/CreateProjectPage.tsx b/src/SearchBugs.Ui/src/pages/CreateProjectPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/CreateProjectPage.tsx rename to src/SearchBugs.Ui/src/pages/CreateProjectPage.tsx diff --git a/SearchBugs.Ui/src/pages/CreateRepositoryPage.tsx b/src/SearchBugs.Ui/src/pages/CreateRepositoryPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/CreateRepositoryPage.tsx rename to src/SearchBugs.Ui/src/pages/CreateRepositoryPage.tsx diff --git a/SearchBugs.Ui/src/pages/DashboardPage.tsx b/src/SearchBugs.Ui/src/pages/DashboardPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/DashboardPage.tsx rename to src/SearchBugs.Ui/src/pages/DashboardPage.tsx diff --git a/SearchBugs.Ui/src/pages/LoginPage.tsx b/src/SearchBugs.Ui/src/pages/LoginPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/LoginPage.tsx rename to src/SearchBugs.Ui/src/pages/LoginPage.tsx diff --git a/SearchBugs.Ui/src/pages/NotificationsPage.tsx b/src/SearchBugs.Ui/src/pages/NotificationsPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/NotificationsPage.tsx rename to src/SearchBugs.Ui/src/pages/NotificationsPage.tsx diff --git a/SearchBugs.Ui/src/pages/ProjectDetailsPage.tsx b/src/SearchBugs.Ui/src/pages/ProjectDetailsPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/ProjectDetailsPage.tsx rename to src/SearchBugs.Ui/src/pages/ProjectDetailsPage.tsx diff --git a/SearchBugs.Ui/src/pages/ProjectsPage.tsx b/src/SearchBugs.Ui/src/pages/ProjectsPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/ProjectsPage.tsx rename to src/SearchBugs.Ui/src/pages/ProjectsPage.tsx diff --git a/SearchBugs.Ui/src/pages/RegisterPage.tsx b/src/SearchBugs.Ui/src/pages/RegisterPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/RegisterPage.tsx rename to src/SearchBugs.Ui/src/pages/RegisterPage.tsx diff --git a/SearchBugs.Ui/src/pages/RepositoriesPage.tsx b/src/SearchBugs.Ui/src/pages/RepositoriesPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/RepositoriesPage.tsx rename to src/SearchBugs.Ui/src/pages/RepositoriesPage.tsx diff --git a/SearchBugs.Ui/src/pages/RepositoryDetailsPage.tsx b/src/SearchBugs.Ui/src/pages/RepositoryDetailsPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/RepositoryDetailsPage.tsx rename to src/SearchBugs.Ui/src/pages/RepositoryDetailsPage.tsx diff --git a/SearchBugs.Ui/src/pages/SettingPage.tsx b/src/SearchBugs.Ui/src/pages/SettingPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/SettingPage.tsx rename to src/SearchBugs.Ui/src/pages/SettingPage.tsx diff --git a/SearchBugs.Ui/src/pages/UserDetailsPage.tsx b/src/SearchBugs.Ui/src/pages/UserDetailsPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/UserDetailsPage.tsx rename to src/SearchBugs.Ui/src/pages/UserDetailsPage.tsx diff --git a/SearchBugs.Ui/src/pages/UsersPage.tsx b/src/SearchBugs.Ui/src/pages/UsersPage.tsx similarity index 100% rename from SearchBugs.Ui/src/pages/UsersPage.tsx rename to src/SearchBugs.Ui/src/pages/UsersPage.tsx diff --git a/SearchBugs.Ui/src/pages/index.ts b/src/SearchBugs.Ui/src/pages/index.ts similarity index 100% rename from SearchBugs.Ui/src/pages/index.ts rename to src/SearchBugs.Ui/src/pages/index.ts diff --git a/SearchBugs.Ui/src/vite-env.d.ts b/src/SearchBugs.Ui/src/vite-env.d.ts similarity index 100% rename from SearchBugs.Ui/src/vite-env.d.ts rename to src/SearchBugs.Ui/src/vite-env.d.ts diff --git a/SearchBugs.Ui/tailwind.config.js b/src/SearchBugs.Ui/tailwind.config.js similarity index 100% rename from SearchBugs.Ui/tailwind.config.js rename to src/SearchBugs.Ui/tailwind.config.js diff --git a/SearchBugs.Ui/tsconfig.app.json b/src/SearchBugs.Ui/tsconfig.app.json similarity index 100% rename from SearchBugs.Ui/tsconfig.app.json rename to src/SearchBugs.Ui/tsconfig.app.json diff --git a/SearchBugs.Ui/tsconfig.json b/src/SearchBugs.Ui/tsconfig.json similarity index 100% rename from SearchBugs.Ui/tsconfig.json rename to src/SearchBugs.Ui/tsconfig.json diff --git a/SearchBugs.Ui/tsconfig.node.json b/src/SearchBugs.Ui/tsconfig.node.json similarity index 100% rename from SearchBugs.Ui/tsconfig.node.json rename to src/SearchBugs.Ui/tsconfig.node.json diff --git a/SearchBugs.Ui/vite.config.ts b/src/SearchBugs.Ui/vite.config.ts similarity index 100% rename from SearchBugs.Ui/vite.config.ts rename to src/SearchBugs.Ui/vite.config.ts diff --git a/SearchBugs.Ui/yarn.lock b/src/SearchBugs.Ui/yarn.lock similarity index 100% rename from SearchBugs.Ui/yarn.lock rename to src/SearchBugs.Ui/yarn.lock diff --git a/Shared/Behaviors/ValidationPipelineBehavior.cs b/src/Shared/Behaviors/ValidationPipelineBehavior.cs similarity index 97% rename from Shared/Behaviors/ValidationPipelineBehavior.cs rename to src/Shared/Behaviors/ValidationPipelineBehavior.cs index 9b8e614..58790d5 100644 --- a/Shared/Behaviors/ValidationPipelineBehavior.cs +++ b/src/Shared/Behaviors/ValidationPipelineBehavior.cs @@ -23,7 +23,7 @@ public async Task Handle(TRequest request, RequestHandlerDelegate(request)); - if (errors.Any()) + if (errors.Length != 0) { return ValidationResultFactory.Create(errors); } diff --git a/Shared/Constants/TableNames.cs b/src/Shared/Constants/TableNames.cs similarity index 100% rename from Shared/Constants/TableNames.cs rename to src/Shared/Constants/TableNames.cs diff --git a/Shared/Data/ISqlConnectionFactory.cs b/src/Shared/Data/ISqlConnectionFactory.cs similarity index 100% rename from Shared/Data/ISqlConnectionFactory.cs rename to src/Shared/Data/ISqlConnectionFactory.cs diff --git a/Shared/Data/ISqlQueryExecutor.cs b/src/Shared/Data/ISqlQueryExecutor.cs similarity index 100% rename from Shared/Data/ISqlQueryExecutor.cs rename to src/Shared/Data/ISqlQueryExecutor.cs diff --git a/Shared/Data/SqlConnectionFactory.cs b/src/Shared/Data/SqlConnectionFactory.cs similarity index 100% rename from Shared/Data/SqlConnectionFactory.cs rename to src/Shared/Data/SqlConnectionFactory.cs diff --git a/Shared/Data/SqlQueryExecutor.cs b/src/Shared/Data/SqlQueryExecutor.cs similarity index 100% rename from Shared/Data/SqlQueryExecutor.cs rename to src/Shared/Data/SqlQueryExecutor.cs diff --git a/Shared/Errors/ConflictError.cs b/src/Shared/Errors/ConflictError.cs similarity index 100% rename from Shared/Errors/ConflictError.cs rename to src/Shared/Errors/ConflictError.cs diff --git a/Shared/Errors/Error.cs b/src/Shared/Errors/Error.cs similarity index 100% rename from Shared/Errors/Error.cs rename to src/Shared/Errors/Error.cs diff --git a/Shared/Errors/NotFoundError.cs b/src/Shared/Errors/NotFoundError.cs similarity index 100% rename from Shared/Errors/NotFoundError.cs rename to src/Shared/Errors/NotFoundError.cs diff --git a/Shared/Exceptions/ValidationException.cs b/src/Shared/Exceptions/ValidationException.cs similarity index 100% rename from Shared/Exceptions/ValidationException.cs rename to src/Shared/Exceptions/ValidationException.cs diff --git a/Shared/Extensions/FunctionalExtensions.cs b/src/Shared/Extensions/FunctionalExtensions.cs similarity index 100% rename from Shared/Extensions/FunctionalExtensions.cs rename to src/Shared/Extensions/FunctionalExtensions.cs diff --git a/Shared/Extensions/LoggerExtensions.cs b/src/Shared/Extensions/LoggerExtensions.cs similarity index 100% rename from Shared/Extensions/LoggerExtensions.cs rename to src/Shared/Extensions/LoggerExtensions.cs diff --git a/Shared/Extensions/NpgsqlDbContextOptionsBuilderExtensions.cs b/src/Shared/Extensions/NpgsqlDbContextOptionsBuilderExtensions.cs similarity index 100% rename from Shared/Extensions/NpgsqlDbContextOptionsBuilderExtensions.cs rename to src/Shared/Extensions/NpgsqlDbContextOptionsBuilderExtensions.cs diff --git a/Shared/Extensions/RuleBuilderOptionsExtensions.cs b/src/Shared/Extensions/RuleBuilderOptionsExtensions.cs similarity index 100% rename from Shared/Extensions/RuleBuilderOptionsExtensions.cs rename to src/Shared/Extensions/RuleBuilderOptionsExtensions.cs diff --git a/Shared/Infrastructure/ValidationResultFactory.cs b/src/Shared/Infrastructure/ValidationResultFactory.cs similarity index 100% rename from Shared/Infrastructure/ValidationResultFactory.cs rename to src/Shared/Infrastructure/ValidationResultFactory.cs diff --git a/Shared/Messaging/ICommand.cs b/src/Shared/Messaging/ICommand.cs similarity index 100% rename from Shared/Messaging/ICommand.cs rename to src/Shared/Messaging/ICommand.cs diff --git a/Shared/Messaging/ICommandHandler.cs b/src/Shared/Messaging/ICommandHandler.cs similarity index 100% rename from Shared/Messaging/ICommandHandler.cs rename to src/Shared/Messaging/ICommandHandler.cs diff --git a/Shared/Messaging/IDomainEventHandler.cs b/src/Shared/Messaging/IDomainEventHandler.cs similarity index 100% rename from Shared/Messaging/IDomainEventHandler.cs rename to src/Shared/Messaging/IDomainEventHandler.cs diff --git a/Shared/Messaging/IQuery.cs b/src/Shared/Messaging/IQuery.cs similarity index 100% rename from Shared/Messaging/IQuery.cs rename to src/Shared/Messaging/IQuery.cs diff --git a/Shared/Messaging/IQueryHandler.cs b/src/Shared/Messaging/IQueryHandler.cs similarity index 100% rename from Shared/Messaging/IQueryHandler.cs rename to src/Shared/Messaging/IQueryHandler.cs diff --git a/Shared/Options/ConnectionStringOptions.cs b/src/Shared/Options/ConnectionStringOptions.cs similarity index 100% rename from Shared/Options/ConnectionStringOptions.cs rename to src/Shared/Options/ConnectionStringOptions.cs diff --git a/Shared/Options/ConnectionStringSetup.cs b/src/Shared/Options/ConnectionStringSetup.cs similarity index 100% rename from Shared/Options/ConnectionStringSetup.cs rename to src/Shared/Options/ConnectionStringSetup.cs diff --git a/Shared/Primitives/DomainEvent.cs b/src/Shared/Primitives/DomainEvent.cs similarity index 100% rename from Shared/Primitives/DomainEvent.cs rename to src/Shared/Primitives/DomainEvent.cs diff --git a/Shared/Primitives/Entity.cs b/src/Shared/Primitives/Entity.cs similarity index 100% rename from Shared/Primitives/Entity.cs rename to src/Shared/Primitives/Entity.cs diff --git a/Shared/Primitives/Enumeration.cs b/src/Shared/Primitives/Enumeration.cs similarity index 100% rename from Shared/Primitives/Enumeration.cs rename to src/Shared/Primitives/Enumeration.cs diff --git a/Shared/Primitives/IAuditable.cs b/src/Shared/Primitives/IAuditable.cs similarity index 100% rename from Shared/Primitives/IAuditable.cs rename to src/Shared/Primitives/IAuditable.cs diff --git a/Shared/Primitives/IDomainEvent.cs b/src/Shared/Primitives/IDomainEvent.cs similarity index 100% rename from Shared/Primitives/IDomainEvent.cs rename to src/Shared/Primitives/IDomainEvent.cs diff --git a/Shared/Primitives/IEntity.cs b/src/Shared/Primitives/IEntity.cs similarity index 100% rename from Shared/Primitives/IEntity.cs rename to src/Shared/Primitives/IEntity.cs diff --git a/Shared/Primitives/IEntityId.cs b/src/Shared/Primitives/IEntityId.cs similarity index 100% rename from Shared/Primitives/IEntityId.cs rename to src/Shared/Primitives/IEntityId.cs diff --git a/Shared/Primitives/ValueObject.cs b/src/Shared/Primitives/ValueObject.cs similarity index 100% rename from Shared/Primitives/ValueObject.cs rename to src/Shared/Primitives/ValueObject.cs diff --git a/Shared/Results/IValidationResult.cs b/src/Shared/Results/IValidationResult.cs similarity index 100% rename from Shared/Results/IValidationResult.cs rename to src/Shared/Results/IValidationResult.cs diff --git a/Shared/Results/Result.cs b/src/Shared/Results/Result.cs similarity index 100% rename from Shared/Results/Result.cs rename to src/Shared/Results/Result.cs diff --git a/Shared/Results/ResultExtensions.cs b/src/Shared/Results/ResultExtensions.cs similarity index 100% rename from Shared/Results/ResultExtensions.cs rename to src/Shared/Results/ResultExtensions.cs diff --git a/Shared/Results/ResultT.cs b/src/Shared/Results/ResultT.cs similarity index 88% rename from Shared/Results/ResultT.cs rename to src/Shared/Results/ResultT.cs index ec81720..f277887 100644 --- a/Shared/Results/ResultT.cs +++ b/src/Shared/Results/ResultT.cs @@ -25,9 +25,9 @@ protected internal Result(TValue? value, bool isSuccess, Error error) /// /// The result value if the result is successful. /// when is true. - public TValue Value => IsSuccess + public TValue Value => IsSuccess || _value is null ? _value! - : throw new InvalidOperationException("The value of a failure result can not be accessed."); + : throw new InvalidOperationException("The value of a failure result can not be accessed."); public static implicit operator Result(TValue? value) => Create(value); } diff --git a/Shared/Results/ValidationResult.cs b/src/Shared/Results/ValidationResult.cs similarity index 100% rename from Shared/Results/ValidationResult.cs rename to src/Shared/Results/ValidationResult.cs diff --git a/Shared/Results/ValidationResultT.cs b/src/Shared/Results/ValidationResultT.cs similarity index 100% rename from Shared/Results/ValidationResultT.cs rename to src/Shared/Results/ValidationResultT.cs diff --git a/Shared/Shared.csproj b/src/Shared/Shared.csproj similarity index 88% rename from Shared/Shared.csproj rename to src/Shared/Shared.csproj index c40aceb..638e472 100644 --- a/Shared/Shared.csproj +++ b/src/Shared/Shared.csproj @@ -8,7 +8,7 @@ - + diff --git a/Shared/Time/ISystemTime.cs b/src/Shared/Time/ISystemTime.cs similarity index 100% rename from Shared/Time/ISystemTime.cs rename to src/Shared/Time/ISystemTime.cs diff --git a/Shared/Time/SystemTime.cs b/src/Shared/Time/SystemTime.cs similarity index 100% rename from Shared/Time/SystemTime.cs rename to src/Shared/Time/SystemTime.cs diff --git a/SearchBugs.Application.UnitTests/AuthenicationsTest/LoginCommandHandlerTest.cs b/test/SearchBugs.Application.UnitTests/AuthenicationsTest/LoginCommandHandlerTest.cs similarity index 100% rename from SearchBugs.Application.UnitTests/AuthenicationsTest/LoginCommandHandlerTest.cs rename to test/SearchBugs.Application.UnitTests/AuthenicationsTest/LoginCommandHandlerTest.cs diff --git a/SearchBugs.Application.UnitTests/AuthenicationsTest/RegisterCommandHandlerTest.cs b/test/SearchBugs.Application.UnitTests/AuthenicationsTest/RegisterCommandHandlerTest.cs similarity index 100% rename from SearchBugs.Application.UnitTests/AuthenicationsTest/RegisterCommandHandlerTest.cs rename to test/SearchBugs.Application.UnitTests/AuthenicationsTest/RegisterCommandHandlerTest.cs diff --git a/test/SearchBugs.Application.UnitTests/BugTrackingTest/CreateBugCommandHandlerTest.cs b/test/SearchBugs.Application.UnitTests/BugTrackingTest/CreateBugCommandHandlerTest.cs new file mode 100644 index 0000000..593750f --- /dev/null +++ b/test/SearchBugs.Application.UnitTests/BugTrackingTest/CreateBugCommandHandlerTest.cs @@ -0,0 +1,95 @@ +using FluentAssertions; +using Moq; +using SearchBugs.Application.BugTracking; +using SearchBugs.Application.BugTracking.Create; +using SearchBugs.Domain; +using SearchBugs.Domain.Bugs; +using Shared.Results; + +namespace SearchBugs.Application.UnitTests.BugTrackingTest; + +public class CreateBugCommandHandlerTest +{ + + private readonly Mock _bugRepository; + private readonly Mock _unitOfWork; + private readonly CreateBugCommandHandler _sut; + + + public CreateBugCommandHandlerTest() + { + _bugRepository = new(); + _unitOfWork = new(); + _sut = new CreateBugCommandHandler(_bugRepository.Object, _unitOfWork.Object); + } + + [Theory] + [ClassData(typeof(CreateBugCommandHandlerTestData))] + public async Task Handle_WhenBugStatusIsSuccess_ShouldReturnSuccess(CreateBugCommand command) + { + // Arrange + _bugRepository.Setup(x => x.Add(It.IsAny())).Returns(Task.FromResult(Result.Success())); + + // Act + var result = await _sut.Handle(command, CancellationToken.None); + + // Assert + result.IsSuccess.Should().BeTrue(); + } + + [Theory] + [MemberData(nameof(CreateBugCommandHandlerTestData.InValidBugStatus), MemberType = typeof(CreateBugCommandHandlerTestData))] + public async Task Handle_WhenBugStatusIsInvalid_ShouldReturnFailure(CreateBugCommand command) + { + // Arrange + _bugRepository.Setup(x => x.Add(It.IsAny())).Returns(Task.FromResult(Result.Success())); + + // Act + var result = await _sut.Handle(command, CancellationToken.None); + + // Assert + result.Error.Should().Be(BugValidationErrors.InvalidBugStatus); + result.IsSuccess.Should().BeFalse(); + } + + [Theory] + [MemberData(nameof(CreateBugCommandHandlerTestData.InValidBugPriority), MemberType = typeof(CreateBugCommandHandlerTestData))] + public async Task Handle_WhenBugPriorityIsInvalid_ShouldReturnFailure(CreateBugCommand command) + { + // Arrange + _bugRepository.Setup(x => x.Add(It.IsAny())).Returns(Task.FromResult(Result.Success())); + + // Act + var result = await _sut.Handle(command, CancellationToken.None); + + // Assert + result.Error.Should().Be(BugValidationErrors.InvalidBugPriority); + result.IsSuccess.Should().BeFalse(); + } + + [Fact] + public async Task Handle_WhenBugDataIsValid_ShouldReturnSuccess() + { + // Arrange + var command = new CreateBugCommand( + Title: "Title", + Description: "Description", + Status: BugStatus.Open.Name, + Priority: BugPriority.High.Name, + Severity: BugSeverity.Low.Name, + ProjectId: Guid.NewGuid(), + AssigneeId: Guid.NewGuid(), + ReporterId: Guid.NewGuid() + ); + + _bugRepository.Setup(x => x.Add(It.IsAny())).Returns(Task.FromResult(Result.Success())); + + // Act + var result = await _sut.Handle(command, CancellationToken.None); + + // Assert + _unitOfWork.Verify(x => x.SaveChangesAsync(CancellationToken.None), Times.Once); + result.IsSuccess.Should().BeTrue(); + } + +} diff --git a/test/SearchBugs.Application.UnitTests/BugTrackingTest/CreateBugCommandHandlerTestData.cs b/test/SearchBugs.Application.UnitTests/BugTrackingTest/CreateBugCommandHandlerTestData.cs new file mode 100644 index 0000000..bccf56d --- /dev/null +++ b/test/SearchBugs.Application.UnitTests/BugTrackingTest/CreateBugCommandHandlerTestData.cs @@ -0,0 +1,112 @@ +using Bogus; +using SearchBugs.Application.BugTracking.Create; +using SearchBugs.Domain.Bugs; +namespace SearchBugs.Application.UnitTests.BugTrackingTest; + +internal class CreateBugCommandHandlerTestData : TheoryData +{ + public CreateBugCommandHandlerTestData() + { + var faker = new Faker(); + string[] status = BugStatus.GetValues().Select(x => x.Name).ToArray(); + string[] priority = BugPriority.GetValues().Select(x => x.Name).ToArray(); + Add(new CreateBugCommand(faker.Lorem.Sentence(), + faker.Lorem.Paragraph(), + faker.PickRandom(status), + faker.PickRandom(priority), + faker.PickRandom(BugSeverity.GetValues().Select(x => x.Name).ToArray()), + faker.Random.Guid(), + faker.Random.Guid(), + faker.Random.Guid())); + } + + public static IEnumerable InValidBugStatus() + { + var faker = new Faker(); + string[] status = new string[] { "Invalid" }; + string[] priority = BugPriority.GetValues().Select(x => x.Name).ToArray(); + yield return new object[] { new CreateBugCommand(faker.Lorem.Sentence(), + faker.Lorem.Paragraph(), + faker.PickRandom(status), + faker.PickRandom(priority), + faker.PickRandom(BugSeverity.GetValues().Select(x => x.Name).ToArray()), + faker.Random.Guid(), + faker.Random.Guid(), + faker.Random.Guid()) }; + } + + public static IEnumerable InValidBugPriority() + { + var faker = new Faker(); + string[] status = BugStatus.GetValues().Select(x => x.Name).ToArray(); + string[] priority = new string[] { "Invalid" }; + yield return new object[] { new CreateBugCommand(faker.Lorem.Sentence(), + faker.Lorem.Paragraph(), + faker.PickRandom(status), + faker.PickRandom(priority), + faker.PickRandom(BugSeverity.GetValues().Select(x => x.Name).ToArray()), + faker.Random.Guid(), + faker.Random.Guid(), + faker.Random.Guid()) }; + } + + public static IEnumerable InValidBugSeverity() + { + var faker = new Faker(); + string[] status = BugStatus.GetValues().Select(x => x.Name).ToArray(); + string[] priority = BugPriority.GetValues().Select(x => x.Name).ToArray(); + yield return new object[] { new CreateBugCommand(faker.Lorem.Sentence(), + faker.Lorem.Paragraph(), + faker.PickRandom(status), + faker.PickRandom(priority), + "Invalid", + faker.Random.Guid(), + faker.Random.Guid(), + faker.Random.Guid()) }; + } + + public static IEnumerable InValidProjectId() + { + var faker = new Faker(); + string[] status = BugStatus.GetValues().Select(x => x.Name).ToArray(); + string[] priority = BugPriority.GetValues().Select(x => x.Name).ToArray(); + yield return new object[] { new CreateBugCommand(faker.Lorem.Sentence(), + faker.Lorem.Paragraph(), + faker.PickRandom(status), + faker.PickRandom(priority), + faker.PickRandom(BugSeverity.GetValues().Select(x => x.Name).ToArray()), + Guid.Empty, + faker.Random.Guid(), + faker.Random.Guid()) }; + } + + public static IEnumerable InValidAssigneeId() + { + var faker = new Faker(); + string[] status = BugStatus.GetValues().Select(x => x.Name).ToArray(); + string[] priority = BugPriority.GetValues().Select(x => x.Name).ToArray(); + yield return new object[] { new CreateBugCommand(faker.Lorem.Sentence(), + faker.Lorem.Paragraph(), + faker.PickRandom(status), + faker.PickRandom(priority), + faker.PickRandom(BugSeverity.GetValues().Select(x => x.Name).ToArray()), + faker.Random.Guid(), + Guid.Empty, + faker.Random.Guid()) }; + } + + public static IEnumerable InValidReporterId() + { + var faker = new Faker(); + string[] status = BugStatus.GetValues().Select(x => x.Name).ToArray(); + string[] priority = BugPriority.GetValues().Select(x => x.Name).ToArray(); + yield return new object[] { new CreateBugCommand(faker.Lorem.Sentence(), + faker.Lorem.Paragraph(), + faker.PickRandom(status), + faker.PickRandom(priority), + faker.PickRandom(BugSeverity.GetValues().Select(x => x.Name).ToArray()), + faker.Random.Guid(), + faker.Random.Guid(), + Guid.Empty) }; + } +} diff --git a/SearchBugs.Application.UnitTests/SearchBugs.Application.UnitTests.csproj b/test/SearchBugs.Application.UnitTests/SearchBugs.Application.UnitTests.csproj similarity index 76% rename from SearchBugs.Application.UnitTests/SearchBugs.Application.UnitTests.csproj rename to test/SearchBugs.Application.UnitTests/SearchBugs.Application.UnitTests.csproj index dfb2c11..2dd67da 100644 --- a/SearchBugs.Application.UnitTests/SearchBugs.Application.UnitTests.csproj +++ b/test/SearchBugs.Application.UnitTests/SearchBugs.Application.UnitTests.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -10,6 +10,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -29,13 +30,9 @@ - - - - - - - + + + diff --git a/SearchBugs.Domain.UnitTests/Bugs/BugsUnitTest.cs b/test/SearchBugs.Domain.UnitTests/Bugs/BugsUnitTest.cs similarity index 100% rename from SearchBugs.Domain.UnitTests/Bugs/BugsUnitTest.cs rename to test/SearchBugs.Domain.UnitTests/Bugs/BugsUnitTest.cs diff --git a/SearchBugs.Domain.UnitTests/Data/Bugs/CreateBug.cs b/test/SearchBugs.Domain.UnitTests/Data/Bugs/CreateBug.cs similarity index 100% rename from SearchBugs.Domain.UnitTests/Data/Bugs/CreateBug.cs rename to test/SearchBugs.Domain.UnitTests/Data/Bugs/CreateBug.cs diff --git a/SearchBugs.Domain.UnitTests/Data/Users/UserCreate.cs b/test/SearchBugs.Domain.UnitTests/Data/Users/UserCreate.cs similarity index 100% rename from SearchBugs.Domain.UnitTests/Data/Users/UserCreate.cs rename to test/SearchBugs.Domain.UnitTests/Data/Users/UserCreate.cs diff --git a/SearchBugs.Domain.UnitTests/SearchBugs.Domain.UnitTests.csproj b/test/SearchBugs.Domain.UnitTests/SearchBugs.Domain.UnitTests.csproj similarity index 90% rename from SearchBugs.Domain.UnitTests/SearchBugs.Domain.UnitTests.csproj rename to test/SearchBugs.Domain.UnitTests/SearchBugs.Domain.UnitTests.csproj index 22f9867..dd65a2c 100644 --- a/SearchBugs.Domain.UnitTests/SearchBugs.Domain.UnitTests.csproj +++ b/test/SearchBugs.Domain.UnitTests/SearchBugs.Domain.UnitTests.csproj @@ -23,7 +23,7 @@ - + diff --git a/SearchBugs.Infrastructure.UnitTests/SearchBugs.Infrastructure.UnitTests.csproj b/test/SearchBugs.Infrastructure.UnitTests/SearchBugs.Infrastructure.UnitTests.csproj similarity index 100% rename from SearchBugs.Infrastructure.UnitTests/SearchBugs.Infrastructure.UnitTests.csproj rename to test/SearchBugs.Infrastructure.UnitTests/SearchBugs.Infrastructure.UnitTests.csproj diff --git a/SearchBugs.Persistence.UnitTests/SearchBugs.Persistence.UnitTests.csproj b/test/SearchBugs.Persistence.UnitTests/SearchBugs.Persistence.UnitTests.csproj similarity index 100% rename from SearchBugs.Persistence.UnitTests/SearchBugs.Persistence.UnitTests.csproj rename to test/SearchBugs.Persistence.UnitTests/SearchBugs.Persistence.UnitTests.csproj