diff --git a/Backend.sln b/Backend.sln index f480d16..1596e27 100644 --- a/Backend.sln +++ b/Backend.sln @@ -10,6 +10,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Validators", "Common EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Commands", "Common.Commands\Common.Commands.csproj", "{57A082E9-0442-4566-ADC5-D6EF3B10D396}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DocumentDomain.Spec", "DocumentDomain.Spec\DocumentDomain.Spec.csproj", "{5052A579-CCC9-447B-9541-E38FB5CD6D32}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -36,5 +38,9 @@ Global {57A082E9-0442-4566-ADC5-D6EF3B10D396}.Debug|Any CPU.Build.0 = Debug|Any CPU {57A082E9-0442-4566-ADC5-D6EF3B10D396}.Release|Any CPU.ActiveCfg = Release|Any CPU {57A082E9-0442-4566-ADC5-D6EF3B10D396}.Release|Any CPU.Build.0 = Release|Any CPU + {5052A579-CCC9-447B-9541-E38FB5CD6D32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5052A579-CCC9-447B-9541-E38FB5CD6D32}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5052A579-CCC9-447B-9541-E38FB5CD6D32}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5052A579-CCC9-447B-9541-E38FB5CD6D32}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection -EndGlobal +EndGlobal \ No newline at end of file diff --git a/Backend.sln.DotSettings b/Backend.sln.DotSettings index 374f1cc..034826e 100644 --- a/Backend.sln.DotSettings +++ b/Backend.sln.DotSettings @@ -2,24 +2,21 @@ WARNING WARNING WARNING - <?xml version="1.0" encoding="utf-16"?><Profile name="Acsanyi"><GherkinReformatCode>True</GherkinReformatCode><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><HtmlReformatCode>True</HtmlReformatCode><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>True</EmbraceInRegion></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><CSReorderTypeMembers>True</CSReorderTypeMembers><IDEA_SETTINGS>&lt;profile version="1.0"&gt; + <?xml version="1.0" encoding="utf-16"?><Profile name="Acsanyi"><GherkinReformatCode>True</GherkinReformatCode><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><HtmlReformatCode>True</HtmlReformatCode><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><CSReorderTypeMembers>True</CSReorderTypeMembers><IDEA_SETTINGS>&lt;profile version="1.0"&gt; &lt;option name="myName" value="Acsanyi" /&gt; &lt;inspection_tool class="WrongPropertyKeyValueDelimiter" enabled="false" level="WEAK WARNING" enabled_by_default="false" /&gt; &lt;/profile&gt;</IDEA_SETTINGS><RIDER_SETTINGS>&lt;profile&gt; &lt;Language id="CSS"&gt; - &lt;Rearrange&gt;true&lt;/Rearrange&gt; &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;Rearrange&gt;true&lt;/Rearrange&gt; &lt;/Language&gt; &lt;Language id="EditorConfig"&gt; &lt;Reformat&gt;true&lt;/Reformat&gt; &lt;/Language&gt; - &lt;Language id="GraphQL"&gt; - &lt;Reformat&gt;true&lt;/Reformat&gt; - &lt;/Language&gt; &lt;Language id="HTML"&gt; - &lt;Rearrange&gt;true&lt;/Rearrange&gt; &lt;OptimizeImports&gt;true&lt;/OptimizeImports&gt; &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;Rearrange&gt;true&lt;/Rearrange&gt; &lt;/Language&gt; &lt;Language id="Handlebars"&gt; &lt;Reformat&gt;true&lt;/Reformat&gt; @@ -46,9 +43,9 @@ &lt;Reformat&gt;true&lt;/Reformat&gt; &lt;/Language&gt; &lt;Language id="XML"&gt; - &lt;Rearrange&gt;true&lt;/Rearrange&gt; &lt;OptimizeImports&gt;true&lt;/OptimizeImports&gt; &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;Rearrange&gt;true&lt;/Rearrange&gt; &lt;/Language&gt; &lt;Language id="liquid"&gt; &lt;Reformat&gt;true&lt;/Reformat&gt; @@ -58,6 +55,9 @@ &lt;/Language&gt; &lt;/profile&gt;</RIDER_SETTINGS></Profile> 1 + True + False + False UseExplicitType UseExplicitType UseExplicitType diff --git a/Common.Commands/Exceptions/InvalidArgumentCommandException.cs b/Common.Commands/Exceptions/InvalidArgumentCommandException.cs index 474d6df..23edac1 100644 --- a/Common.Commands/Exceptions/InvalidArgumentCommandException.cs +++ b/Common.Commands/Exceptions/InvalidArgumentCommandException.cs @@ -1,7 +1,7 @@ -using System.Runtime.Serialization; - namespace Common.Commands.Exceptions; +using System.Runtime.Serialization; + public class InvalidArgumentCommandException : Exception { public InvalidArgumentCommandException() diff --git a/Common.Commands/Exceptions/NoSuchItemCommandException.cs b/Common.Commands/Exceptions/NoSuchItemCommandException.cs index 94462e8..e32f38b 100644 --- a/Common.Commands/Exceptions/NoSuchItemCommandException.cs +++ b/Common.Commands/Exceptions/NoSuchItemCommandException.cs @@ -1,11 +1,11 @@ #region -using System.Runtime.Serialization; - #endregion namespace Common.Commands.Exceptions; +using System.Runtime.Serialization; + public class NoSuchItemCommandException : Exception { public NoSuchItemCommandException() diff --git a/Common.Commands/Exceptions/OperationCancelledCommandException.cs b/Common.Commands/Exceptions/OperationCancelledCommandException.cs index c4f3a93..8252f09 100644 --- a/Common.Commands/Exceptions/OperationCancelledCommandException.cs +++ b/Common.Commands/Exceptions/OperationCancelledCommandException.cs @@ -1,7 +1,7 @@ -using System.Runtime.Serialization; - namespace Common.Commands.Exceptions; +using System.Runtime.Serialization; + public class OperationCancelledCommandException : Exception { public OperationCancelledCommandException() diff --git a/Common.Commands/Exceptions/UnknownErrorCommandException.cs b/Common.Commands/Exceptions/UnknownErrorCommandException.cs index 921c383..b133a3e 100644 --- a/Common.Commands/Exceptions/UnknownErrorCommandException.cs +++ b/Common.Commands/Exceptions/UnknownErrorCommandException.cs @@ -1,7 +1,7 @@ -using System.Runtime.Serialization; - namespace Common.Commands.Exceptions; +using System.Runtime.Serialization; + public class UnknownErrorCommandException : Exception { public UnknownErrorCommandException() diff --git a/Common.Sagas/SagaException.cs b/Common.Sagas/SagaException.cs index f7cb0dc..738aa4c 100644 --- a/Common.Sagas/SagaException.cs +++ b/Common.Sagas/SagaException.cs @@ -1,7 +1,7 @@ -using System.Runtime.Serialization; - namespace Common.Sagas; +using System.Runtime.Serialization; + public class SagaException : Exception { public SagaException() diff --git a/DocumentDomain.Spec/DocumentDomain.Spec.csproj b/DocumentDomain.Spec/DocumentDomain.Spec.csproj new file mode 100644 index 0000000..1eb7351 --- /dev/null +++ b/DocumentDomain.Spec/DocumentDomain.Spec.csproj @@ -0,0 +1,38 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + + + diff --git a/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaInputInvalidData.cs b/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaInputInvalidData.cs new file mode 100644 index 0000000..b05bdfd --- /dev/null +++ b/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaInputInvalidData.cs @@ -0,0 +1,52 @@ +namespace DocumentDomain.Spec.Operations.Sagas; + +using System.Collections; +using Contracts; + +public class AddDocumentSagaInputInvalidData : IEnumerable +{ + public IEnumerator GetEnumerator() + { + yield return new object[] + { + new DocumentInput { Id = 1, Name = "asd", Description = "asd" } + }; + yield return new object[] + { + new DocumentInput { Id = 0, Name = null, Description = "asd" } + }; + yield return new object[] + { + new DocumentInput { Id = 0, Name = string.Empty, Description = "asd" } + }; + yield return new object[] + { + new DocumentInput { Id = 0, Name = " ", Description = "asd" } + }; + yield return new object[] + { + new DocumentInput { Id = 0, Name = "as ", Description = "asd" } + }; + yield return new object[] + { + new DocumentInput { Id = 0, Name = "asd", Description = null } + }; + yield return new object[] + { + new DocumentInput { Id = 0, Name = "asd", Description = string.Empty } + }; + yield return new object[] + { + new DocumentInput { Id = 0, Name = "asd", Description = " " } + }; + yield return new object[] + { + new DocumentInput { Id = 0, Name = "asd", Description = "as " } + }; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } +} \ No newline at end of file diff --git a/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaInputValidData.cs b/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaInputValidData.cs new file mode 100644 index 0000000..c972e3d --- /dev/null +++ b/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaInputValidData.cs @@ -0,0 +1,20 @@ +namespace DocumentDomain.Spec.Operations.Sagas; + +using System.Collections; +using Contracts; + +public class AddDocumentSagaInputValidData : IEnumerable +{ + public IEnumerator GetEnumerator() + { + yield return new object[] + { + new DocumentInput { Id = 0, Name = "asd", Description = "asd" } + }; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } +} \ No newline at end of file diff --git a/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaInputValidatorShould.cs b/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaInputValidatorShould.cs new file mode 100644 index 0000000..120c028 --- /dev/null +++ b/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaInputValidatorShould.cs @@ -0,0 +1,32 @@ +namespace DocumentDomain.Spec.Operations.Sagas; + +using Contracts; +using FluentAssertions; +using FluentValidation.Results; +using Infrastructure.Validators; + +public class AddDocumentSagaInputValidatorShould +{ + private readonly AddDocumentSagaInputValidator AddDocumentSagaInputValidator; + + public AddDocumentSagaInputValidatorShould() + { + AddDocumentSagaInputValidator = new AddDocumentSagaInputValidator(); + } + + [Theory] + [ClassData(typeof(AddDocumentSagaInputInvalidData))] + public void IndicateTheInputIsInvalid(DocumentInput documentInput) + { + ValidationResult? res = AddDocumentSagaInputValidator.Validate(documentInput); + res.IsValid.Should().BeFalse(); + } + + [Theory] + [ClassData(typeof(AddDocumentSagaInputValidData))] + public void IndicateTheInputIsValid(DocumentInput documentInput) + { + ValidationResult? res = AddDocumentSagaInputValidator.Validate(documentInput); + res.IsValid.Should().BeTrue(); + } +} \ No newline at end of file diff --git a/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaShould.cs b/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaShould.cs new file mode 100644 index 0000000..40f22ae --- /dev/null +++ b/DocumentDomain.Spec/Operations/Sagas/AddDocumentSagaShould.cs @@ -0,0 +1,41 @@ +namespace DocumentDomain.Spec.Operations.Sagas; + +using Common.Sagas; +using Contracts; +using DocumentDomain.Operations.Sagas; +using FluentAssertions; + +public class AddDocumentSagaShould : SagaBaseTest +{ + [Fact] + public async Task AddDocument() + { + DocumentInput input = new DocumentInput + { + Name = "name", + Description = "description" + }; + AddDocumentSagaContext ctx = new AddDocumentSagaContext + { + Payload = input + }; + DocumentResult result = await AddDocumentSaga.ExecuteAsync(ctx); + + result.Should().NotBeNull(); + result.Id.Should().BeGreaterThanOrEqualTo(1); + result.Name.Should().Be(input.Name); + result.Description.Should().Be(input.Description); + } + + [Theory] + [ClassData(typeof(AddDocumentSagaInputInvalidData))] + public async Task ThrowWhenInputIsInvalid(DocumentInput documentInput) + { + AddDocumentSagaContext ctx = new AddDocumentSagaContext + { + Payload = documentInput + }; + Func task = async () => { await AddDocumentSaga.ExecuteAsync(ctx); }; + await task.Should().ThrowExactlyAsync(); + } +} \ No newline at end of file diff --git a/DocumentDomain.Spec/Operations/Sagas/SagaBaseTest.cs b/DocumentDomain.Spec/Operations/Sagas/SagaBaseTest.cs new file mode 100644 index 0000000..64b7eb8 --- /dev/null +++ b/DocumentDomain.Spec/Operations/Sagas/SagaBaseTest.cs @@ -0,0 +1,99 @@ +namespace DocumentDomain.Spec.Operations.Sagas; + +using Contracts; +using DocumentDomain.Operations.Commands; +using DocumentDomain.Operations.Sagas; +using FluentValidation; +using Infrastructure.Database; +using Infrastructure.Mappers; +using Infrastructure.Validators; +using Microsoft.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + +public class SagaBaseTest : IDisposable +{ + private readonly IValidator _addDocumentSagaInputValidator; + private readonly IDocumentInputMapper _documentInputMapper; + private readonly IDocumentMapper _documentMapper; + private readonly DocumentStructureNodeInputValidator _documentStructureNodeInputValidator; + private readonly IDocumentStructureNodeMapper _documentStructureNodeMapper; + private IAddDocumentCommand _addDocumentCommand; + private IAddStructureNodeTreeCommand _addStructureNodeTreeCommand; + private DbContextOptions _dbContextOptions; + private GetDocumentByIdCommand _getDocumentByIdCommand; + protected AddDocumentSaga AddDocumentSaga; + private SqliteConnection connection; + + protected SagaBaseTest() + { + InitializeDbContext(); + _documentMapper = new DocumentMapper(); + _documentInputMapper = new DocumentInputMapper(); + _addDocumentSagaInputValidator = new AddDocumentSagaInputValidator(); + InitializeAddDocumentCommand(); + + _documentStructureNodeMapper = new DocumentStructureNodeMapper(); + _documentStructureNodeInputValidator = new DocumentStructureNodeInputValidator(); + InitialzeAddStructureNodeTreeCommand(); + + InitializeGetDocumentByIdCommand(); + AddDocumentSaga = new AddDocumentSaga( + _addDocumentCommand, + _addStructureNodeTreeCommand, + _getDocumentByIdCommand, + InitializeLogging() + ); + } + + public void Dispose() => connection.Dispose(); + + private void InitializeGetDocumentByIdCommand() + { + _getDocumentByIdCommand = new GetDocumentByIdCommand( + _documentMapper, + _dbContextOptions, + InitializeLogging()); + } + + private void InitialzeAddStructureNodeTreeCommand() + { + _addStructureNodeTreeCommand = new AddStructureNodeTreeCommand( + _documentStructureNodeMapper, + _dbContextOptions, + _documentStructureNodeInputValidator, + InitializeLogging() + ); + } + + private void InitializeAddDocumentCommand() + { + _addDocumentCommand = new AddDocumentCommand( + _documentMapper, + _documentInputMapper, + _addDocumentSagaInputValidator, + _dbContextOptions, + InitializeLogging() + ); + } + + private ILogger InitializeLogging() + { + return LoggerFactory.Create(builder => { builder.AddConsole(); }).CreateLogger(); + } + + private void InitializeDbContext() + { + connection = new SqliteConnection("Filename=:memory:"); + connection.Open(); + _dbContextOptions = new DbContextOptionsBuilder() + .UseSqlite(connection) + .LogTo(Console.WriteLine) + .EnableDetailedErrors() + .EnableSensitiveDataLogging() + .Options; + + using DocumentDomainDbContext context = new DocumentDomainDbContext(_dbContextOptions); + context.Database.EnsureCreated(); + } +} \ No newline at end of file diff --git a/DocumentDomain/Entity/Document.cs b/DocumentDomain/Entity/Document.cs index d518a9e..1c29efb 100644 --- a/DocumentDomain/Entity/Document.cs +++ b/DocumentDomain/Entity/Document.cs @@ -3,7 +3,8 @@ namespace DocumentDomain.Entity; /// /// The Document entity ///

-/// The Document entity represents a document and the root of a tree including many objects describing a document in +/// The Document entity represents a document and the root of a tree including many objects describing a document +/// in /// the system. ///

///

diff --git a/DocumentDomain/Entity/Relation.cs b/DocumentDomain/Entity/Relation.cs index e82e219..24879cd 100644 --- a/DocumentDomain/Entity/Relation.cs +++ b/DocumentDomain/Entity/Relation.cs @@ -1,7 +1,6 @@ namespace DocumentDomain.Entity; ///

-/// /// public class Relation { diff --git a/DocumentDomain/Infrastructure/Database/ApplicationEntityConfiguration.cs b/DocumentDomain/Infrastructure/Database/ApplicationEntityConfiguration.cs index 1bbb9d4..86779cc 100644 --- a/DocumentDomain/Infrastructure/Database/ApplicationEntityConfiguration.cs +++ b/DocumentDomain/Infrastructure/Database/ApplicationEntityConfiguration.cs @@ -1,9 +1,9 @@ -using DocumentDomain.Entity; +namespace DocumentDomain.Infrastructure.Database; + +using Entity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace DocumentDomain.Infrastructure.Database; - public class ApplicationEntityConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/DocumentDomain/Infrastructure/Database/DocumentDomainDbContext.cs b/DocumentDomain/Infrastructure/Database/DocumentDomainDbContext.cs index abe81a6..8d83a3f 100644 --- a/DocumentDomain/Infrastructure/Database/DocumentDomainDbContext.cs +++ b/DocumentDomain/Infrastructure/Database/DocumentDomainDbContext.cs @@ -1,12 +1,8 @@ -#region +namespace DocumentDomain.Infrastructure.Database; -using DocumentDomain.Entity; +using Entity; using Microsoft.EntityFrameworkCore; -#endregion - -namespace DocumentDomain.Infrastructure.Database; - public class DocumentDomainDbContext : DbContext { protected DocumentDomainDbContext() diff --git a/DocumentDomain/Infrastructure/Database/DocumentEntityConfiguration.cs b/DocumentDomain/Infrastructure/Database/DocumentEntityConfiguration.cs index db06f15..70274c2 100644 --- a/DocumentDomain/Infrastructure/Database/DocumentEntityConfiguration.cs +++ b/DocumentDomain/Infrastructure/Database/DocumentEntityConfiguration.cs @@ -1,20 +1,25 @@ -using DocumentDomain.Entity; +namespace DocumentDomain.Infrastructure.Database; + +using Entity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace DocumentDomain.Infrastructure.Database; - public class DocumentEntityConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("document"); + builder.HasKey(k => k.Id); builder.Property(k => k.Id).ValueGeneratedOnAdd(); + builder.Property(k => k.Id).HasColumnName("id"); + builder.Property(k => k.Name).HasColumnName("name"); builder.HasIndex(k => k.Name).IsUnique(); + builder.Property(k => k.Description).HasColumnName("description"); + builder.Property(k => k.Uri).HasColumnName("uri"); } } \ No newline at end of file diff --git a/DocumentDomain/Infrastructure/Database/DocumentStructureNodeEntityConfiguration.cs b/DocumentDomain/Infrastructure/Database/DocumentStructureNodeEntityConfiguration.cs index 1a9f256..8d4187f 100644 --- a/DocumentDomain/Infrastructure/Database/DocumentStructureNodeEntityConfiguration.cs +++ b/DocumentDomain/Infrastructure/Database/DocumentStructureNodeEntityConfiguration.cs @@ -1,9 +1,9 @@ -using DocumentDomain.Entity; +namespace DocumentDomain.Infrastructure.Database; + +using Entity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace DocumentDomain.Infrastructure.Database; - public class DocumentStructureNodeEntityConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/DocumentDomain/Infrastructure/Database/RelationEntityConfiguration.cs b/DocumentDomain/Infrastructure/Database/RelationEntityConfiguration.cs index ecbb6c9..e955428 100644 --- a/DocumentDomain/Infrastructure/Database/RelationEntityConfiguration.cs +++ b/DocumentDomain/Infrastructure/Database/RelationEntityConfiguration.cs @@ -1,9 +1,9 @@ -using DocumentDomain.Entity; +namespace DocumentDomain.Infrastructure.Database; + +using Entity; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace DocumentDomain.Infrastructure.Database; - public class RelationEntityConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) diff --git a/DocumentDomain/Infrastructure/Mappers/ApplicationInputMapper.cs b/DocumentDomain/Infrastructure/Mappers/ApplicationInputMapper.cs index a4074d9..e75beab 100644 --- a/DocumentDomain/Infrastructure/Mappers/ApplicationInputMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/ApplicationInputMapper.cs @@ -1,8 +1,8 @@ -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + public class ApplicationInputMapper : IApplicationInputMapper { public Application ToApplication(ApplicationInput applicationInput) diff --git a/DocumentDomain/Infrastructure/Mappers/ApplicationMapper.cs b/DocumentDomain/Infrastructure/Mappers/ApplicationMapper.cs index 41a5cc7..c38c609 100644 --- a/DocumentDomain/Infrastructure/Mappers/ApplicationMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/ApplicationMapper.cs @@ -1,8 +1,8 @@ -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + public class ApplicationMapper : IApplicationMapper { public List ToApplicationResults(List applications) diff --git a/DocumentDomain/Infrastructure/Mappers/DocumentInputMapper.cs b/DocumentDomain/Infrastructure/Mappers/DocumentInputMapper.cs index 6a489c9..fbd8573 100644 --- a/DocumentDomain/Infrastructure/Mappers/DocumentInputMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/DocumentInputMapper.cs @@ -1,8 +1,8 @@ -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + public class DocumentInputMapper : IDocumentInputMapper { /// diff --git a/DocumentDomain/Infrastructure/Mappers/DocumentMapper.cs b/DocumentDomain/Infrastructure/Mappers/DocumentMapper.cs index bdb4da9..f050e5d 100644 --- a/DocumentDomain/Infrastructure/Mappers/DocumentMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/DocumentMapper.cs @@ -1,8 +1,8 @@ -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + /// public class DocumentMapper : IDocumentMapper { diff --git a/DocumentDomain/Infrastructure/Mappers/DocumentStructureNodeMapper.cs b/DocumentDomain/Infrastructure/Mappers/DocumentStructureNodeMapper.cs index 3d444b3..8c0d35a 100644 --- a/DocumentDomain/Infrastructure/Mappers/DocumentStructureNodeMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/DocumentStructureNodeMapper.cs @@ -1,12 +1,12 @@ #region -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - #endregion namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + /// public class DocumentStructureNodeMapper : IDocumentStructureNodeMapper { diff --git a/DocumentDomain/Infrastructure/Mappers/IApplicationInputMapper.cs b/DocumentDomain/Infrastructure/Mappers/IApplicationInputMapper.cs index bfcf961..755844c 100644 --- a/DocumentDomain/Infrastructure/Mappers/IApplicationInputMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/IApplicationInputMapper.cs @@ -1,8 +1,8 @@ -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + public interface IApplicationInputMapper { Application ToApplication(ApplicationInput applicationInput); diff --git a/DocumentDomain/Infrastructure/Mappers/IApplicationMapper.cs b/DocumentDomain/Infrastructure/Mappers/IApplicationMapper.cs index ce11285..e4c7ce8 100644 --- a/DocumentDomain/Infrastructure/Mappers/IApplicationMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/IApplicationMapper.cs @@ -1,8 +1,8 @@ -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + public interface IApplicationMapper { List ToApplicationResults(List applications); diff --git a/DocumentDomain/Infrastructure/Mappers/IDocumentInputMapper.cs b/DocumentDomain/Infrastructure/Mappers/IDocumentInputMapper.cs index 5f0a18e..1f45b55 100644 --- a/DocumentDomain/Infrastructure/Mappers/IDocumentInputMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/IDocumentInputMapper.cs @@ -1,8 +1,8 @@ -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + public interface IDocumentInputMapper { /// diff --git a/DocumentDomain/Infrastructure/Mappers/IDocumentMapper.cs b/DocumentDomain/Infrastructure/Mappers/IDocumentMapper.cs index 969282d..5fde82e 100644 --- a/DocumentDomain/Infrastructure/Mappers/IDocumentMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/IDocumentMapper.cs @@ -1,8 +1,8 @@ -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + /// /// The IDocumentMapper interface /// diff --git a/DocumentDomain/Infrastructure/Mappers/IDocumentStructureNodeMapper.cs b/DocumentDomain/Infrastructure/Mappers/IDocumentStructureNodeMapper.cs index d37f87e..0d0e442 100644 --- a/DocumentDomain/Infrastructure/Mappers/IDocumentStructureNodeMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/IDocumentStructureNodeMapper.cs @@ -1,12 +1,12 @@ #region -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - #endregion namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + /// /// IStructure mappers /// diff --git a/DocumentDomain/Infrastructure/Mappers/IRelationMapper.cs b/DocumentDomain/Infrastructure/Mappers/IRelationMapper.cs index b9fa245..669e91c 100644 --- a/DocumentDomain/Infrastructure/Mappers/IRelationMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/IRelationMapper.cs @@ -1,12 +1,12 @@ #region -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - #endregion namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + public interface IRelationMapper { Relation MapRelationInputToRelation(RelationInput payload); diff --git a/DocumentDomain/Infrastructure/Mappers/RelationMapper.cs b/DocumentDomain/Infrastructure/Mappers/RelationMapper.cs index 3e663fa..dd68080 100644 --- a/DocumentDomain/Infrastructure/Mappers/RelationMapper.cs +++ b/DocumentDomain/Infrastructure/Mappers/RelationMapper.cs @@ -1,12 +1,12 @@ #region -using DocumentDomain.Contracts; -using DocumentDomain.Entity; - #endregion namespace DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; + public class RelationMapper : IRelationMapper { public Relation MapRelationInputToRelation(RelationInput payload) diff --git a/DocumentDomain/Infrastructure/Validators/AddDocumentSagaInputValidator.cs b/DocumentDomain/Infrastructure/Validators/AddDocumentSagaInputValidator.cs new file mode 100644 index 0000000..9294634 --- /dev/null +++ b/DocumentDomain/Infrastructure/Validators/AddDocumentSagaInputValidator.cs @@ -0,0 +1,26 @@ +namespace DocumentDomain.Infrastructure.Validators; + +using Contracts; +using FluentValidation; + +public class AddDocumentSagaInputValidator : AbstractValidator +{ + public AddDocumentSagaInputValidator() + { + RuleFor(p => p.Id).Equal(0); + + RuleFor(p => p.Name).NotNull(); + When(p => p.Name is not null, () => + { + RuleFor(p => p.Name.Trim()).NotEmpty(); + RuleFor(p => p.Name.Trim().Length).GreaterThanOrEqualTo(3); + }); + + RuleFor(p => p.Description).NotNull(); + When(p => p.Description is not null, () => + { + RuleFor(p => p.Description.Trim()).NotEmpty(); + RuleFor(p => p.Description.Trim().Length).GreaterThanOrEqualTo(3); + }); + } +} \ No newline at end of file diff --git a/DocumentDomain/Infrastructure/Validators/ApplicationInputValidator.cs b/DocumentDomain/Infrastructure/Validators/ApplicationInputValidator.cs index 7e25cc5..3305932 100644 --- a/DocumentDomain/Infrastructure/Validators/ApplicationInputValidator.cs +++ b/DocumentDomain/Infrastructure/Validators/ApplicationInputValidator.cs @@ -1,21 +1,22 @@ -using DocumentDomain.Contracts; -using FluentValidation; - namespace DocumentDomain.Infrastructure.Validators; +using Common.Validators; +using Contracts; +using FluentValidation; + public class ApplicationInputValidator : AbstractValidator { public ApplicationInputValidator() { - RuleSet(Common.Validators.Operations.Add, () => + RuleSet(Operations.Add, () => { RuleFor(r => r.Id).Equal(0); RuleFor(r => r.Name.Trim().Length).GreaterThanOrEqualTo(3); }); - RuleSet(Common.Validators.Operations.Delete, () => { RuleFor(r => r.Id).GreaterThanOrEqualTo(1); }); + RuleSet(Operations.Delete, () => { RuleFor(r => r.Id).GreaterThanOrEqualTo(1); }); - RuleSet(Common.Validators.Operations.Update, () => + RuleSet(Operations.Update, () => { RuleFor(r => r.Id).GreaterThanOrEqualTo(1); RuleFor(r => r.Name.Trim().Length).GreaterThanOrEqualTo(3); diff --git a/DocumentDomain/Infrastructure/Validators/DocumentInputValidator.cs b/DocumentDomain/Infrastructure/Validators/DocumentInputValidator.cs index 7b1c4dc..5447c68 100644 --- a/DocumentDomain/Infrastructure/Validators/DocumentInputValidator.cs +++ b/DocumentDomain/Infrastructure/Validators/DocumentInputValidator.cs @@ -1,24 +1,14 @@ -using DocumentDomain.Contracts; -using FluentValidation; - namespace DocumentDomain.Infrastructure.Validators; +using Common.Validators; +using Contracts; +using FluentValidation; + public class DocumentInputValidator : AbstractValidator { public DocumentInputValidator() { - RuleSet(Common.Validators.Operations.Add, () => - { - RuleFor(p => p.Id).Equal(0); - RuleFor(p => p.Name).NotNull().NotEmpty(); - RuleFor(p => p.Description).NotEmpty(); - When(prop => !string.IsNullOrEmpty(prop.Name), - () => { RuleFor(p => p.Name.Trim().Length).GreaterThanOrEqualTo(3); }); - When(prop => !string.IsNullOrEmpty(prop.Description), - () => { RuleFor(p => p.Description.Trim()).NotEmpty(); }); - }); - - RuleSet(Common.Validators.Operations.Update, () => + RuleSet(Operations.Update, () => { RuleFor(p => p.Id).GreaterThanOrEqualTo(1); RuleFor(p => p.Name).NotNull().NotEmpty(); diff --git a/DocumentDomain/Infrastructure/Validators/DocumentStructureNodeInputValidator.cs b/DocumentDomain/Infrastructure/Validators/DocumentStructureNodeInputValidator.cs index 4a6a057..f3829cd 100644 --- a/DocumentDomain/Infrastructure/Validators/DocumentStructureNodeInputValidator.cs +++ b/DocumentDomain/Infrastructure/Validators/DocumentStructureNodeInputValidator.cs @@ -1,17 +1,18 @@ #region -using DocumentDomain.Contracts; -using FluentValidation; - #endregion namespace DocumentDomain.Infrastructure.Validators; +using Common.Validators; +using Contracts; +using FluentValidation; + public class DocumentStructureNodeInputValidator : AbstractValidator { public DocumentStructureNodeInputValidator() { - RuleSet(Common.Validators.Operations.Add, () => + RuleSet(Operations.Add, () => { RuleFor(p => p.Id) .Equal(0) diff --git a/DocumentDomain/Infrastructure/Validators/RelationInputValidator.cs b/DocumentDomain/Infrastructure/Validators/RelationInputValidator.cs index 1d4c846..dbcf06c 100644 --- a/DocumentDomain/Infrastructure/Validators/RelationInputValidator.cs +++ b/DocumentDomain/Infrastructure/Validators/RelationInputValidator.cs @@ -1,12 +1,13 @@ #region -using DocumentDomain.Contracts; -using FluentValidation; - #endregion namespace DocumentDomain.Infrastructure.Validators; +using Common.Validators; +using Contracts; +using FluentValidation; + public class RelationInputValidator : AbstractValidator { public RelationInputValidator() @@ -19,7 +20,7 @@ public RelationInputValidator() When(p => p is not null, () => { - RuleSet(Common.Validators.Operations.Add, () => + RuleSet(Operations.Add, () => { RuleFor(p => p.Id).Equal(0) .WithMessage($"{nameof(RelationInput)}.{nameof(RelationInput.Id)} must be zero"); diff --git a/DocumentDomain/Operations/Commands/AddApplicationCommand.cs b/DocumentDomain/Operations/Commands/AddApplicationCommand.cs index 72d9c0d..ec8bf9d 100644 --- a/DocumentDomain/Operations/Commands/AddApplicationCommand.cs +++ b/DocumentDomain/Operations/Commands/AddApplicationCommand.cs @@ -1,16 +1,16 @@ #region -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Commands; +using Contracts; +using Entity; +using Infrastructure.Database; +using Infrastructure.Mappers; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + public class AddApplicationCommand( IApplicationMapper applicationMapper, IApplicationInputMapper applicationInputMapper, diff --git a/DocumentDomain/Operations/Commands/AddDocumentCommand.cs b/DocumentDomain/Operations/Commands/AddDocumentCommand.cs index 4c886bc..fbb4ef9 100644 --- a/DocumentDomain/Operations/Commands/AddDocumentCommand.cs +++ b/DocumentDomain/Operations/Commands/AddDocumentCommand.cs @@ -1,19 +1,15 @@ -#region +namespace DocumentDomain.Operations.Commands; using Common.Commands; using Common.Commands.Exceptions; -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; using FluentValidation; +using Infrastructure.Database; +using Infrastructure.Mappers; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -#endregion - -namespace DocumentDomain.Operations.Commands; - public class AddDocumentCommand( IDocumentMapper documentMapper, IDocumentInputMapper documentInputMapper, @@ -78,10 +74,6 @@ private async Task ValidationDocumentInputForAdding(DocumentInput input) { ArgumentNullException.ThrowIfNull(input); - await documentInputValidator.ValidateAsync(input, options => - { - options.IncludeRuleSets(Common.Validators.Operations.Add); - options.ThrowOnFailures(); - }); + await documentInputValidator.ValidateAsync(input, options => { options.ThrowOnFailures(); }); } } \ No newline at end of file diff --git a/DocumentDomain/Operations/Commands/AddNewRelationCommand.cs b/DocumentDomain/Operations/Commands/AddNewRelationCommand.cs index 1225835..2745e80 100644 --- a/DocumentDomain/Operations/Commands/AddNewRelationCommand.cs +++ b/DocumentDomain/Operations/Commands/AddNewRelationCommand.cs @@ -1,18 +1,19 @@ #region +#endregion + +namespace DocumentDomain.Operations.Commands; + using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; +using Common.Validators; +using Contracts; +using Entity; using FluentValidation; +using Infrastructure.Database; +using Infrastructure.Mappers; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -#endregion - -namespace DocumentDomain.Operations.Commands; - public class AddNewRelationCommand( IValidator validator, IRelationMapper mapper, @@ -52,7 +53,7 @@ private async Task ValidateInput(RelationInput payload, CancellationToken cancel { await validator.ValidateAsync(payload, o => { - o.IncludeRuleSets(Common.Validators.Operations.Add); + o.IncludeRuleSets(Operations.Add); o.ThrowOnFailures(); }, cancellationToken).ConfigureAwait(false); } diff --git a/DocumentDomain/Operations/Commands/AddNewStructureNodeCommand.cs b/DocumentDomain/Operations/Commands/AddNewStructureNodeCommand.cs index e287a2c..8d1ea9e 100644 --- a/DocumentDomain/Operations/Commands/AddNewStructureNodeCommand.cs +++ b/DocumentDomain/Operations/Commands/AddNewStructureNodeCommand.cs @@ -1,18 +1,19 @@ #region +#endregion + +namespace DocumentDomain.Operations.Commands; + using Common.Commands; using Common.Commands.Exceptions; -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; +using Common.Validators; +using Contracts; +using Entity; using FluentValidation; +using Infrastructure.Database; +using Infrastructure.Mappers; using Microsoft.EntityFrameworkCore; -#endregion - -namespace DocumentDomain.Operations.Commands; - public class AddNewStructureNodeCommand( IDocumentStructureNodeMapper documentStructureNodeMapper, DbContextOptions dbContextOptions, @@ -69,7 +70,7 @@ private void ValidateProvidedInput(DocumentStructureNodeInput structureNodeInput validator.ValidateAsync(structureNodeInput, o => { - o.IncludeRuleSets(Common.Validators.Operations.Add); + o.IncludeRuleSets(Operations.Add); o.ThrowOnFailures(); }); } diff --git a/DocumentDomain/Operations/Commands/AddStructureNodeTreeCommand.cs b/DocumentDomain/Operations/Commands/AddStructureNodeTreeCommand.cs index df0e240..24594f6 100644 --- a/DocumentDomain/Operations/Commands/AddStructureNodeTreeCommand.cs +++ b/DocumentDomain/Operations/Commands/AddStructureNodeTreeCommand.cs @@ -1,19 +1,20 @@ #region +#endregion + +namespace DocumentDomain.Operations.Commands; + using Common.Commands; using Common.Commands.Exceptions; -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; +using Common.Validators; +using Contracts; +using Entity; using FluentValidation; +using Infrastructure.Database; +using Infrastructure.Mappers; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -#endregion - -namespace DocumentDomain.Operations.Commands; - public class AddStructureNodeTreeCommand( IDocumentStructureNodeMapper mapper, DbContextOptions dbContextOptions, @@ -96,7 +97,7 @@ private async Task ValidateProvidedInput( // todo: make the validator in a way it validates every item in the tree await validator.ValidateAsync(structureNodeInput, o => { - o.IncludeRuleSets(Common.Validators.Operations.Add); + o.IncludeRuleSets(Operations.Add); o.ThrowOnFailures(); }, cancellationToken); } diff --git a/DocumentDomain/Operations/Commands/DeleteDocumentCommand.cs b/DocumentDomain/Operations/Commands/DeleteDocumentCommand.cs index f8c0e64..00aebef 100644 --- a/DocumentDomain/Operations/Commands/DeleteDocumentCommand.cs +++ b/DocumentDomain/Operations/Commands/DeleteDocumentCommand.cs @@ -1,15 +1,15 @@ #region -using Common.Commands; -using Common.Commands.Exceptions; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands; +using Common.Commands.Exceptions; +using Entity; +using Infrastructure.Database; +using Microsoft.EntityFrameworkCore; + public class DeleteDocumentCommand( DbContextOptions dbContextOptions) : IDeleteDocumentCommand { diff --git a/DocumentDomain/Operations/Commands/DeleteRelationCommand.cs b/DocumentDomain/Operations/Commands/DeleteRelationCommand.cs index 0a04173..8b7d46d 100644 --- a/DocumentDomain/Operations/Commands/DeleteRelationCommand.cs +++ b/DocumentDomain/Operations/Commands/DeleteRelationCommand.cs @@ -1,15 +1,15 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Entity; +using Infrastructure.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + public class DeleteRelationCommand( DbContextOptions dbContextOptions, ILogger logger) : IDeleteRelationCommand diff --git a/DocumentDomain/Operations/Commands/DeleteRelationCommandException.cs b/DocumentDomain/Operations/Commands/DeleteRelationCommandException.cs index f7c97f6..157f64c 100644 --- a/DocumentDomain/Operations/Commands/DeleteRelationCommandException.cs +++ b/DocumentDomain/Operations/Commands/DeleteRelationCommandException.cs @@ -1,7 +1,7 @@ -using System.Runtime.Serialization; - namespace DocumentDomain.Operations.Commands; +using System.Runtime.Serialization; + public class DeleteRelationCommandException : Exception { public DeleteRelationCommandException() diff --git a/DocumentDomain/Operations/Commands/DeleteStructureNodesCommand.cs b/DocumentDomain/Operations/Commands/DeleteStructureNodesCommand.cs index 3aece71..db88448 100644 --- a/DocumentDomain/Operations/Commands/DeleteStructureNodesCommand.cs +++ b/DocumentDomain/Operations/Commands/DeleteStructureNodesCommand.cs @@ -1,15 +1,15 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Entity; +using Infrastructure.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + public class DeleteStructureNodesCommand( DbContextOptions dbContextOptions, ILogger logger) : IDeleteStructureNodesCommand diff --git a/DocumentDomain/Operations/Commands/EditRelationCommand.cs b/DocumentDomain/Operations/Commands/EditRelationCommand.cs index 870a98f..3862266 100644 --- a/DocumentDomain/Operations/Commands/EditRelationCommand.cs +++ b/DocumentDomain/Operations/Commands/EditRelationCommand.cs @@ -1,17 +1,18 @@ #region -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; -using FluentValidation; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Validators; +using Contracts; +using Entity; +using FluentValidation; +using Infrastructure.Database; +using Infrastructure.Mappers; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + public class EditRelationCommand( IRelationMapper relationMapper, DbContextOptions dbContextOptions, @@ -61,7 +62,7 @@ private async Task ValidateInput(RelationInput relationInput, CancellationToken { await validator.ValidateAsync(relationInput, o => { - o.IncludeRuleSets(Common.Validators.Operations.Update); + o.IncludeRuleSets(Operations.Update); o.ThrowOnFailures(); }, cancellationToken).ConfigureAwait(false); } diff --git a/DocumentDomain/Operations/Commands/EditRelationCommandException.cs b/DocumentDomain/Operations/Commands/EditRelationCommandException.cs index c85d5a6..7036ed2 100644 --- a/DocumentDomain/Operations/Commands/EditRelationCommandException.cs +++ b/DocumentDomain/Operations/Commands/EditRelationCommandException.cs @@ -1,7 +1,7 @@ -using System.Runtime.Serialization; - namespace DocumentDomain.Operations.Commands; +using System.Runtime.Serialization; + public class EditRelationCommandException : Exception { public EditRelationCommandException() diff --git a/DocumentDomain/Operations/Commands/GetAllApplicationsCommand.cs b/DocumentDomain/Operations/Commands/GetAllApplicationsCommand.cs index 1f259a1..259e4f3 100644 --- a/DocumentDomain/Operations/Commands/GetAllApplicationsCommand.cs +++ b/DocumentDomain/Operations/Commands/GetAllApplicationsCommand.cs @@ -1,15 +1,15 @@ #region -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; -using Microsoft.EntityFrameworkCore; - #endregion namespace DocumentDomain.Operations.Commands; +using Contracts; +using Entity; +using Infrastructure.Database; +using Infrastructure.Mappers; +using Microsoft.EntityFrameworkCore; + public class GetAllApplicationsCommand( IApplicationMapper applicationMapper, DbContextOptions dbContextOptions) : IGetAllApplicationsCommand diff --git a/DocumentDomain/Operations/Commands/GetAllDocumentsCommand.cs b/DocumentDomain/Operations/Commands/GetAllDocumentsCommand.cs index a059404..1c635d4 100644 --- a/DocumentDomain/Operations/Commands/GetAllDocumentsCommand.cs +++ b/DocumentDomain/Operations/Commands/GetAllDocumentsCommand.cs @@ -1,17 +1,17 @@ #region -using Common.Commands; -using Common.Commands.Exceptions; -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; -using Microsoft.EntityFrameworkCore; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands; +using Common.Commands.Exceptions; +using Contracts; +using Entity; +using Infrastructure.Database; +using Infrastructure.Mappers; +using Microsoft.EntityFrameworkCore; + public class GetAllDocumentsCommand( IDocumentMapper documentMapper, DbContextOptions dbContextOptions) : IGetAllDocumentsCommand diff --git a/DocumentDomain/Operations/Commands/GetDocumentByIdCommand.cs b/DocumentDomain/Operations/Commands/GetDocumentByIdCommand.cs index baccb99..4a4127d 100644 --- a/DocumentDomain/Operations/Commands/GetDocumentByIdCommand.cs +++ b/DocumentDomain/Operations/Commands/GetDocumentByIdCommand.cs @@ -1,18 +1,18 @@ #region +#endregion + +namespace DocumentDomain.Operations.Commands; + using Common.Commands; using Common.Commands.Exceptions; -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; +using Infrastructure.Database; +using Infrastructure.Mappers; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -#endregion - -namespace DocumentDomain.Operations.Commands; - public class GetDocumentByIdCommand( IDocumentMapper documentMapper, DbContextOptions dbContextOptions, diff --git a/DocumentDomain/Operations/Commands/GetRelationByIdCommand.cs b/DocumentDomain/Operations/Commands/GetRelationByIdCommand.cs index e62efaa..f9645ca 100644 --- a/DocumentDomain/Operations/Commands/GetRelationByIdCommand.cs +++ b/DocumentDomain/Operations/Commands/GetRelationByIdCommand.cs @@ -1,18 +1,18 @@ #region +#endregion + +namespace DocumentDomain.Operations.Commands; + using Common.Commands.Exceptions; using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; +using Infrastructure.Database; +using Infrastructure.Mappers; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -#endregion - -namespace DocumentDomain.Operations.Commands; - public class GetRelationByIdCommand( IRelationMapper mapper, DbContextOptions dbContextOptions, diff --git a/DocumentDomain/Operations/Commands/GetRelationsCommand.cs b/DocumentDomain/Operations/Commands/GetRelationsCommand.cs index 868d115..d4994cc 100644 --- a/DocumentDomain/Operations/Commands/GetRelationsCommand.cs +++ b/DocumentDomain/Operations/Commands/GetRelationsCommand.cs @@ -1,16 +1,16 @@ #region -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Commands; +using Contracts; +using Entity; +using Infrastructure.Database; +using Infrastructure.Mappers; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; + public class GetRelationsCommand( IRelationMapper mapper, DbContextOptions dbContextOptions, diff --git a/DocumentDomain/Operations/Commands/GetRelationsCommandException.cs b/DocumentDomain/Operations/Commands/GetRelationsCommandException.cs index 496f483..ff6aaad 100644 --- a/DocumentDomain/Operations/Commands/GetRelationsCommandException.cs +++ b/DocumentDomain/Operations/Commands/GetRelationsCommandException.cs @@ -1,7 +1,7 @@ -using System.Runtime.Serialization; - namespace DocumentDomain.Operations.Commands; +using System.Runtime.Serialization; + public class GetRelationsCommandException : Exception { public GetRelationsCommandException() diff --git a/DocumentDomain/Operations/Commands/GetStructureNodeTreeCommand.cs b/DocumentDomain/Operations/Commands/GetStructureNodeTreeCommand.cs index 7eb9717..1878150 100644 --- a/DocumentDomain/Operations/Commands/GetStructureNodeTreeCommand.cs +++ b/DocumentDomain/Operations/Commands/GetStructureNodeTreeCommand.cs @@ -1,18 +1,18 @@ #region +#endregion + +namespace DocumentDomain.Operations.Commands; + using Common.Commands; using Common.Commands.Exceptions; -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; +using Contracts; +using Entity; +using Infrastructure.Database; +using Infrastructure.Mappers; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -#endregion - -namespace DocumentDomain.Operations.Commands; - public class GetStructureNodeTreeCommand( IDocumentStructureNodeMapper mapper, DbContextOptions dbContextOptions, diff --git a/DocumentDomain/Operations/Commands/IAddApplicationCommand.cs b/DocumentDomain/Operations/Commands/IAddApplicationCommand.cs index 272009d..e6a1e71 100644 --- a/DocumentDomain/Operations/Commands/IAddApplicationCommand.cs +++ b/DocumentDomain/Operations/Commands/IAddApplicationCommand.cs @@ -1,7 +1,7 @@ -using DocumentDomain.Contracts; - namespace DocumentDomain.Operations.Commands; +using Contracts; + public interface IAddApplicationCommand { Task AddAsync(ApplicationInput application, CancellationToken cancellationToken = default); diff --git a/DocumentDomain/Operations/Commands/IAddDocumentCommand.cs b/DocumentDomain/Operations/Commands/IAddDocumentCommand.cs index 3829b43..a72170e 100644 --- a/DocumentDomain/Operations/Commands/IAddDocumentCommand.cs +++ b/DocumentDomain/Operations/Commands/IAddDocumentCommand.cs @@ -1,12 +1,12 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Contracts; + public interface IAddDocumentCommand { /// diff --git a/DocumentDomain/Operations/Commands/IAddNewRelationCommand.cs b/DocumentDomain/Operations/Commands/IAddNewRelationCommand.cs index 7cb9ddc..91cf192 100644 --- a/DocumentDomain/Operations/Commands/IAddNewRelationCommand.cs +++ b/DocumentDomain/Operations/Commands/IAddNewRelationCommand.cs @@ -1,11 +1,11 @@ #region -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Contracts; + public interface IAddNewRelationCommand { Task AddNewRelationAsync(RelationInput payload, CancellationToken cancellationToken); diff --git a/DocumentDomain/Operations/Commands/IAddNewStructureNodeCommand.cs b/DocumentDomain/Operations/Commands/IAddNewStructureNodeCommand.cs index 80dc10b..17f5cc2 100644 --- a/DocumentDomain/Operations/Commands/IAddNewStructureNodeCommand.cs +++ b/DocumentDomain/Operations/Commands/IAddNewStructureNodeCommand.cs @@ -1,12 +1,12 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Contracts; + /// /// Add a New Structure Node to the system. /// diff --git a/DocumentDomain/Operations/Commands/IAddStructureNodeTreeCommand.cs b/DocumentDomain/Operations/Commands/IAddStructureNodeTreeCommand.cs index 8d344cc..fd9c503 100644 --- a/DocumentDomain/Operations/Commands/IAddStructureNodeTreeCommand.cs +++ b/DocumentDomain/Operations/Commands/IAddStructureNodeTreeCommand.cs @@ -1,12 +1,12 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Contracts; + /// /// Add Structure Node Tree Scenario. /// diff --git a/DocumentDomain/Operations/Commands/IDeleteDocumentCommand.cs b/DocumentDomain/Operations/Commands/IDeleteDocumentCommand.cs index 3b4006a..300791d 100644 --- a/DocumentDomain/Operations/Commands/IDeleteDocumentCommand.cs +++ b/DocumentDomain/Operations/Commands/IDeleteDocumentCommand.cs @@ -1,12 +1,12 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Entity; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Entity; + public interface IDeleteDocumentCommand { /// diff --git a/DocumentDomain/Operations/Commands/IEditRelationCommand.cs b/DocumentDomain/Operations/Commands/IEditRelationCommand.cs index 8a68968..51667f2 100644 --- a/DocumentDomain/Operations/Commands/IEditRelationCommand.cs +++ b/DocumentDomain/Operations/Commands/IEditRelationCommand.cs @@ -1,11 +1,11 @@ #region -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Contracts; + public interface IEditRelationCommand { Task EditAsync(RelationInput relationInput, CancellationToken cancellationToken = default); diff --git a/DocumentDomain/Operations/Commands/IGetAllApplicationsCommand.cs b/DocumentDomain/Operations/Commands/IGetAllApplicationsCommand.cs index 662edc8..0e3ee86 100644 --- a/DocumentDomain/Operations/Commands/IGetAllApplicationsCommand.cs +++ b/DocumentDomain/Operations/Commands/IGetAllApplicationsCommand.cs @@ -1,7 +1,7 @@ -using DocumentDomain.Contracts; - namespace DocumentDomain.Operations.Commands; +using Contracts; + public interface IGetAllApplicationsCommand { Task> GetAllAsync(CancellationToken cancellationToken = default); diff --git a/DocumentDomain/Operations/Commands/IGetAllDocumentsCommand.cs b/DocumentDomain/Operations/Commands/IGetAllDocumentsCommand.cs index bb7bac0..48332c6 100644 --- a/DocumentDomain/Operations/Commands/IGetAllDocumentsCommand.cs +++ b/DocumentDomain/Operations/Commands/IGetAllDocumentsCommand.cs @@ -1,12 +1,12 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Contracts; + public interface IGetAllDocumentsCommand { /// diff --git a/DocumentDomain/Operations/Commands/IGetDocumentByIdCommand.cs b/DocumentDomain/Operations/Commands/IGetDocumentByIdCommand.cs index 15248a9..ff4a9a1 100644 --- a/DocumentDomain/Operations/Commands/IGetDocumentByIdCommand.cs +++ b/DocumentDomain/Operations/Commands/IGetDocumentByIdCommand.cs @@ -1,12 +1,12 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Contracts; + public interface IGetDocumentByIdCommand { /// diff --git a/DocumentDomain/Operations/Commands/IGetRelationByIdCommand.cs b/DocumentDomain/Operations/Commands/IGetRelationByIdCommand.cs index 6b1cb09..7d16a65 100644 --- a/DocumentDomain/Operations/Commands/IGetRelationByIdCommand.cs +++ b/DocumentDomain/Operations/Commands/IGetRelationByIdCommand.cs @@ -1,11 +1,11 @@ #region -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Contracts; + public interface IGetRelationByIdCommand { Task GetByIdAsync(long relationId, CancellationToken cancellationToken); diff --git a/DocumentDomain/Operations/Commands/IGetRelationsCommand.cs b/DocumentDomain/Operations/Commands/IGetRelationsCommand.cs index 5fba496..007cb28 100644 --- a/DocumentDomain/Operations/Commands/IGetRelationsCommand.cs +++ b/DocumentDomain/Operations/Commands/IGetRelationsCommand.cs @@ -1,11 +1,11 @@ #region -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Contracts; + public interface IGetRelationsCommand { Task> GetAllAsync(CancellationToken cancellationToken = default); diff --git a/DocumentDomain/Operations/Commands/IGetStructureNodeTreeCommand.cs b/DocumentDomain/Operations/Commands/IGetStructureNodeTreeCommand.cs index 137239d..2a70939 100644 --- a/DocumentDomain/Operations/Commands/IGetStructureNodeTreeCommand.cs +++ b/DocumentDomain/Operations/Commands/IGetStructureNodeTreeCommand.cs @@ -1,12 +1,12 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Contracts; + /// /// Get root by scenario. /// diff --git a/DocumentDomain/Operations/Commands/IUpdateDocumentCommand.cs b/DocumentDomain/Operations/Commands/IUpdateDocumentCommand.cs index 1650ec3..8067fe6 100644 --- a/DocumentDomain/Operations/Commands/IUpdateDocumentCommand.cs +++ b/DocumentDomain/Operations/Commands/IUpdateDocumentCommand.cs @@ -1,12 +1,12 @@ #region -using Common.Commands.Exceptions; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Commands; +using Common.Commands.Exceptions; +using Contracts; + public interface IUpdateDocumentCommand { /// diff --git a/DocumentDomain/Operations/Commands/UpdateDocumentCommand.cs b/DocumentDomain/Operations/Commands/UpdateDocumentCommand.cs index a3c66d6..a7832ad 100644 --- a/DocumentDomain/Operations/Commands/UpdateDocumentCommand.cs +++ b/DocumentDomain/Operations/Commands/UpdateDocumentCommand.cs @@ -1,18 +1,19 @@ #region +#endregion + +namespace DocumentDomain.Operations.Commands; + using Common.Commands; using Common.Commands.Exceptions; -using DocumentDomain.Contracts; -using DocumentDomain.Entity; -using DocumentDomain.Infrastructure.Database; -using DocumentDomain.Infrastructure.Mappers; +using Common.Validators; +using Contracts; +using Entity; using FluentValidation; +using Infrastructure.Database; +using Infrastructure.Mappers; using Microsoft.EntityFrameworkCore; -#endregion - -namespace DocumentDomain.Operations.Commands; - public class UpdateDocumentCommand( IDocumentMapper documentMapper, IDocumentInputMapper documentInputMapper, @@ -97,7 +98,7 @@ private async Task ValidateUpdateAsyncInput(DocumentInput modifiedInput) await documentInputValidator.ValidateAsync(modifiedInput, o => { - o.IncludeRuleSets(Common.Validators.Operations.Delete); + o.IncludeRuleSets(Operations.Delete); o.ThrowOnFailures(); }); } diff --git a/DocumentDomain/Operations/Sagas/AddDocumentSaga.cs b/DocumentDomain/Operations/Sagas/AddDocumentSaga.cs index 79f44e9..b39efe7 100644 --- a/DocumentDomain/Operations/Sagas/AddDocumentSaga.cs +++ b/DocumentDomain/Operations/Sagas/AddDocumentSaga.cs @@ -1,14 +1,14 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Operations.Commands; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Sagas; +using Commands; +using Common.Sagas; +using Contracts; +using Microsoft.Extensions.Logging; + /// public class AddDocumentSaga( IAddDocumentCommand addDocumentCommand, @@ -32,12 +32,6 @@ public async Task ExecuteAsync(AddDocumentSagaContext context, long documentId = await addDocumentCommand.AddAsync(context.Payload, cancellationToken) .ConfigureAwait(false); - // CheckIfPayloadHasRootNodeAndAdd(context.Payload); - - // await addStructureNodeTreeCommand - // .AddTreeAsync(documentId, context.Payload.RootStructureNode, cancellationToken) - // .ConfigureAwait(false); - DocumentResult result = await getDocumentByIdCommand.GetByIdAsync(documentId, cancellationToken) .ConfigureAwait(false); return result; diff --git a/DocumentDomain/Operations/Sagas/AddDocumentSagaContext.cs b/DocumentDomain/Operations/Sagas/AddDocumentSagaContext.cs index 1f2c05c..8e7013d 100644 --- a/DocumentDomain/Operations/Sagas/AddDocumentSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/AddDocumentSagaContext.cs @@ -1,12 +1,12 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; +using Contracts; + public class AddDocumentSagaContext : ISagaContextWithPayload { public DocumentInput Payload { get; set; } = new DocumentInput(); diff --git a/DocumentDomain/Operations/Sagas/DeleteDocumentSaga.cs b/DocumentDomain/Operations/Sagas/DeleteDocumentSaga.cs index f0775f6..b55f301 100644 --- a/DocumentDomain/Operations/Sagas/DeleteDocumentSaga.cs +++ b/DocumentDomain/Operations/Sagas/DeleteDocumentSaga.cs @@ -1,9 +1,9 @@ +namespace DocumentDomain.Operations.Sagas; + +using Commands; using Common.Sagas; -using DocumentDomain.Operations.Commands; using Microsoft.Extensions.Logging; -namespace DocumentDomain.Operations.Sagas; - public class DeleteDocumentSaga( IDeleteDocumentCommand deleteDocumentCommand, IDeleteStructureNodesCommand deleteStructureNodesCommand, diff --git a/DocumentDomain/Operations/Sagas/DeleteDocumentSagaContext.cs b/DocumentDomain/Operations/Sagas/DeleteDocumentSagaContext.cs index cb2ba5b..8d5c925 100644 --- a/DocumentDomain/Operations/Sagas/DeleteDocumentSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/DeleteDocumentSagaContext.cs @@ -1,7 +1,7 @@ -using Common.Sagas; - namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; + public class DeleteDocumentSagaContext : ISagaContextWithPayload { public Int64 Payload { get; set; } diff --git a/DocumentDomain/Operations/Sagas/DeleteRelationSaga.cs b/DocumentDomain/Operations/Sagas/DeleteRelationSaga.cs index ca5c852..d2c9979 100644 --- a/DocumentDomain/Operations/Sagas/DeleteRelationSaga.cs +++ b/DocumentDomain/Operations/Sagas/DeleteRelationSaga.cs @@ -1,14 +1,14 @@ #region -using Common.Commands.Exceptions; -using Common.Sagas; -using DocumentDomain.Operations.Commands; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Sagas; +using Commands; +using Common.Commands.Exceptions; +using Common.Sagas; +using Microsoft.Extensions.Logging; + public class DeleteRelationSaga( IDeleteRelationCommand deleteRelationCommand, ILogger logger) : IHaveInputSaga diff --git a/DocumentDomain/Operations/Sagas/DeleteRelationSagaContext.cs b/DocumentDomain/Operations/Sagas/DeleteRelationSagaContext.cs index 3bccbed..5fe09e5 100644 --- a/DocumentDomain/Operations/Sagas/DeleteRelationSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/DeleteRelationSagaContext.cs @@ -1,7 +1,7 @@ -using Common.Sagas; - namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; + public class DeleteRelationSagaContext : ISagaContextWithPayload { public long Payload { get; set; } diff --git a/DocumentDomain/Operations/Sagas/EditRelationSaga.cs b/DocumentDomain/Operations/Sagas/EditRelationSaga.cs index 2437b2f..c4cd45f 100644 --- a/DocumentDomain/Operations/Sagas/EditRelationSaga.cs +++ b/DocumentDomain/Operations/Sagas/EditRelationSaga.cs @@ -1,14 +1,14 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Operations.Commands; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Sagas; +using Commands; +using Common.Sagas; +using Contracts; +using Microsoft.Extensions.Logging; + public class EditRelationSaga( IEditRelationCommand editRelationCommand, IGetRelationByIdCommand getRelationByIdCommand, diff --git a/DocumentDomain/Operations/Sagas/EditRelationSagaContext.cs b/DocumentDomain/Operations/Sagas/EditRelationSagaContext.cs index eeee853..51d969c 100644 --- a/DocumentDomain/Operations/Sagas/EditRelationSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/EditRelationSagaContext.cs @@ -1,12 +1,12 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; +using Contracts; + public class EditRelationSagaContext : ISagaContextWithPayload { public RelationInput Payload { get; set; } diff --git a/DocumentDomain/Operations/Sagas/GetAllApplicationsSaga.cs b/DocumentDomain/Operations/Sagas/GetAllApplicationsSaga.cs index ad2da3b..49556d5 100644 --- a/DocumentDomain/Operations/Sagas/GetAllApplicationsSaga.cs +++ b/DocumentDomain/Operations/Sagas/GetAllApplicationsSaga.cs @@ -1,10 +1,10 @@ +namespace DocumentDomain.Operations.Sagas; + +using Commands; using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Operations.Commands; +using Contracts; using Microsoft.Extensions.Logging; -namespace DocumentDomain.Operations.Sagas; - public class GetAllApplicationsSaga( IGetAllApplicationsCommand getAllApplicationsCommand, ILogger logger) diff --git a/DocumentDomain/Operations/Sagas/GetAllApplicationsSagaContext.cs b/DocumentDomain/Operations/Sagas/GetAllApplicationsSagaContext.cs index cfabdb7..83db609 100644 --- a/DocumentDomain/Operations/Sagas/GetAllApplicationsSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/GetAllApplicationsSagaContext.cs @@ -1,7 +1,7 @@ -using Common.Sagas; - namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; + public class GetAllApplicationsSagaContext : ISagaContext { } \ No newline at end of file diff --git a/DocumentDomain/Operations/Sagas/GetDocumentByIdContext.cs b/DocumentDomain/Operations/Sagas/GetDocumentByIdContext.cs index 1c72d73..e475776 100644 --- a/DocumentDomain/Operations/Sagas/GetDocumentByIdContext.cs +++ b/DocumentDomain/Operations/Sagas/GetDocumentByIdContext.cs @@ -1,7 +1,7 @@ -using Common.Sagas; - namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; + public class GetDocumentByIdContext : ISagaContextWithPayload { public long Payload { get; set; } diff --git a/DocumentDomain/Operations/Sagas/GetDocumentByIdSaga.cs b/DocumentDomain/Operations/Sagas/GetDocumentByIdSaga.cs index 27f8eb5..e0a2deb 100644 --- a/DocumentDomain/Operations/Sagas/GetDocumentByIdSaga.cs +++ b/DocumentDomain/Operations/Sagas/GetDocumentByIdSaga.cs @@ -1,14 +1,14 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Operations.Commands; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Sagas; +using Commands; +using Common.Sagas; +using Contracts; +using Microsoft.Extensions.Logging; + public class GetDocumentByIdSaga( IGetDocumentByIdCommand getDocumentByIdCommand, ILogger logger) : IHaveInputAndResultSaga diff --git a/DocumentDomain/Operations/Sagas/GetDocumentsSaga.cs b/DocumentDomain/Operations/Sagas/GetDocumentsSaga.cs index d8f71c2..45ceb76 100644 --- a/DocumentDomain/Operations/Sagas/GetDocumentsSaga.cs +++ b/DocumentDomain/Operations/Sagas/GetDocumentsSaga.cs @@ -1,14 +1,14 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Operations.Commands; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Sagas; +using Commands; +using Common.Sagas; +using Contracts; +using Microsoft.Extensions.Logging; + /// /// Get Document Saga. /// diff --git a/DocumentDomain/Operations/Sagas/GetDocumentsSagaContext.cs b/DocumentDomain/Operations/Sagas/GetDocumentsSagaContext.cs index 5623fca..a945b06 100644 --- a/DocumentDomain/Operations/Sagas/GetDocumentsSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/GetDocumentsSagaContext.cs @@ -1,7 +1,7 @@ -using Common.Sagas; - namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; + public class GetDocumentsSagaContext : ISagaContext { } \ No newline at end of file diff --git a/DocumentDomain/Operations/Sagas/GetRelationByIdSaga.cs b/DocumentDomain/Operations/Sagas/GetRelationByIdSaga.cs index 1840ca1..f2f491f 100644 --- a/DocumentDomain/Operations/Sagas/GetRelationByIdSaga.cs +++ b/DocumentDomain/Operations/Sagas/GetRelationByIdSaga.cs @@ -1,15 +1,15 @@ #region -using Common.Commands.Exceptions; -using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Operations.Commands; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Sagas; +using Commands; +using Common.Commands.Exceptions; +using Common.Sagas; +using Contracts; +using Microsoft.Extensions.Logging; + public class GetRelationByIdSaga( IGetRelationByIdCommand getRelationByIdCommand, ILogger logger) : IHaveInputAndResultSaga diff --git a/DocumentDomain/Operations/Sagas/GetRelationByIdSagaContext.cs b/DocumentDomain/Operations/Sagas/GetRelationByIdSagaContext.cs index 22d2f38..e591af2 100644 --- a/DocumentDomain/Operations/Sagas/GetRelationByIdSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/GetRelationByIdSagaContext.cs @@ -1,7 +1,7 @@ -using Common.Sagas; - namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; + public class GetRelationByIdSagaContext : ISagaContextWithPayload { public long Payload { get; set; } diff --git a/DocumentDomain/Operations/Sagas/GetRelationSagaContext.cs b/DocumentDomain/Operations/Sagas/GetRelationSagaContext.cs index 8d96657..bcef4cc 100644 --- a/DocumentDomain/Operations/Sagas/GetRelationSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/GetRelationSagaContext.cs @@ -1,7 +1,7 @@ -using Common.Sagas; - namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; + public class GetRelationSagaContext : ISagaContext { } \ No newline at end of file diff --git a/DocumentDomain/Operations/Sagas/GetRelationsSaga.cs b/DocumentDomain/Operations/Sagas/GetRelationsSaga.cs index 545f97e..081c5d0 100644 --- a/DocumentDomain/Operations/Sagas/GetRelationsSaga.cs +++ b/DocumentDomain/Operations/Sagas/GetRelationsSaga.cs @@ -1,13 +1,13 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Operations.Commands; - #endregion namespace DocumentDomain.Operations.Sagas; +using Commands; +using Common.Sagas; +using Contracts; + public class GetRelationsSaga( IGetRelationsCommand getRelationsCommand) : IHaveInputAndResultSaga, GetRelationSagaContext> { diff --git a/DocumentDomain/Operations/Sagas/NewRelationSaga.cs b/DocumentDomain/Operations/Sagas/NewRelationSaga.cs index 38af971..f552035 100644 --- a/DocumentDomain/Operations/Sagas/NewRelationSaga.cs +++ b/DocumentDomain/Operations/Sagas/NewRelationSaga.cs @@ -1,14 +1,14 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Operations.Commands; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Sagas; +using Commands; +using Common.Sagas; +using Contracts; +using Microsoft.Extensions.Logging; + public class NewRelationSaga( IAddNewRelationCommand addNewRelationCommand, IGetRelationByIdCommand getRelationByIdCommand, diff --git a/DocumentDomain/Operations/Sagas/NewRelationSagaContext.cs b/DocumentDomain/Operations/Sagas/NewRelationSagaContext.cs index 456e973..c3cfec5 100644 --- a/DocumentDomain/Operations/Sagas/NewRelationSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/NewRelationSagaContext.cs @@ -1,12 +1,12 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; +using Contracts; + public class NewRelationSagaContext : ISagaContextWithPayload { public RelationInput Payload { get; set; } diff --git a/DocumentDomain/Operations/Sagas/UpdateDocumentSaga.cs b/DocumentDomain/Operations/Sagas/UpdateDocumentSaga.cs index c3cc853..3471271 100644 --- a/DocumentDomain/Operations/Sagas/UpdateDocumentSaga.cs +++ b/DocumentDomain/Operations/Sagas/UpdateDocumentSaga.cs @@ -1,14 +1,14 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; -using DocumentDomain.Operations.Commands; -using Microsoft.Extensions.Logging; - #endregion namespace DocumentDomain.Operations.Sagas; +using Commands; +using Common.Sagas; +using Contracts; +using Microsoft.Extensions.Logging; + /// /// Update A Document Saga. /// diff --git a/DocumentDomain/Operations/Sagas/UpdateDocumentSagaContext.cs b/DocumentDomain/Operations/Sagas/UpdateDocumentSagaContext.cs index 174ebdd..cecbbcc 100644 --- a/DocumentDomain/Operations/Sagas/UpdateDocumentSagaContext.cs +++ b/DocumentDomain/Operations/Sagas/UpdateDocumentSagaContext.cs @@ -1,12 +1,12 @@ #region -using Common.Sagas; -using DocumentDomain.Contracts; - #endregion namespace DocumentDomain.Operations.Sagas; +using Common.Sagas; +using Contracts; + public class UpdateDocumentSagaContext : ISagaContextWithPayload { public DocumentInput Payload { get; set; } diff --git a/Tools/DocumentDataSeeder.cs b/Tools/DocumentDataSeeder.cs index 0ba2ed5..ba82f4e 100644 --- a/Tools/DocumentDataSeeder.cs +++ b/Tools/DocumentDataSeeder.cs @@ -1,14 +1,14 @@ #region +#endregion + +namespace EncyclopediaGalactica.Tools; + using Common.Sagas; using DocumentDomain.Contracts; using DocumentDomain.Operations.Sagas; using Microsoft.Extensions.Logging; -#endregion - -namespace EncyclopediaGalactica.Tools; - public class DocumentDataSeeder( IHaveInputAndResultSaga addDocumentSaga, ILogger logger) diff --git a/Tools/IDocumentDataSeeder.cs b/Tools/IDocumentDataSeeder.cs index ce2b264..1102693 100644 --- a/Tools/IDocumentDataSeeder.cs +++ b/Tools/IDocumentDataSeeder.cs @@ -1,11 +1,11 @@ #region -using DocumentDomain.Contracts; - #endregion namespace EncyclopediaGalactica.Tools; +using DocumentDomain.Contracts; + public interface IDocumentDataSeeder { Task SeedDocuments(int amount);