diff --git a/Producer.png b/Producer.png new file mode 100644 index 0000000..aa2dd49 Binary files /dev/null and b/Producer.png differ diff --git a/README.md b/README.md index 6b73d99..dec8c48 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ A solution for Blogging based on a Event-Driven architecture with DDD and CQRS. The full solution contains three applications. -* A Web API which receives Commands to produces Domain Events also receives Queries to return JSON. -* A Consumer App that reads the Event Stream and do a projection to a MongoDB database. +* A Producer Web API which receives Commands to produces Domain Events also receives Queries to return JSON. +* A Consumer Console App that reads the Event Stream and do a projection to a MongoDB database. * A Web API for authentication and JWT generation. +[Blogging API Source Code on GitHub](https://github.com/ivanpaulovich/jambo) + #### Requirements * [Visual Studio 2017 + Update 3](https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes) * [.NET SDK 2.0](https://www.microsoft.com/net/download/core) @@ -47,86 +49,75 @@ ba28cf144478 mongo "docker-entrypoint..." 2 days ago If Kafka is running good it will be working with the `10.0.75.1:9092` connection string and if MongoDB is running good it will be working at `mongodb://10.0.75.1:27017`. -#### The Domain -![Domain](https://github.com/ivanpaulovich/jambo/blob/master/docs/images/Domain.png) +## Running the applications -#### As Aplicações desta Solução -* **Producer**: Web API que recebe os comandos de edição de conteúdo, produz Eventos de Domínio e publica as mensagens em um tópico no Kafka. -* **Consumer**: Aplicativo Console que consome as mensagens do Kafka, deserializa em Eventos de Domínio e aplica nas agregações persistindo no MongoDB o novo estado. -* **Auth**: Web API que gera tokens de autenticação para acesso ao WebAPI. +You have two options to run the three applications, one is by opening on Visual Studio 2017 and another is by dotnet core commands. -#### Por onde começar? -Há duas formas de iniciar a solução. +### Option 1 - Running with Visual Studio 2017 -##### 1. O jeito fácil +Open the three solutions with three Visual Studio 2017 them run the following projects. -Resolver os [pré-requisitos](https://github.com/ivanpaulovich/jambo/#prerequisitos), definir o projeto inicial como sendo o `docker-compose` e então apertar `Ctrl+F5` para executar todas as aplicações. Se tudo estiver correto, digite `docker ps` no seu terminal para verificar em quais portas cada aplicação está executando. Será algo assim: +* `Jambo.Auth.UI` +* `Jambo.Consumer.UI` +* `Jambo.Producer.UI`. -![Enviando comandos](https://github.com/ivanpaulovich/jambo/blob/master/docs/images/Docker-PS.PNG) +### Option 2 - Running with dotnet commands -A partir daí basta acessar: -* Auth em http://localhost:32775/swagger/ -* Producer em http://localhost:32776/swagger/ +#### How to run the Bearer Authencation API -Leia o [o jeito não tão fácil](https://github.com/ivanpaulovich/jambo/#2-o-jeito-não-tão-fácil) para entender como criar um Token no Auth API para consumir os serviços do Producer API via swagger. +1. Run the command `dotnet run` at `source\Auth\Jambo.Auth.UI` folder. +``` +$ dotnet run +Using launch settings from C:\git\jambo\source\Auth\Jambo.Auth.UI\Properties\launchSettings.json... +Hosting environment: Development +Content root path: C:\git\jambo\source\Auth\Jambo.Auth.UI +Now listening on: http://localhost:16024 +Application started. Press Ctrl+C to shut down. +``` +2. Navigate to the Swagger UI at (eg. http://localhost:16024/swagger). +3. Post the following credentials: +``` +{ + "username": "ivanpaulovich", + "password": "mysecret" +} +``` +4. __Store the Bearer Token__ because you will need the token value later to log on Producer API. +``` +{ + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhYzA4MmE3OS1lMWY3LTQ4MTktYmU1Mi1hOTQwMTBkM2VjZTciLCJzdWIiOiJzdHJpbmciLCJleHAiOjE1MTI0Nzg5ODgsImlzcyI6Imh0dHA6Ly9teWFjY291bnRhcGkiLCJhdWQiOiJodHRwOi8vbXlhY2NvdW50YXBpIn0.9YKGmKaptLBDcExHhPOQ3_j9TsdbkcRf8ZtvIkdq8Go", + "expiration": "2017-12-05T13:03:08Z" +} +``` +#### How to run the Consumer API -##### 2. O jeito não tão fácil +1. Run the command `dotnet run` at `source\Consumer\Jambo.Consumer.UI` folder -A outra opção é inicializar aplicação por aplicação, seguindo o seguintes passos: +``` +$ dotnet run +11/5/2017 11:17:20 AM Waiting for events.. +11/5/2017 11:18:20 AM Waiting for events.. +11/5/2017 11:19:20 AM Waiting for events.. +11/5/2017 11:20:20 AM Waiting for events.. +11/5/2017 11:21:20 AM Waiting for events.. +11/5/2017 11:22:20 AM Waiting for events.. +``` -1. Execute o projeto **Jambo.Auth.WebAPI** e chame o método *Account/Token* com qualquer usuário e senha. *Guarde este token*. +3. __Attention:__ keep the Console App running for events processing. -![Auth](https://github.com/ivanpaulovich/jambo/blob/master/docs/images/Auth.PNG) +#### How to run the Producer API -![Auth com Token](https://github.com/ivanpaulovich/jambo/blob/master/docs/images/Auth1.PNG) +![Authorization](https://github.com/ivanpaulovich/jambo/blob/master/Producer.png) -3. Execute o projeto **Jambo.Producer.WebAPI** e clique no botão *Authorization* (topo direito da página). +1. Run the command `dotnet run` at the `source\Producer\Jambo.Producer.UI` folder. -Digite `bearer + valor_do_token` e clique em fechar. Algo assim: -![Autorizando](https://github.com/ivanpaulovich/jambo/blob/master/docs/images/Producer.PNG) -Chame os métodos para manutenção dos dados do Blog, Posts e Comentários. -![Enviando comandos](https://github.com/ivanpaulovich/jambo/blob/master/docs/images/Producer02.PNG) +``` +$ dotnet run +Using launch settings from C:\git\jambo\source\Producer\Jambo.Producer.UI\Properties\launchSettings.json... +Hosting environment: Development +Content root path: C:\git\jambo\source\Producer\Jambo.Producer.UI +Now listening on: http://localhost:16959 +Application started. Press Ctrl+C to shut down. +``` -2. Execute o projeto **Jambo.Consumer.Console** e garante que ele **contínua em execução**. - -![Comsumer em execução](https://github.com/ivanpaulovich/jambo/blob/master/docs/images/Consumer.PNG) - -4. Visualize suas modificações - -![Queries](https://github.com/ivanpaulovich/jambo/blob/master/docs/images/Producer03.PNG) - -#### Demo -* **Auth API**: http://jambo.westus.cloudapp.azure.com:7070/swagger/. -* **Producer**: http://jambo.westus.cloudapp.azure.com:7080/swagger/. -* **Consumer**: Executa em background neste servidor. - -#### Próximos passos? -1. Publicar os containers no Azure. -2. Criar um CI/CD para atualizar os containers a cada commit. -3. Criar testes de unidade, testes automatizados. -4. Consumir serviços externos. -5. Implementação alternativa de barramento: Azure Event Hubs -6. Implementação alternativa de snapshot: Azure Cosmos DB -7. Implementar um HealthCheck - -#### Pré-requisitos - -* [Visual Studio 2017 + Update 3](https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes) -* [.NET SDK 2.0](https://www.microsoft.com/net/download/core) -* [Docker](https://docs.docker.com/docker-for-windows/install/) (Opcional) -* [Robomongo](https://robomongo.org/) (Opcional) - -#### Agradecimentos -Obrigado aos amigos que me estimularam a criar este projeto e estão sempre contribuindo e dando feedback. -* [Vinicius Baldotto](https://github.com/Baldotto) -* [André Paulovich](https://github.com/andrepaulovich) -* André Mendes - -Obrigado de verdade! - -#### Deixe o seu feedback -Agradeço todo comentário sobre o projeto. Envie suas dúvidas e sugestões no [Fórum](https://github.com/ivanpaulovich/jambo/issues). - -#### Histórico de Versões -* 10/set/2017: -[![release](https://img.shields.io/github/release/ivanpaulovich/nixy.svg?style=flat-square)](https://github.com/ivanpaulovich/jambo/releases/latest) +2. Navigate to the Swagger UI (eg. http://localhost:14398/swagger). \ No newline at end of file diff --git a/docker-demo/docker-compose.yml b/docker-demo/docker-compose.yml deleted file mode 100644 index 5841201..0000000 --- a/docker-demo/docker-compose.yml +++ /dev/null @@ -1,54 +0,0 @@ -version: '2' - -services: - jambo.auth.webapi: - image: ivanpaulovich/jambo:auth.webapi - links: - - "mongodb:mongo" - depends_on: - - mongodb - ports: - - 7070:80 - jambo.producer.webapi: - image: ivanpaulovich/jambo:producer.webapi - ports: - - 7080:80 - links: - - "mongodb:mongo" - depends_on: - - mongodb - - kafka - environment: - - ASPNETCORE_URLS=http://*:80 - - ServiceBus__ConnectionString=kafka:9092 - - ServiceBus__Topic=jambov32 - - MongoDB__ConnectionString=mongodb://mongodb:27017 - - MongoDB__Database=jambov32 - jambo.consumer.console: - image: ivanpaulovich/jambo:consumer.console - links: - - "mongodb:mongo" - depends_on: - - mongodb - - kafka - environment: - - ASPNETCORE_URLS=http://*:80 - - ServiceBus__ConnectionString=kafka:9092 - - ServiceBus__Topic=jambov32 - - MongoDB__ConnectionString=mongodb://mongodb:27017 - - MongoDB__Database=jambov32 - mongodb: - image: mongo - container_name: "mongodb" - ports: - - 27017:27017 - kafka: - image: landoop/fast-data-dev:latest - ports: - - 2181:2181 - - 3030:3030 - - 8081-8083:8081-8083 - - 9581-9585:9581-9585 - - 9092:9092 - environment: - - ADV_HOST=kafka \ No newline at end of file diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index c419263..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/docs/images/Auth.PNG b/docs/images/Auth.PNG deleted file mode 100644 index 0e552d4..0000000 Binary files a/docs/images/Auth.PNG and /dev/null differ diff --git a/docs/images/Auth1.PNG b/docs/images/Auth1.PNG deleted file mode 100644 index 9541a98..0000000 Binary files a/docs/images/Auth1.PNG and /dev/null differ diff --git a/docs/images/Consumer.PNG b/docs/images/Consumer.PNG deleted file mode 100644 index f622ff0..0000000 Binary files a/docs/images/Consumer.PNG and /dev/null differ diff --git a/docs/images/Docker-PS.PNG b/docs/images/Docker-PS.PNG deleted file mode 100644 index 8a4f333..0000000 Binary files a/docs/images/Docker-PS.PNG and /dev/null differ diff --git a/docs/images/Domain.png b/docs/images/Domain.png deleted file mode 100644 index ff470aa..0000000 Binary files a/docs/images/Domain.png and /dev/null differ diff --git a/docs/images/Producer.PNG b/docs/images/Producer.PNG deleted file mode 100644 index 8694f65..0000000 Binary files a/docs/images/Producer.PNG and /dev/null differ diff --git a/docs/images/Producer02.PNG b/docs/images/Producer02.PNG deleted file mode 100644 index 0b98156..0000000 Binary files a/docs/images/Producer02.PNG and /dev/null differ diff --git a/docs/images/Producer03.PNG b/docs/images/Producer03.PNG deleted file mode 100644 index 432383d..0000000 Binary files a/docs/images/Producer03.PNG and /dev/null differ diff --git a/source/Setup/docker-compose.yml b/setup/docker-compose.yml similarity index 57% rename from source/Setup/docker-compose.yml rename to setup/docker-compose.yml index 97988a1..cbeb7b9 100644 --- a/source/Setup/docker-compose.yml +++ b/setup/docker-compose.yml @@ -6,9 +6,10 @@ services: ports: - 27017:27017 kafka: - image: landoop/fast-data-dev:latest + image: spotify/kafka ports: - - 3030:3030 + - 2181:2181 - 9092:9092 environment: - - ADV_HOST=10.0.75.1 + - ADVERTISED_HOST=10.0.75.1 + - ADVERTISED_PORT=9092 diff --git a/docker-demo/demo-down.sh b/setup/down-kafka-mongodb.sh similarity index 100% rename from docker-demo/demo-down.sh rename to setup/down-kafka-mongodb.sh diff --git a/docker-demo/demo-up.sh b/setup/up-kafka-mongodb.sh similarity index 100% rename from docker-demo/demo-up.sh rename to setup/up-kafka-mongodb.sh diff --git a/source/Auth/Jambo.Auth.Application/Commands/LoginCommand.cs b/source/Auth/Jambo.Auth.Application/Commands/LoginCommand.cs new file mode 100644 index 0000000..6bc25b0 --- /dev/null +++ b/source/Auth/Jambo.Auth.Application/Commands/LoginCommand.cs @@ -0,0 +1,17 @@ +namespace Jambo.Auth.Application.Commands +{ + using System.ComponentModel.DataAnnotations; + using System.Runtime.Serialization; + + [DataContract] + public class LoginCommand + { + [Required] + [DataMember] + public string Username { get; set; } + + [Required] + [DataMember] + public string Password { get; set; } + } +} diff --git a/source/Jambo.Auth.Application/Jambo.Auth.Application.csproj b/source/Auth/Jambo.Auth.Application/Jambo.Auth.Application.csproj similarity index 65% rename from source/Jambo.Auth.Application/Jambo.Auth.Application.csproj rename to source/Auth/Jambo.Auth.Application/Jambo.Auth.Application.csproj index a87ceca..3e4a1b7 100644 --- a/source/Jambo.Auth.Application/Jambo.Auth.Application.csproj +++ b/source/Auth/Jambo.Auth.Application/Jambo.Auth.Application.csproj @@ -4,12 +4,6 @@ netstandard2.0 - - - - - - diff --git a/source/Auth/Jambo.Auth.Infrastructure/Jambo.Auth.Infrastructure.csproj b/source/Auth/Jambo.Auth.Infrastructure/Jambo.Auth.Infrastructure.csproj new file mode 100644 index 0000000..ea4d6ef --- /dev/null +++ b/source/Auth/Jambo.Auth.Infrastructure/Jambo.Auth.Infrastructure.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + 1701;1702;1705;NU1701;CS1591 + + + + + + + diff --git a/source/Jambo.Auth.Infrastructure/Properties/launchSettings.json b/source/Auth/Jambo.Auth.Infrastructure/Properties/launchSettings.json similarity index 100% rename from source/Jambo.Auth.Infrastructure/Properties/launchSettings.json rename to source/Auth/Jambo.Auth.Infrastructure/Properties/launchSettings.json diff --git a/source/Jambo.Auth.Infrastructure/.dockerignore b/source/Auth/Jambo.Auth.UI/.dockerignore similarity index 100% rename from source/Jambo.Auth.Infrastructure/.dockerignore rename to source/Auth/Jambo.Auth.UI/.dockerignore diff --git a/source/Jambo.Auth.UI/Config.cs b/source/Auth/Jambo.Auth.UI/Config.cs similarity index 100% rename from source/Jambo.Auth.UI/Config.cs rename to source/Auth/Jambo.Auth.UI/Config.cs diff --git a/source/Jambo.Auth.UI/Controllers/AccountController.cs b/source/Auth/Jambo.Auth.UI/Controllers/AccountController.cs similarity index 71% rename from source/Jambo.Auth.UI/Controllers/AccountController.cs rename to source/Auth/Jambo.Auth.UI/Controllers/AccountController.cs index 324c06d..db01924 100644 --- a/source/Jambo.Auth.UI/Controllers/AccountController.cs +++ b/source/Auth/Jambo.Auth.UI/Controllers/AccountController.cs @@ -1,17 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Authorization; -using System.IdentityModel.Tokens.Jwt; -using Microsoft.IdentityModel.Tokens; -using System.Security.Claims; -using System.Text; -using Jambo.Auth.Application.Commands; - -namespace Jambo.Auth.UI +namespace Jambo.Auth.UI { + using System; + using System.Collections.Generic; + using Microsoft.AspNetCore.Mvc; + using Microsoft.AspNetCore.Authorization; + using System.IdentityModel.Tokens.Jwt; + using Microsoft.IdentityModel.Tokens; + using System.Security.Claims; + using System.Text; + using Jambo.Auth.Application.Commands; + [Route("api/[controller]")] public class AccountController : Controller { @@ -46,7 +44,7 @@ namespace Jambo.Auth.UI config.Issuer, config.Issuer, GetTokenClaims(user), - expires: DateTime.UtcNow.AddDays(1), + expires: DateTime.UtcNow.AddDays(7), signingCredentials: new SigningCredentials( new SymmetricSecurityKey(Encoding.UTF8.GetBytes(config.SecretKey)), SecurityAlgorithms.HmacSha256) @@ -57,9 +55,8 @@ namespace Jambo.Auth.UI { return new List { - new Claim(JwtRegisteredClaimNames.Jti, user.UserId.ToString()), - new Claim(JwtRegisteredClaimNames.Sub, user.UserId.ToString()), - new Claim(ClaimTypes.GroupSid, user.SchoolId.ToString()), + new Claim(JwtRegisteredClaimNames.Jti, user.Username), + new Claim(JwtRegisteredClaimNames.Sub, user.Password), }; } } diff --git a/source/Jambo.Auth.Infrastructure/Dockerfile b/source/Auth/Jambo.Auth.UI/Dockerfile similarity index 66% rename from source/Jambo.Auth.Infrastructure/Dockerfile rename to source/Auth/Jambo.Auth.UI/Dockerfile index 6684489..ff05aaa 100644 --- a/source/Jambo.Auth.Infrastructure/Dockerfile +++ b/source/Auth/Jambo.Auth.UI/Dockerfile @@ -3,4 +3,4 @@ ARG source WORKDIR /app EXPOSE 80 COPY ${source:-obj/Docker/publish} . -ENTRYPOINT ["dotnet", "Jambo.Auth.Infrastructure.dll"] +ENTRYPOINT ["dotnet", "Jambo.Auth.UI.dll"] diff --git a/source/Jambo.Auth.Infrastructure/Jambo.Auth.Infrastructure.csproj b/source/Auth/Jambo.Auth.UI/Jambo.Auth.UI.csproj similarity index 56% rename from source/Jambo.Auth.Infrastructure/Jambo.Auth.Infrastructure.csproj rename to source/Auth/Jambo.Auth.UI/Jambo.Auth.UI.csproj index 11321dc..aaa2489 100644 --- a/source/Jambo.Auth.Infrastructure/Jambo.Auth.Infrastructure.csproj +++ b/source/Auth/Jambo.Auth.UI/Jambo.Auth.UI.csproj @@ -4,6 +4,16 @@ netcoreapp2.0 + + 1701;1702;1705;NU1701 + bin\Debug\netcoreapp2.0\Jambo.Auth.UI.xml + + + + + + + @@ -11,7 +21,6 @@ - diff --git a/source/Jambo.Auth.Infrastructure/Program.cs b/source/Auth/Jambo.Auth.UI/Program.cs similarity index 52% rename from source/Jambo.Auth.Infrastructure/Program.cs rename to source/Auth/Jambo.Auth.UI/Program.cs index 4744c71..7a1b15e 100644 --- a/source/Jambo.Auth.Infrastructure/Program.cs +++ b/source/Auth/Jambo.Auth.UI/Program.cs @@ -1,15 +1,8 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; - -namespace Jambo.Auth.Infrastructure +namespace Jambo.Auth.UI { + using Microsoft.AspNetCore; + using Microsoft.AspNetCore.Hosting; + public class Program { public static void Main(string[] args) diff --git a/source/Auth/Jambo.Auth.UI/Properties/launchSettings.json b/source/Auth/Jambo.Auth.UI/Properties/launchSettings.json new file mode 100644 index 0000000..3951b96 --- /dev/null +++ b/source/Auth/Jambo.Auth.UI/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:16023/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Jambo.Auth.UI": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:16024/" + } + } +} \ No newline at end of file diff --git a/source/Jambo.Auth.Infrastructure/Startup.cs b/source/Auth/Jambo.Auth.UI/Startup.cs similarity index 87% rename from source/Jambo.Auth.Infrastructure/Startup.cs rename to source/Auth/Jambo.Auth.UI/Startup.cs index 86bd37e..aa6e975 100644 --- a/source/Jambo.Auth.Infrastructure/Startup.cs +++ b/source/Auth/Jambo.Auth.UI/Startup.cs @@ -1,10 +1,10 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; - -namespace Jambo.Auth.Infrastructure +namespace Jambo.Auth.UI { + using Microsoft.AspNetCore.Builder; + using Microsoft.AspNetCore.Hosting; + using Microsoft.Extensions.Configuration; + using Microsoft.Extensions.DependencyInjection; + public class Startup { public Startup(IConfiguration configuration) diff --git a/source/Jambo.Auth.Infrastructure/appsettings.Development.json b/source/Auth/Jambo.Auth.UI/appsettings.Development.json similarity index 100% rename from source/Jambo.Auth.Infrastructure/appsettings.Development.json rename to source/Auth/Jambo.Auth.UI/appsettings.Development.json diff --git a/source/Jambo.Auth.Infrastructure/appsettings.json b/source/Auth/Jambo.Auth.UI/appsettings.json similarity index 100% rename from source/Jambo.Auth.Infrastructure/appsettings.json rename to source/Auth/Jambo.Auth.UI/appsettings.json diff --git a/source/Jambo.Auth.sln b/source/Auth/Jambo.Auth.sln similarity index 100% rename from source/Jambo.Auth.sln rename to source/Auth/Jambo.Auth.sln diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogCreatedEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogCreatedEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogCreatedEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogCreatedEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogDisabledEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogDisabledEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogDisabledEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogDisabledEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogEnabledEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogEnabledEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogEnabledEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogEnabledEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogUrlUpdatedEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogUrlUpdatedEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogUrlUpdatedEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Blogs/BlogUrlUpdatedEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Posts/CommentCreatedEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/CommentCreatedEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Posts/CommentCreatedEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/CommentCreatedEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostContentUpdatedEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostContentUpdatedEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostContentUpdatedEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostContentUpdatedEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostCreatedEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostCreatedEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostCreatedEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostCreatedEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostDisabledEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostDisabledEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostDisabledEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostDisabledEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostEnabledEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostEnabledEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostEnabledEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostEnabledEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostHiddenDomainEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostHiddenDomainEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostHiddenDomainEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostHiddenDomainEventHandler.cs diff --git a/source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostPublishedDomainEventHandler.cs b/source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostPublishedDomainEventHandler.cs similarity index 100% rename from source/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostPublishedDomainEventHandler.cs rename to source/Consumer/Jambo.Consumer.Application/DomainEventHandlers/Posts/PostPublishedDomainEventHandler.cs diff --git a/source/Jambo.Consumer.Application/Jambo.Consumer.Application.csproj b/source/Consumer/Jambo.Consumer.Application/Jambo.Consumer.Application.csproj similarity index 86% rename from source/Jambo.Consumer.Application/Jambo.Consumer.Application.csproj rename to source/Consumer/Jambo.Consumer.Application/Jambo.Consumer.Application.csproj index 1eb8d07..b2c6c3f 100644 --- a/source/Jambo.Consumer.Application/Jambo.Consumer.Application.csproj +++ b/source/Consumer/Jambo.Consumer.Application/Jambo.Consumer.Application.csproj @@ -12,7 +12,7 @@ - + diff --git a/source/Jambo.Consumer.Infrastructure/DataAccess/MongoContext.cs b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/MongoContext.cs similarity index 90% rename from source/Jambo.Consumer.Infrastructure/DataAccess/MongoContext.cs rename to source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/MongoContext.cs index 298af83..ea16adb 100644 --- a/source/Jambo.Consumer.Infrastructure/DataAccess/MongoContext.cs +++ b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/MongoContext.cs @@ -1,11 +1,11 @@ -using Jambo.Domain.Model; -using Jambo.Domain.Model.Blogs; -using Jambo.Domain.Model.Posts; -using MongoDB.Bson.Serialization; -using MongoDB.Driver; - -namespace Jambo.Consumer.Infrastructure.DataAccess +namespace Jambo.Consumer.Infrastructure.DataAccess { + using Jambo.Domain.Model; + using Jambo.Domain.Model.Blogs; + using Jambo.Domain.Model.Posts; + using MongoDB.Bson.Serialization; + using MongoDB.Driver; + public class MongoContext { private readonly MongoClient mongoClient; diff --git a/source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs similarity index 70% rename from source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs rename to source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs index 71c8a46..1bd1b85 100644 --- a/source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs +++ b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs @@ -1,12 +1,11 @@ -using Jambo.Domain.Model.Blogs; -using Jambo.Domain.Model.Posts; -using MongoDB.Driver; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Jambo.Consumer.Infrastructure.DataAccess.Repositories.Blogs +namespace Jambo.Consumer.Infrastructure.DataAccess.Repositories.Blogs { + using Jambo.Domain.Model.Blogs; + using MongoDB.Driver; + using System; + using System.Collections.Generic; + using System.Threading.Tasks; + public class BlogReadOnlyRepository : IBlogReadOnlyRepository { private readonly MongoContext _mongoContext; diff --git a/source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogWriteOnlyRepository.cs b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogWriteOnlyRepository.cs similarity index 74% rename from source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogWriteOnlyRepository.cs rename to source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogWriteOnlyRepository.cs index eb8b0e0..b7de1bd 100644 --- a/source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogWriteOnlyRepository.cs +++ b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Blogs/BlogWriteOnlyRepository.cs @@ -1,10 +1,10 @@ -using Jambo.Domain.Model.Blogs; -using MongoDB.Driver; -using System; -using System.Threading.Tasks; - -namespace Jambo.Consumer.Infrastructure.DataAccess.Repositories.Blogs +namespace Jambo.Consumer.Infrastructure.DataAccess.Repositories.Blogs { + using Jambo.Domain.Model.Blogs; + using MongoDB.Driver; + using System; + using System.Threading.Tasks; + public class BlogWriteOnlyRepository : IBlogWriteOnlyRepository { private readonly MongoContext mongoContext; diff --git a/source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs similarity index 71% rename from source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs rename to source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs index ee558fb..878bb30 100644 --- a/source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs +++ b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs @@ -1,12 +1,11 @@ -using Jambo.Domain.Model.Blogs; -using Jambo.Domain.Model.Posts; -using MongoDB.Driver; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Jambo.Consumer.Infrastructure.DataAccess.Repositories.Posts +namespace Jambo.Consumer.Infrastructure.DataAccess.Repositories.Posts { + using Jambo.Domain.Model.Posts; + using MongoDB.Driver; + using System; + using System.Collections.Generic; + using System.Threading.Tasks; + public class PostReadOnlyRepository : IPostReadOnlyRepository { private readonly MongoContext _mongoContext; diff --git a/source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostWriteOnlyRepository.cs b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostWriteOnlyRepository.cs similarity index 72% rename from source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostWriteOnlyRepository.cs rename to source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostWriteOnlyRepository.cs index b0edf54..421f33f 100644 --- a/source/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostWriteOnlyRepository.cs +++ b/source/Consumer/Jambo.Consumer.Infrastructure/DataAccess/Repositories/Posts/PostWriteOnlyRepository.cs @@ -1,11 +1,10 @@ -using Jambo.Domain.Model.Blogs; -using Jambo.Domain.Model.Posts; -using MongoDB.Driver; -using System; -using System.Threading.Tasks; - -namespace Jambo.Consumer.Infrastructure.DataAccess.Repositories.Posts +namespace Jambo.Consumer.Infrastructure.DataAccess.Repositories.Posts { + using Jambo.Domain.Model.Posts; + using MongoDB.Driver; + using System; + using System.Threading.Tasks; + public class PostWriteOnlyRepository : IPostWriteOnlyRepository { private readonly MongoContext _mongoContext; diff --git a/source/Jambo.Consumer.Infrastructure/Jambo.Consumer.Infrastructure.csproj b/source/Consumer/Jambo.Consumer.Infrastructure/Jambo.Consumer.Infrastructure.csproj similarity index 77% rename from source/Jambo.Consumer.Infrastructure/Jambo.Consumer.Infrastructure.csproj rename to source/Consumer/Jambo.Consumer.Infrastructure/Jambo.Consumer.Infrastructure.csproj index dba8f37..d256aa7 100644 --- a/source/Jambo.Consumer.Infrastructure/Jambo.Consumer.Infrastructure.csproj +++ b/source/Consumer/Jambo.Consumer.Infrastructure/Jambo.Consumer.Infrastructure.csproj @@ -27,11 +27,7 @@ - + - - - - - + diff --git a/source/Jambo.Consumer.Infrastructure/Modules/ApplicationModule.cs b/source/Consumer/Jambo.Consumer.Infrastructure/Modules/ApplicationModule.cs similarity index 100% rename from source/Jambo.Consumer.Infrastructure/Modules/ApplicationModule.cs rename to source/Consumer/Jambo.Consumer.Infrastructure/Modules/ApplicationModule.cs diff --git a/source/Jambo.Consumer.Infrastructure/Modules/BusModule.cs b/source/Consumer/Jambo.Consumer.Infrastructure/Modules/BusModule.cs similarity index 100% rename from source/Jambo.Consumer.Infrastructure/Modules/BusModule.cs rename to source/Consumer/Jambo.Consumer.Infrastructure/Modules/BusModule.cs diff --git a/source/Consumer/Jambo.Consumer.Infrastructure/Modules/MediatRModule.cs b/source/Consumer/Jambo.Consumer.Infrastructure/Modules/MediatRModule.cs new file mode 100644 index 0000000..f8bf38b --- /dev/null +++ b/source/Consumer/Jambo.Consumer.Infrastructure/Modules/MediatRModule.cs @@ -0,0 +1,38 @@ +namespace Jambo.Consumer.Infrastructure.Modules +{ + using Autofac; + using Autofac.Features.Variance; + using Jambo.Consumer.Application.DomainEventHandlers.Blogs; + using MediatR; + using System.Collections.Generic; + using System.Reflection; + + public class MediatRModule : Autofac.Module + { + protected override void Load(ContainerBuilder builder) + { + builder.RegisterSource(new ContravariantRegistrationSource()); + + builder + .RegisterType() + .As() + .InstancePerLifetimeScope(); + + builder + .Register(ctx => { + var c = ctx.Resolve(); + return t => { object o; return c.TryResolve(t, out o) ? o : null; }; + }) + .InstancePerLifetimeScope(); + + builder + .Register(ctx => { + var c = ctx.Resolve(); + return t => (IEnumerable)c.Resolve(typeof(IEnumerable<>).MakeGenericType(t)); + }) + .InstancePerLifetimeScope(); + + builder.RegisterAssemblyTypes(typeof(BlogCreatedEventHandler).GetTypeInfo().Assembly).AsImplementedInterfaces(); // via assembly scan + } + } +} diff --git a/source/Jambo.Consumer.Infrastructure/ServiceBus/Bus.cs b/source/Consumer/Jambo.Consumer.Infrastructure/ServiceBus/Bus.cs similarity index 88% rename from source/Jambo.Consumer.Infrastructure/ServiceBus/Bus.cs rename to source/Consumer/Jambo.Consumer.Infrastructure/ServiceBus/Bus.cs index eacdd50..8fefd04 100644 --- a/source/Jambo.Consumer.Infrastructure/ServiceBus/Bus.cs +++ b/source/Consumer/Jambo.Consumer.Infrastructure/ServiceBus/Bus.cs @@ -1,17 +1,17 @@ -using Confluent.Kafka; -using Confluent.Kafka.Serialization; -using Jambo.Domain.Exceptions; -using Jambo.Domain.Model; -using Jambo.Domain.ServiceBus; -using MediatR; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; - -namespace Jambo.Consumer.Infrastructure.ServiceBus +namespace Jambo.Consumer.Infrastructure.ServiceBus { + using Confluent.Kafka; + using Confluent.Kafka.Serialization; + using Jambo.Domain.Exceptions; + using Jambo.Domain.Model; + using Jambo.Domain.ServiceBus; + using MediatR; + using Newtonsoft.Json; + using System; + using System.Collections.Generic; + using System.Text; + using System.Threading.Tasks; + public class Bus : ISubscriber { public readonly string brokerList; diff --git a/source/Jambo.Consumer.UI/.dockerignore b/source/Consumer/Jambo.Consumer.UI/.dockerignore similarity index 100% rename from source/Jambo.Consumer.UI/.dockerignore rename to source/Consumer/Jambo.Consumer.UI/.dockerignore diff --git a/source/Jambo.Consumer.UI/Dockerfile b/source/Consumer/Jambo.Consumer.UI/Dockerfile similarity index 100% rename from source/Jambo.Consumer.UI/Dockerfile rename to source/Consumer/Jambo.Consumer.UI/Dockerfile diff --git a/source/Jambo.Consumer.UI/Jambo.Consumer.UI.csproj b/source/Consumer/Jambo.Consumer.UI/Jambo.Consumer.UI.csproj similarity index 89% rename from source/Jambo.Consumer.UI/Jambo.Consumer.UI.csproj rename to source/Consumer/Jambo.Consumer.UI/Jambo.Consumer.UI.csproj index 0a716ea..8eb2253 100644 --- a/source/Jambo.Consumer.UI/Jambo.Consumer.UI.csproj +++ b/source/Consumer/Jambo.Consumer.UI/Jambo.Consumer.UI.csproj @@ -28,7 +28,8 @@ - + + diff --git a/source/Jambo.Consumer.UI/Program.cs b/source/Consumer/Jambo.Consumer.UI/Program.cs similarity index 100% rename from source/Jambo.Consumer.UI/Program.cs rename to source/Consumer/Jambo.Consumer.UI/Program.cs diff --git a/source/Jambo.Consumer.UI/Startup.cs b/source/Consumer/Jambo.Consumer.UI/Startup.cs similarity index 71% rename from source/Jambo.Consumer.UI/Startup.cs rename to source/Consumer/Jambo.Consumer.UI/Startup.cs index 95425da..3305098 100644 --- a/source/Jambo.Consumer.UI/Startup.cs +++ b/source/Consumer/Jambo.Consumer.UI/Startup.cs @@ -29,10 +29,6 @@ public IServiceProvider ConfigureServices(IServiceCollection services) { - LoadInfrastructureAssemblies(); - - services.AddMediatR(typeof(BlogCreatedEventHandler).GetTypeInfo().Assembly); - ContainerBuilder builder = new ContainerBuilder(); builder.Populate(services); builder.RegisterModule(new ConfigurationModule(Configuration)); @@ -42,16 +38,6 @@ return serviceProvider; } - private void LoadInfrastructureAssemblies() - { - string[] fileNames = Directory.EnumerateFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll", SearchOption.TopDirectoryOnly) - .Where(filePath => Path.GetFileName(filePath).StartsWith("Jambo.Consumer.Infrastructure", StringComparison.OrdinalIgnoreCase)) - .ToArray(); - - foreach (string file in fileNames) - AssemblyLoadContext.Default.LoadFromAssemblyPath(file); - } - public void Run() { IMediator mediator = serviceProvider.GetService(); diff --git a/source/Jambo.Consumer.UI/appsettings.json b/source/Consumer/Jambo.Consumer.UI/appsettings.json similarity index 100% rename from source/Jambo.Consumer.UI/appsettings.json rename to source/Consumer/Jambo.Consumer.UI/appsettings.json diff --git a/source/Jambo.Consumer.UI/autofac.Development.json b/source/Consumer/Jambo.Consumer.UI/autofac.Development.json similarity index 100% rename from source/Jambo.Consumer.UI/autofac.Development.json rename to source/Consumer/Jambo.Consumer.UI/autofac.Development.json diff --git a/source/Jambo.Consumer.UI/autofac.json b/source/Consumer/Jambo.Consumer.UI/autofac.json similarity index 80% rename from source/Jambo.Consumer.UI/autofac.json rename to source/Consumer/Jambo.Consumer.UI/autofac.json index 92e3ba5..917bd68 100644 --- a/source/Jambo.Consumer.UI/autofac.json +++ b/source/Consumer/Jambo.Consumer.UI/autofac.json @@ -14,6 +14,11 @@ "BrokerList": "10.0.75.1:9092", "Topic": "jambov32" } + }, + { + "type": "Jambo.Consumer.Infrastructure.Modules.MediatRModule", + "properties": { + } } ] } \ No newline at end of file diff --git a/source/Jambo.Consumer.sln b/source/Consumer/Jambo.Consumer.sln similarity index 75% rename from source/Jambo.Consumer.sln rename to source/Consumer/Jambo.Consumer.sln index e40191b..601ade9 100644 --- a/source/Jambo.Consumer.sln +++ b/source/Consumer/Jambo.Consumer.sln @@ -3,15 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26730.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Domain", "Jambo.Domain\Jambo.Domain.csproj", "{ED9F252F-10E5-4A65-ADA0-122D61D655A4}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Consumer.Application", "Jambo.Consumer.Application\Jambo.Consumer.Application.csproj", "{601F90B1-4BE4-462E-8595-AAAA49B80405}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Domain.UnitTests", "Jambo.Domain.UnitTests\Jambo.Domain.UnitTests.csproj", "{B59AD81D-93F9-425F-8F87-DF13561BE424}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Consumer.Infrastructure", "Jambo.Consumer.Infrastructure\Jambo.Consumer.Infrastructure.csproj", "{645C9138-DA59-48C8-A15E-D720874DD148}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jambo.Consumer.UI", "Jambo.Consumer.UI\Jambo.Consumer.UI.csproj", "{E86878A7-CB0F-46A7-B918-BED5C45BA4C5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Consumer.UI", "Jambo.Consumer.UI\Jambo.Consumer.UI.csproj", "{E86878A7-CB0F-46A7-B918-BED5C45BA4C5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Domain", "..\Shared\Jambo.Domain\Jambo.Domain.csproj", "{B0475864-44AC-4A6A-9970-CC5EEA01C2CF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Domain.UnitTests", "..\Shared\Jambo.Domain.UnitTests\Jambo.Domain.UnitTests.csproj", "{04732413-3F55-4194-B406-2F84666B1F6C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -19,18 +19,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {ED9F252F-10E5-4A65-ADA0-122D61D655A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED9F252F-10E5-4A65-ADA0-122D61D655A4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED9F252F-10E5-4A65-ADA0-122D61D655A4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED9F252F-10E5-4A65-ADA0-122D61D655A4}.Release|Any CPU.Build.0 = Release|Any CPU {601F90B1-4BE4-462E-8595-AAAA49B80405}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {601F90B1-4BE4-462E-8595-AAAA49B80405}.Debug|Any CPU.Build.0 = Debug|Any CPU {601F90B1-4BE4-462E-8595-AAAA49B80405}.Release|Any CPU.ActiveCfg = Release|Any CPU {601F90B1-4BE4-462E-8595-AAAA49B80405}.Release|Any CPU.Build.0 = Release|Any CPU - {B59AD81D-93F9-425F-8F87-DF13561BE424}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B59AD81D-93F9-425F-8F87-DF13561BE424}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B59AD81D-93F9-425F-8F87-DF13561BE424}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B59AD81D-93F9-425F-8F87-DF13561BE424}.Release|Any CPU.Build.0 = Release|Any CPU {645C9138-DA59-48C8-A15E-D720874DD148}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {645C9138-DA59-48C8-A15E-D720874DD148}.Debug|Any CPU.Build.0 = Debug|Any CPU {645C9138-DA59-48C8-A15E-D720874DD148}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -39,6 +31,14 @@ Global {E86878A7-CB0F-46A7-B918-BED5C45BA4C5}.Debug|Any CPU.Build.0 = Debug|Any CPU {E86878A7-CB0F-46A7-B918-BED5C45BA4C5}.Release|Any CPU.ActiveCfg = Release|Any CPU {E86878A7-CB0F-46A7-B918-BED5C45BA4C5}.Release|Any CPU.Build.0 = Release|Any CPU + {B0475864-44AC-4A6A-9970-CC5EEA01C2CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0475864-44AC-4A6A-9970-CC5EEA01C2CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0475864-44AC-4A6A-9970-CC5EEA01C2CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0475864-44AC-4A6A-9970-CC5EEA01C2CF}.Release|Any CPU.Build.0 = Release|Any CPU + {04732413-3F55-4194-B406-2F84666B1F6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04732413-3F55-4194-B406-2F84666B1F6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04732413-3F55-4194-B406-2F84666B1F6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04732413-3F55-4194-B406-2F84666B1F6C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/source/Jambo.Auth.Application/Commands/LoginCommand.cs b/source/Jambo.Auth.Application/Commands/LoginCommand.cs deleted file mode 100644 index fd088ab..0000000 --- a/source/Jambo.Auth.Application/Commands/LoginCommand.cs +++ /dev/null @@ -1,26 +0,0 @@ -using MediatR; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Runtime.Serialization; -using System.Text; - -namespace Jambo.Auth.Application.Commands -{ - [DataContract] - public class LoginCommand : IRequest - { - [Required] - [DataMember] - public Guid UserId { get; private set; } - - [Required] - [DataMember] - public Guid SchoolId { get; private set; } - - public LoginCommand() - { - - } - } -} diff --git a/source/Jambo.Auth.UI/Jambo.Auth.UI.csproj b/source/Jambo.Auth.UI/Jambo.Auth.UI.csproj deleted file mode 100644 index 4200b64..0000000 --- a/source/Jambo.Auth.UI/Jambo.Auth.UI.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - netcoreapp2.0 - - - - - - - - - - - - diff --git a/source/Jambo.Consumer.Infrastructure/Program.cs b/source/Jambo.Consumer.Infrastructure/Program.cs deleted file mode 100644 index c410db53f..0000000 --- a/source/Jambo.Consumer.Infrastructure/Program.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Jambo.Consumer.Infrastructure -{ - using Microsoft.Extensions.Configuration; - using Microsoft.Extensions.DependencyInjection; - using System.IO; - - class Program - { - public static void Main(string[] args) - { - var builder = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddEnvironmentVariables(); - - IConfigurationRoot configuration = builder.Build(); - IServiceCollection serviceCollection = new ServiceCollection(); - - Startup startup = new Startup(configuration); - startup.ConfigureServices(serviceCollection); - startup.Run(); - } - } -} diff --git a/source/Jambo.Consumer.Infrastructure/Startup.cs b/source/Jambo.Consumer.Infrastructure/Startup.cs deleted file mode 100644 index d00d3e2..0000000 --- a/source/Jambo.Consumer.Infrastructure/Startup.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Autofac; -using Autofac.Extensions.DependencyInjection; -using Jambo.Consumer.Application.DomainEventHandlers.Blogs; -using Jambo.Consumer.Infrastructure.Modules; -using Jambo.Domain.ServiceBus; -using MediatR; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Reflection; -using System.Threading; - -namespace Jambo.Consumer.Infrastructure -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - IServiceProvider serviceProvider; - - public IServiceProvider ConfigureServices(IServiceCollection services) - { - services.AddMediatR(typeof(BlogCreatedEventHandler).GetTypeInfo().Assembly); - - ContainerBuilder container = new ContainerBuilder(); - container.Populate(services); - - container.RegisterModule(new ApplicationModule( - Configuration.GetSection("MongoDB").GetValue("ConnectionString"), - Configuration.GetSection("MongoDB").GetValue("Database"))); - - container.RegisterModule(new BusModule( - Configuration.GetSection("ServiceBus").GetValue("ConnectionString"), - Configuration.GetSection("ServiceBus").GetValue("Topic"))); - - serviceProvider = new AutofacServiceProvider(container.Build()); - - return serviceProvider; - } - - public void Run() - { - IMediator mediator = serviceProvider.GetService(); - ISubscriber subscriber = serviceProvider.GetService(); - - subscriber.Listen(mediator); - - while (true) - { - Thread.Sleep(1000 * 60); - } - } - } -} diff --git a/source/Jambo.Domain/Model/Posts/Events/PostCreatedDomainEvent.cs b/source/Jambo.Domain/Model/Posts/Events/PostCreatedDomainEvent.cs deleted file mode 100644 index a1e9f3a..0000000 --- a/source/Jambo.Domain/Model/Posts/Events/PostCreatedDomainEvent.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; - -namespace Jambo.Domain.Model.Posts.Events -{ -public class PostCreatedDomainEvent : DomainEvent -{ - public Guid BlogId { get; private set; } - public int BlogVersion { get; private set; } - - public PostCreatedDomainEvent(Guid aggregateRootId, int version, - DateTime createdDate, Header header, Guid blogId, int blogVersion) - : base(aggregateRootId, version, createdDate, header) - { - BlogId = blogId; - BlogVersion = blogVersion; - } - - public static PostCreatedDomainEvent Create(AggregateRoot aggregateRoot, - Guid blogId, int blogVersion) - { - if (aggregateRoot == null) - throw new ArgumentNullException("aggregateRoot"); - - PostCreatedDomainEvent domainEvent = new PostCreatedDomainEvent( - aggregateRoot.Id, aggregateRoot.Version, DateTime.UtcNow, null, blogId, blogVersion); - - return domainEvent; - } -} -} diff --git a/source/Jambo.Producer.Application/CommandHandlers/Blogs/CreateBlogCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Blogs/CreateBlogCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Blogs/CreateBlogCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Blogs/CreateBlogCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Blogs/DisableBlogCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Blogs/DisableBlogCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Blogs/DisableBlogCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Blogs/DisableBlogCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Blogs/EnableBlogCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Blogs/EnableBlogCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Blogs/EnableBlogCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Blogs/EnableBlogCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Blogs/UpdateBlogUrlCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Blogs/UpdateBlogUrlCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Blogs/UpdateBlogUrlCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Blogs/UpdateBlogUrlCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Posts/CreateCommentCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/CreateCommentCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Posts/CreateCommentCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/CreateCommentCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Posts/CreatePostCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/CreatePostCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Posts/CreatePostCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/CreatePostCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Posts/DisablePostCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/DisablePostCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Posts/DisablePostCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/DisablePostCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Posts/EnablePostCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/EnablePostCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Posts/EnablePostCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/EnablePostCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Posts/HidePostCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/HidePostCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Posts/HidePostCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/HidePostCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Posts/PublishPostCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/PublishPostCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Posts/PublishPostCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/PublishPostCommandHandler.cs diff --git a/source/Jambo.Producer.Application/CommandHandlers/Posts/UpdateContentCommandHandler.cs b/source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/UpdateContentCommandHandler.cs similarity index 100% rename from source/Jambo.Producer.Application/CommandHandlers/Posts/UpdateContentCommandHandler.cs rename to source/Producer/Jambo.Producer.Application/CommandHandlers/Posts/UpdateContentCommandHandler.cs diff --git a/source/Jambo.Producer.Application/Commands/Blogs/CreateBlogCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Blogs/CreateBlogCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Blogs/CreateBlogCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Blogs/CreateBlogCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/Blogs/DisableBlogCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Blogs/DisableBlogCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Blogs/DisableBlogCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Blogs/DisableBlogCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/Blogs/EnableBlogCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Blogs/EnableBlogCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Blogs/EnableBlogCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Blogs/EnableBlogCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/Blogs/UpdateBlogUrlCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Blogs/UpdateBlogUrlCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Blogs/UpdateBlogUrlCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Blogs/UpdateBlogUrlCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/CommandBase.cs b/source/Producer/Jambo.Producer.Application/Commands/CommandBase.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/CommandBase.cs rename to source/Producer/Jambo.Producer.Application/Commands/CommandBase.cs diff --git a/source/Jambo.Producer.Application/Commands/Posts/CreateCommentCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Posts/CreateCommentCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Posts/CreateCommentCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Posts/CreateCommentCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/Posts/CreatePostCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Posts/CreatePostCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Posts/CreatePostCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Posts/CreatePostCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/Posts/DisablePostCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Posts/DisablePostCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Posts/DisablePostCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Posts/DisablePostCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/Posts/EnablePostCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Posts/EnablePostCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Posts/EnablePostCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Posts/EnablePostCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/Posts/HidePostCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Posts/HidePostCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Posts/HidePostCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Posts/HidePostCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/Posts/PublishPostCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Posts/PublishPostCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Posts/PublishPostCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Posts/PublishPostCommand.cs diff --git a/source/Jambo.Producer.Application/Commands/Posts/UpdatePostContentCommand.cs b/source/Producer/Jambo.Producer.Application/Commands/Posts/UpdatePostContentCommand.cs similarity index 100% rename from source/Jambo.Producer.Application/Commands/Posts/UpdatePostContentCommand.cs rename to source/Producer/Jambo.Producer.Application/Commands/Posts/UpdatePostContentCommand.cs diff --git a/source/Jambo.Producer.Application/Jambo.Producer.Application.csproj b/source/Producer/Jambo.Producer.Application/Jambo.Producer.Application.csproj similarity index 76% rename from source/Jambo.Producer.Application/Jambo.Producer.Application.csproj rename to source/Producer/Jambo.Producer.Application/Jambo.Producer.Application.csproj index d35ba59..5656753 100644 --- a/source/Jambo.Producer.Application/Jambo.Producer.Application.csproj +++ b/source/Producer/Jambo.Producer.Application/Jambo.Producer.Application.csproj @@ -9,7 +9,7 @@ - + diff --git a/source/Jambo.Producer.Application/Queries/IBlogQueries.cs b/source/Producer/Jambo.Producer.Application/Queries/IBlogQueries.cs similarity index 100% rename from source/Jambo.Producer.Application/Queries/IBlogQueries.cs rename to source/Producer/Jambo.Producer.Application/Queries/IBlogQueries.cs diff --git a/source/Jambo.Producer.Application/Queries/IPostQueries.cs b/source/Producer/Jambo.Producer.Application/Queries/IPostQueries.cs similarity index 100% rename from source/Jambo.Producer.Application/Queries/IPostQueries.cs rename to source/Producer/Jambo.Producer.Application/Queries/IPostQueries.cs diff --git a/source/Jambo.Producer.Infrastructure/DataAccess/MongoContext.cs b/source/Producer/Jambo.Producer.Infrastructure/DataAccess/MongoContext.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/DataAccess/MongoContext.cs rename to source/Producer/Jambo.Producer.Infrastructure/DataAccess/MongoContext.cs diff --git a/source/Jambo.Producer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs b/source/Producer/Jambo.Producer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs rename to source/Producer/Jambo.Producer.Infrastructure/DataAccess/Repositories/Blogs/BlogReadOnlyRepository.cs diff --git a/source/Jambo.Producer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs b/source/Producer/Jambo.Producer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs rename to source/Producer/Jambo.Producer.Infrastructure/DataAccess/Repositories/Posts/PostReadOnlyRepository.cs diff --git a/source/Jambo.Producer.Infrastructure/Jambo.Producer.Infrastructure.csproj b/source/Producer/Jambo.Producer.Infrastructure/Jambo.Producer.Infrastructure.csproj similarity index 94% rename from source/Jambo.Producer.Infrastructure/Jambo.Producer.Infrastructure.csproj rename to source/Producer/Jambo.Producer.Infrastructure/Jambo.Producer.Infrastructure.csproj index 2cd8ce2..159fac9 100644 --- a/source/Jambo.Producer.Infrastructure/Jambo.Producer.Infrastructure.csproj +++ b/source/Producer/Jambo.Producer.Infrastructure/Jambo.Producer.Infrastructure.csproj @@ -19,7 +19,7 @@ - + diff --git a/source/Jambo.Producer.Infrastructure/Modules/ApplicationModule.cs b/source/Producer/Jambo.Producer.Infrastructure/Modules/ApplicationModule.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/Modules/ApplicationModule.cs rename to source/Producer/Jambo.Producer.Infrastructure/Modules/ApplicationModule.cs diff --git a/source/Jambo.Producer.Infrastructure/Modules/BusModule.cs b/source/Producer/Jambo.Producer.Infrastructure/Modules/BusModule.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/Modules/BusModule.cs rename to source/Producer/Jambo.Producer.Infrastructure/Modules/BusModule.cs diff --git a/source/Jambo.Producer.Infrastructure/Modules/MediatRModule.cs b/source/Producer/Jambo.Producer.Infrastructure/Modules/MediatRModule.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/Modules/MediatRModule.cs rename to source/Producer/Jambo.Producer.Infrastructure/Modules/MediatRModule.cs diff --git a/source/Jambo.Producer.Infrastructure/Modules/QueriesModule.cs b/source/Producer/Jambo.Producer.Infrastructure/Modules/QueriesModule.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/Modules/QueriesModule.cs rename to source/Producer/Jambo.Producer.Infrastructure/Modules/QueriesModule.cs diff --git a/source/Jambo.Producer.Infrastructure/Properties/launchSettings.json b/source/Producer/Jambo.Producer.Infrastructure/Properties/launchSettings.json similarity index 100% rename from source/Jambo.Producer.Infrastructure/Properties/launchSettings.json rename to source/Producer/Jambo.Producer.Infrastructure/Properties/launchSettings.json diff --git a/source/Jambo.Producer.Infrastructure/Queries/BlogQueries.cs b/source/Producer/Jambo.Producer.Infrastructure/Queries/BlogQueries.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/Queries/BlogQueries.cs rename to source/Producer/Jambo.Producer.Infrastructure/Queries/BlogQueries.cs diff --git a/source/Jambo.Producer.Infrastructure/Queries/PostQueries.cs b/source/Producer/Jambo.Producer.Infrastructure/Queries/PostQueries.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/Queries/PostQueries.cs rename to source/Producer/Jambo.Producer.Infrastructure/Queries/PostQueries.cs diff --git a/source/Jambo.Producer.Infrastructure/ServiceBus/Bus.cs b/source/Producer/Jambo.Producer.Infrastructure/ServiceBus/Bus.cs similarity index 100% rename from source/Jambo.Producer.Infrastructure/ServiceBus/Bus.cs rename to source/Producer/Jambo.Producer.Infrastructure/ServiceBus/Bus.cs diff --git a/source/Jambo.Producer.UI/.dockerignore b/source/Producer/Jambo.Producer.UI/.dockerignore similarity index 100% rename from source/Jambo.Producer.UI/.dockerignore rename to source/Producer/Jambo.Producer.UI/.dockerignore diff --git a/source/Jambo.Producer.UI/Controllers/BlogsController.cs b/source/Producer/Jambo.Producer.UI/Controllers/BlogsController.cs similarity index 100% rename from source/Jambo.Producer.UI/Controllers/BlogsController.cs rename to source/Producer/Jambo.Producer.UI/Controllers/BlogsController.cs diff --git a/source/Jambo.Producer.UI/Controllers/PostsController.cs b/source/Producer/Jambo.Producer.UI/Controllers/PostsController.cs similarity index 100% rename from source/Jambo.Producer.UI/Controllers/PostsController.cs rename to source/Producer/Jambo.Producer.UI/Controllers/PostsController.cs diff --git a/source/Jambo.Producer.UI/Dockerfile b/source/Producer/Jambo.Producer.UI/Dockerfile similarity index 100% rename from source/Jambo.Producer.UI/Dockerfile rename to source/Producer/Jambo.Producer.UI/Dockerfile diff --git a/source/Jambo.Producer.UI/Filters/CorrelationFilter.cs b/source/Producer/Jambo.Producer.UI/Filters/CorrelationFilter.cs similarity index 100% rename from source/Jambo.Producer.UI/Filters/CorrelationFilter.cs rename to source/Producer/Jambo.Producer.UI/Filters/CorrelationFilter.cs diff --git a/source/Jambo.Producer.UI/Filters/DomainExceptionFilter.cs b/source/Producer/Jambo.Producer.UI/Filters/DomainExceptionFilter.cs similarity index 100% rename from source/Jambo.Producer.UI/Filters/DomainExceptionFilter.cs rename to source/Producer/Jambo.Producer.UI/Filters/DomainExceptionFilter.cs diff --git a/source/Jambo.Producer.UI/Filters/ValidateModelAttribute.cs b/source/Producer/Jambo.Producer.UI/Filters/ValidateModelAttribute.cs similarity index 100% rename from source/Jambo.Producer.UI/Filters/ValidateModelAttribute.cs rename to source/Producer/Jambo.Producer.UI/Filters/ValidateModelAttribute.cs diff --git a/source/Jambo.Producer.UI/Jambo.Producer.UI.csproj b/source/Producer/Jambo.Producer.UI/Jambo.Producer.UI.csproj similarity index 93% rename from source/Jambo.Producer.UI/Jambo.Producer.UI.csproj rename to source/Producer/Jambo.Producer.UI/Jambo.Producer.UI.csproj index 00e0866..c520cdb 100644 --- a/source/Jambo.Producer.UI/Jambo.Producer.UI.csproj +++ b/source/Producer/Jambo.Producer.UI/Jambo.Producer.UI.csproj @@ -22,7 +22,7 @@ - + diff --git a/source/Jambo.Producer.UI/Program.cs b/source/Producer/Jambo.Producer.UI/Program.cs similarity index 100% rename from source/Jambo.Producer.UI/Program.cs rename to source/Producer/Jambo.Producer.UI/Program.cs diff --git a/source/Jambo.Producer.UI/Properties/launchSettings.json b/source/Producer/Jambo.Producer.UI/Properties/launchSettings.json similarity index 100% rename from source/Jambo.Producer.UI/Properties/launchSettings.json rename to source/Producer/Jambo.Producer.UI/Properties/launchSettings.json diff --git a/source/Jambo.Producer.UI/Startup.cs b/source/Producer/Jambo.Producer.UI/Startup.cs similarity index 100% rename from source/Jambo.Producer.UI/Startup.cs rename to source/Producer/Jambo.Producer.UI/Startup.cs diff --git a/source/Jambo.Producer.UI/appsettings.Development.json b/source/Producer/Jambo.Producer.UI/appsettings.Development.json similarity index 100% rename from source/Jambo.Producer.UI/appsettings.Development.json rename to source/Producer/Jambo.Producer.UI/appsettings.Development.json diff --git a/source/Jambo.Producer.UI/appsettings.json b/source/Producer/Jambo.Producer.UI/appsettings.json similarity index 100% rename from source/Jambo.Producer.UI/appsettings.json rename to source/Producer/Jambo.Producer.UI/appsettings.json diff --git a/source/Jambo.Producer.UI/autofac.Development.json b/source/Producer/Jambo.Producer.UI/autofac.Development.json similarity index 100% rename from source/Jambo.Producer.UI/autofac.Development.json rename to source/Producer/Jambo.Producer.UI/autofac.Development.json diff --git a/source/Jambo.Producer.UI/autofac.json b/source/Producer/Jambo.Producer.UI/autofac.json similarity index 100% rename from source/Jambo.Producer.UI/autofac.json rename to source/Producer/Jambo.Producer.UI/autofac.json diff --git a/source/Jambo.Producer.sln b/source/Producer/Jambo.Producer.sln similarity index 77% rename from source/Jambo.Producer.sln rename to source/Producer/Jambo.Producer.sln index 540d22a..276d737 100644 --- a/source/Jambo.Producer.sln +++ b/source/Producer/Jambo.Producer.sln @@ -3,34 +3,26 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26730.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Domain", "Jambo.Domain\Jambo.Domain.csproj", "{ED9F252F-10E5-4A65-ADA0-122D61D655A4}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Producer.Application", "Jambo.Producer.Application\Jambo.Producer.Application.csproj", "{9E73933B-2008-4D46-A92C-CC8D79A53CF7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Domain.UnitTests", "Jambo.Domain.UnitTests\Jambo.Domain.UnitTests.csproj", "{B59AD81D-93F9-425F-8F87-DF13561BE424}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Producer.Infrastructure", "Jambo.Producer.Infrastructure\Jambo.Producer.Infrastructure.csproj", "{6327FB91-C89F-4C49-A14D-C7CA4D36CF04}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Producer.UI", "Jambo.Producer.UI\Jambo.Producer.UI.csproj", "{2A775BCB-3811-48E6-B617-0CB1DC5EFF14}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Domain", "..\Shared\Jambo.Domain\Jambo.Domain.csproj", "{B681C2D0-54E4-48C9-9FBB-7493A1C2951F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jambo.Domain.UnitTests", "..\Shared\Jambo.Domain.UnitTests\Jambo.Domain.UnitTests.csproj", "{CB0F403C-B080-46FE-AEA4-3CB140F1C5AB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {ED9F252F-10E5-4A65-ADA0-122D61D655A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED9F252F-10E5-4A65-ADA0-122D61D655A4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED9F252F-10E5-4A65-ADA0-122D61D655A4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED9F252F-10E5-4A65-ADA0-122D61D655A4}.Release|Any CPU.Build.0 = Release|Any CPU {9E73933B-2008-4D46-A92C-CC8D79A53CF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9E73933B-2008-4D46-A92C-CC8D79A53CF7}.Debug|Any CPU.Build.0 = Debug|Any CPU {9E73933B-2008-4D46-A92C-CC8D79A53CF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E73933B-2008-4D46-A92C-CC8D79A53CF7}.Release|Any CPU.Build.0 = Release|Any CPU - {B59AD81D-93F9-425F-8F87-DF13561BE424}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B59AD81D-93F9-425F-8F87-DF13561BE424}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B59AD81D-93F9-425F-8F87-DF13561BE424}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B59AD81D-93F9-425F-8F87-DF13561BE424}.Release|Any CPU.Build.0 = Release|Any CPU {6327FB91-C89F-4C49-A14D-C7CA4D36CF04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6327FB91-C89F-4C49-A14D-C7CA4D36CF04}.Debug|Any CPU.Build.0 = Debug|Any CPU {6327FB91-C89F-4C49-A14D-C7CA4D36CF04}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -39,6 +31,14 @@ Global {2A775BCB-3811-48E6-B617-0CB1DC5EFF14}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A775BCB-3811-48E6-B617-0CB1DC5EFF14}.Release|Any CPU.ActiveCfg = Release|Any CPU {2A775BCB-3811-48E6-B617-0CB1DC5EFF14}.Release|Any CPU.Build.0 = Release|Any CPU + {B681C2D0-54E4-48C9-9FBB-7493A1C2951F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B681C2D0-54E4-48C9-9FBB-7493A1C2951F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B681C2D0-54E4-48C9-9FBB-7493A1C2951F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B681C2D0-54E4-48C9-9FBB-7493A1C2951F}.Release|Any CPU.Build.0 = Release|Any CPU + {CB0F403C-B080-46FE-AEA4-3CB140F1C5AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB0F403C-B080-46FE-AEA4-3CB140F1C5AB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB0F403C-B080-46FE-AEA4-3CB140F1C5AB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB0F403C-B080-46FE-AEA4-3CB140F1C5AB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/source/Setup/kafka-mongo-down.sh b/source/Setup/kafka-mongo-down.sh deleted file mode 100644 index 58694d0..0000000 --- a/source/Setup/kafka-mongo-down.sh +++ /dev/null @@ -1 +0,0 @@ -docker-compose down \ No newline at end of file diff --git a/source/Setup/kafka-mongo-up.sh b/source/Setup/kafka-mongo-up.sh deleted file mode 100644 index 5177d11..0000000 --- a/source/Setup/kafka-mongo-up.sh +++ /dev/null @@ -1 +0,0 @@ -docker-compose up -d \ No newline at end of file diff --git a/source/Jambo.Domain.UnitTests/Jambo.Domain.UnitTests.csproj b/source/Shared/Jambo.Domain.UnitTests/Jambo.Domain.UnitTests.csproj similarity index 100% rename from source/Jambo.Domain.UnitTests/Jambo.Domain.UnitTests.csproj rename to source/Shared/Jambo.Domain.UnitTests/Jambo.Domain.UnitTests.csproj diff --git a/source/Jambo.Domain.UnitTests/UnitTest1.cs b/source/Shared/Jambo.Domain.UnitTests/UnitTest1.cs similarity index 100% rename from source/Jambo.Domain.UnitTests/UnitTest1.cs rename to source/Shared/Jambo.Domain.UnitTests/UnitTest1.cs diff --git a/source/Jambo.Domain/Exceptions/DomainException.cs b/source/Shared/Jambo.Domain/Exceptions/DomainException.cs similarity index 100% rename from source/Jambo.Domain/Exceptions/DomainException.cs rename to source/Shared/Jambo.Domain/Exceptions/DomainException.cs diff --git a/source/Jambo.Domain/Exceptions/JamboException.cs b/source/Shared/Jambo.Domain/Exceptions/JamboException.cs similarity index 73% rename from source/Jambo.Domain/Exceptions/JamboException.cs rename to source/Shared/Jambo.Domain/Exceptions/JamboException.cs index 71f42af..ef9c22b 100644 --- a/source/Jambo.Domain/Exceptions/JamboException.cs +++ b/source/Shared/Jambo.Domain/Exceptions/JamboException.cs @@ -1,9 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Jambo.Domain.Exceptions +namespace Jambo.Domain.Exceptions { + using System; + using System.Collections.Generic; + using System.Text; + public class JamboException : Exception { public JamboException() diff --git a/source/Jambo.Domain/Exceptions/TransactionConflictException.cs b/source/Shared/Jambo.Domain/Exceptions/TransactionConflictException.cs similarity index 86% rename from source/Jambo.Domain/Exceptions/TransactionConflictException.cs rename to source/Shared/Jambo.Domain/Exceptions/TransactionConflictException.cs index d9c4bd1..74bbb96 100644 --- a/source/Jambo.Domain/Exceptions/TransactionConflictException.cs +++ b/source/Shared/Jambo.Domain/Exceptions/TransactionConflictException.cs @@ -1,7 +1,7 @@ -using Jambo.Domain.Model; - -namespace Jambo.Domain.Exceptions +namespace Jambo.Domain.Exceptions { + using Jambo.Domain.Model; + public class TransactionConflictException : JamboException { public AggregateRoot AggregateRoot { get; private set; } diff --git a/source/Jambo.Domain/Jambo.Domain.csproj b/source/Shared/Jambo.Domain/Jambo.Domain.csproj similarity index 100% rename from source/Jambo.Domain/Jambo.Domain.csproj rename to source/Shared/Jambo.Domain/Jambo.Domain.csproj diff --git a/source/Jambo.Domain/Model/AggregateRoot.cs b/source/Shared/Jambo.Domain/Model/AggregateRoot.cs similarity index 91% rename from source/Jambo.Domain/Model/AggregateRoot.cs rename to source/Shared/Jambo.Domain/Model/AggregateRoot.cs index 9f85f53..7bf5538 100644 --- a/source/Jambo.Domain/Model/AggregateRoot.cs +++ b/source/Shared/Jambo.Domain/Model/AggregateRoot.cs @@ -1,8 +1,8 @@ -using System; -using System.Collections.Generic; - -namespace Jambo.Domain.Model +namespace Jambo.Domain.Model { + using System; + using System.Collections.Generic; + public abstract class AggregateRoot : Entity { private readonly Dictionary> handlers = new Dictionary>(); diff --git a/source/Jambo.Domain/Model/Blogs/Blog.cs b/source/Shared/Jambo.Domain/Model/Blogs/Blog.cs similarity index 92% rename from source/Jambo.Domain/Model/Blogs/Blog.cs rename to source/Shared/Jambo.Domain/Model/Blogs/Blog.cs index 9e33115..85f9363 100644 --- a/source/Jambo.Domain/Model/Blogs/Blog.cs +++ b/source/Shared/Jambo.Domain/Model/Blogs/Blog.cs @@ -1,9 +1,9 @@ -using Jambo.Domain.Model.Blogs.Events; -using Jambo.Domain.Model.Posts.Events; -using Jambo.Domain.Exceptions; - -namespace Jambo.Domain.Model.Blogs +namespace Jambo.Domain.Model.Blogs { + using Jambo.Domain.Model.Blogs.Events; + using Jambo.Domain.Model.Posts.Events; + using Jambo.Domain.Exceptions; + public class Blog : AggregateRoot { private Url url; diff --git a/source/Jambo.Domain/Model/Blogs/Events/BlogCreatedDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Blogs/Events/BlogCreatedDomainEvent.cs similarity index 91% rename from source/Jambo.Domain/Model/Blogs/Events/BlogCreatedDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Blogs/Events/BlogCreatedDomainEvent.cs index 9fcbf6e..5fb341d 100644 --- a/source/Jambo.Domain/Model/Blogs/Events/BlogCreatedDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/Blogs/Events/BlogCreatedDomainEvent.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model.Blogs.Events +namespace Jambo.Domain.Model.Blogs.Events { + using System; + public class BlogCreatedDomainEvent : DomainEvent { public BlogCreatedDomainEvent(Guid aggregateRootId, int version, diff --git a/source/Jambo.Domain/Model/Blogs/Events/BlogDisabledDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Blogs/Events/BlogDisabledDomainEvent.cs similarity index 91% rename from source/Jambo.Domain/Model/Blogs/Events/BlogDisabledDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Blogs/Events/BlogDisabledDomainEvent.cs index 01b0d36..6bc91f3 100644 --- a/source/Jambo.Domain/Model/Blogs/Events/BlogDisabledDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/Blogs/Events/BlogDisabledDomainEvent.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model.Blogs.Events +namespace Jambo.Domain.Model.Blogs.Events { + using System; + public class BlogDisabledDomainEvent : DomainEvent { public BlogDisabledDomainEvent(Guid aggregateRootId, int version, diff --git a/source/Jambo.Domain/Model/Blogs/Events/BlogEnabledDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Blogs/Events/BlogEnabledDomainEvent.cs similarity index 100% rename from source/Jambo.Domain/Model/Blogs/Events/BlogEnabledDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Blogs/Events/BlogEnabledDomainEvent.cs diff --git a/source/Jambo.Domain/Model/Blogs/Events/BlogUrlUpdatedDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Blogs/Events/BlogUrlUpdatedDomainEvent.cs similarity index 91% rename from source/Jambo.Domain/Model/Blogs/Events/BlogUrlUpdatedDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Blogs/Events/BlogUrlUpdatedDomainEvent.cs index c485921..16a71c7 100644 --- a/source/Jambo.Domain/Model/Blogs/Events/BlogUrlUpdatedDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/Blogs/Events/BlogUrlUpdatedDomainEvent.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model.Blogs.Events +namespace Jambo.Domain.Model.Blogs.Events { + using System; + public class BlogUrlUpdatedDomainEvent : DomainEvent { public Url Url { get; private set; } diff --git a/source/Jambo.Domain/Model/Blogs/IBlogReadOnlyRepository.cs b/source/Shared/Jambo.Domain/Model/Blogs/IBlogReadOnlyRepository.cs similarity index 53% rename from source/Jambo.Domain/Model/Blogs/IBlogReadOnlyRepository.cs rename to source/Shared/Jambo.Domain/Model/Blogs/IBlogReadOnlyRepository.cs index d005246..a5dbea4 100644 --- a/source/Jambo.Domain/Model/Blogs/IBlogReadOnlyRepository.cs +++ b/source/Shared/Jambo.Domain/Model/Blogs/IBlogReadOnlyRepository.cs @@ -1,9 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Jambo.Domain.Model.Blogs +namespace Jambo.Domain.Model.Blogs { + using System; + using System.Collections.Generic; + using System.Threading.Tasks; + public interface IBlogReadOnlyRepository { Task> GetAllBlogs(); diff --git a/source/Jambo.Domain/Model/Blogs/IBlogWriteOnlyRepository.cs b/source/Shared/Jambo.Domain/Model/Blogs/IBlogWriteOnlyRepository.cs similarity index 64% rename from source/Jambo.Domain/Model/Blogs/IBlogWriteOnlyRepository.cs rename to source/Shared/Jambo.Domain/Model/Blogs/IBlogWriteOnlyRepository.cs index cca590f..90fd5bc 100644 --- a/source/Jambo.Domain/Model/Blogs/IBlogWriteOnlyRepository.cs +++ b/source/Shared/Jambo.Domain/Model/Blogs/IBlogWriteOnlyRepository.cs @@ -1,7 +1,7 @@ -using System.Threading.Tasks; - -namespace Jambo.Domain.Model.Blogs +namespace Jambo.Domain.Model.Blogs { + using System.Threading.Tasks; + public interface IBlogWriteOnlyRepository { Task AddBlog(Blog blog); diff --git a/source/Jambo.Domain/Model/Blogs/Url.cs b/source/Shared/Jambo.Domain/Model/Blogs/Url.cs similarity index 81% rename from source/Jambo.Domain/Model/Blogs/Url.cs rename to source/Shared/Jambo.Domain/Model/Blogs/Url.cs index 58ae6ad..6f59b7a 100644 --- a/source/Jambo.Domain/Model/Blogs/Url.cs +++ b/source/Shared/Jambo.Domain/Model/Blogs/Url.cs @@ -1,8 +1,8 @@ -using Jambo.Domain.Exceptions; -using System.Runtime.Serialization; - -namespace Jambo.Domain.Model.Blogs +namespace Jambo.Domain.Model.Blogs { + using Jambo.Domain.Exceptions; + using System.Runtime.Serialization; + public class Url { public string Text { get; private set; } diff --git a/source/Jambo.Domain/Model/DomainEvent.cs b/source/Shared/Jambo.Domain/Model/DomainEvent.cs similarity index 90% rename from source/Jambo.Domain/Model/DomainEvent.cs rename to source/Shared/Jambo.Domain/Model/DomainEvent.cs index 562a590..de2a953 100644 --- a/source/Jambo.Domain/Model/DomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/DomainEvent.cs @@ -1,9 +1,9 @@ -using Jambo.Domain.Model; -using MediatR; -using System; - -namespace Jambo.Domain.Model +namespace Jambo.Domain.Model { + using Jambo.Domain.Model; + using MediatR; + using System; + public class DomainEvent : IDomainEvent { public Guid AggregateRootId { get; private set; } diff --git a/source/Jambo.Domain/Model/Entity.cs b/source/Shared/Jambo.Domain/Model/Entity.cs similarity index 64% rename from source/Jambo.Domain/Model/Entity.cs rename to source/Shared/Jambo.Domain/Model/Entity.cs index b321610..6c334a2 100644 --- a/source/Jambo.Domain/Model/Entity.cs +++ b/source/Shared/Jambo.Domain/Model/Entity.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Jambo.Domain.Model +namespace Jambo.Domain.Model { + using System; + public class Entity : IEntity { public Guid Id { get; protected set; } diff --git a/source/Jambo.Domain/Model/Header.cs b/source/Shared/Jambo.Domain/Model/Header.cs similarity index 76% rename from source/Jambo.Domain/Model/Header.cs rename to source/Shared/Jambo.Domain/Model/Header.cs index a5ac337..2a58c18 100644 --- a/source/Jambo.Domain/Model/Header.cs +++ b/source/Shared/Jambo.Domain/Model/Header.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Jambo.Domain.Model +namespace Jambo.Domain.Model { + using System; + public class Header { public Guid CorrelationId { get; private set; } diff --git a/source/Jambo.Domain/Model/IDomainEvent.cs b/source/Shared/Jambo.Domain/Model/IDomainEvent.cs similarity index 54% rename from source/Jambo.Domain/Model/IDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/IDomainEvent.cs index 1c68af9..a6917d3 100644 --- a/source/Jambo.Domain/Model/IDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/IDomainEvent.cs @@ -1,7 +1,7 @@ -using MediatR; - -namespace Jambo.Domain.Model +namespace Jambo.Domain.Model { + using MediatR; + public interface IDomainEvent : IRequest { } diff --git a/source/Jambo.Domain/Model/IEntity.cs b/source/Shared/Jambo.Domain/Model/IEntity.cs similarity index 58% rename from source/Jambo.Domain/Model/IEntity.cs rename to source/Shared/Jambo.Domain/Model/IEntity.cs index d109324..7f625e3 100644 --- a/source/Jambo.Domain/Model/IEntity.cs +++ b/source/Shared/Jambo.Domain/Model/IEntity.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model +namespace Jambo.Domain.Model { + using System; + public interface IEntity { Guid Id { get; } diff --git a/source/Jambo.Domain/Model/Posts/Comment.cs b/source/Shared/Jambo.Domain/Model/Posts/Comment.cs similarity index 76% rename from source/Jambo.Domain/Model/Posts/Comment.cs rename to source/Shared/Jambo.Domain/Model/Posts/Comment.cs index 96f08ab..e31fadb 100644 --- a/source/Jambo.Domain/Model/Posts/Comment.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Comment.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Jambo.Domain.Model.Posts -{ +namespace Jambo.Domain.Model.Posts +{ public class Comment : Entity { private Content message; diff --git a/source/Jambo.Domain/Model/Posts/Content.cs b/source/Shared/Jambo.Domain/Model/Posts/Content.cs similarity index 79% rename from source/Jambo.Domain/Model/Posts/Content.cs rename to source/Shared/Jambo.Domain/Model/Posts/Content.cs index e7a3825..cd20899 100644 --- a/source/Jambo.Domain/Model/Posts/Content.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Content.cs @@ -1,10 +1,7 @@ -using Jambo.Domain.Exceptions; -using System; -using System.Collections.Generic; -using System.Text; - -namespace Jambo.Domain.Model.Posts +namespace Jambo.Domain.Model.Posts { + using Jambo.Domain.Exceptions; + public class Content { public string Text { get; private set; } diff --git a/source/Jambo.Domain/Model/Posts/Events/CommentCreatedDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Posts/Events/CommentCreatedDomainEvent.cs similarity index 93% rename from source/Jambo.Domain/Model/Posts/Events/CommentCreatedDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Posts/Events/CommentCreatedDomainEvent.cs index 1485144..2581311 100644 --- a/source/Jambo.Domain/Model/Posts/Events/CommentCreatedDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Events/CommentCreatedDomainEvent.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model.Posts.Events +namespace Jambo.Domain.Model.Posts.Events { + using System; + public class CommentCreatedDomainEvent : DomainEvent { public Guid CommentId { get; private set; } diff --git a/source/Jambo.Domain/Model/Posts/Events/PostContentUpdatedDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Posts/Events/PostContentUpdatedDomainEvent.cs similarity index 93% rename from source/Jambo.Domain/Model/Posts/Events/PostContentUpdatedDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Posts/Events/PostContentUpdatedDomainEvent.cs index ebf931c..69ce2b1 100644 --- a/source/Jambo.Domain/Model/Posts/Events/PostContentUpdatedDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Events/PostContentUpdatedDomainEvent.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model.Posts.Events +namespace Jambo.Domain.Model.Posts.Events { + using System; + public class PostContentUpdatedDomainEvent : DomainEvent { public Title Title { get; private set; } diff --git a/source/Shared/Jambo.Domain/Model/Posts/Events/PostCreatedDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Posts/Events/PostCreatedDomainEvent.cs new file mode 100644 index 0000000..05805f5 --- /dev/null +++ b/source/Shared/Jambo.Domain/Model/Posts/Events/PostCreatedDomainEvent.cs @@ -0,0 +1,30 @@ +namespace Jambo.Domain.Model.Posts.Events +{ + using System; + + public class PostCreatedDomainEvent : DomainEvent + { + public Guid BlogId { get; private set; } + public int BlogVersion { get; private set; } + + public PostCreatedDomainEvent(Guid aggregateRootId, int version, + DateTime createdDate, Header header, Guid blogId, int blogVersion) + : base(aggregateRootId, version, createdDate, header) + { + BlogId = blogId; + BlogVersion = blogVersion; + } + + public static PostCreatedDomainEvent Create(AggregateRoot aggregateRoot, + Guid blogId, int blogVersion) + { + if (aggregateRoot == null) + throw new ArgumentNullException("aggregateRoot"); + + PostCreatedDomainEvent domainEvent = new PostCreatedDomainEvent( + aggregateRoot.Id, aggregateRoot.Version, DateTime.UtcNow, null, blogId, blogVersion); + + return domainEvent; + } + } +} diff --git a/source/Jambo.Domain/Model/Posts/Events/PostDisabledDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Posts/Events/PostDisabledDomainEvent.cs similarity index 91% rename from source/Jambo.Domain/Model/Posts/Events/PostDisabledDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Posts/Events/PostDisabledDomainEvent.cs index 89294a7..052cdf6 100644 --- a/source/Jambo.Domain/Model/Posts/Events/PostDisabledDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Events/PostDisabledDomainEvent.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model.Posts.Events +namespace Jambo.Domain.Model.Posts.Events { + using System; + public class PostDisabledDomainEvent : DomainEvent { public PostDisabledDomainEvent(Guid aggregateRootId, int version, diff --git a/source/Jambo.Domain/Model/Posts/Events/PostEnabledDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Posts/Events/PostEnabledDomainEvent.cs similarity index 91% rename from source/Jambo.Domain/Model/Posts/Events/PostEnabledDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Posts/Events/PostEnabledDomainEvent.cs index c12b894..a8ff015 100644 --- a/source/Jambo.Domain/Model/Posts/Events/PostEnabledDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Events/PostEnabledDomainEvent.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model.Posts.Events +namespace Jambo.Domain.Model.Posts.Events { + using System; + public class PostEnabledDomainEvent : DomainEvent { public PostEnabledDomainEvent(Guid aggregateRootId, int version, diff --git a/source/Jambo.Domain/Model/Posts/Events/PostHiddenDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Posts/Events/PostHiddenDomainEvent.cs similarity index 91% rename from source/Jambo.Domain/Model/Posts/Events/PostHiddenDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Posts/Events/PostHiddenDomainEvent.cs index 389b935..2002131 100644 --- a/source/Jambo.Domain/Model/Posts/Events/PostHiddenDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Events/PostHiddenDomainEvent.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model.Posts.Events +namespace Jambo.Domain.Model.Posts.Events { + using System; + public class PostHiddenDomainEvent : DomainEvent { public PostHiddenDomainEvent(Guid aggregateRootId, int version, diff --git a/source/Jambo.Domain/Model/Posts/Events/PostPublishedDomainEvent.cs b/source/Shared/Jambo.Domain/Model/Posts/Events/PostPublishedDomainEvent.cs similarity index 91% rename from source/Jambo.Domain/Model/Posts/Events/PostPublishedDomainEvent.cs rename to source/Shared/Jambo.Domain/Model/Posts/Events/PostPublishedDomainEvent.cs index 5fc3ded..b353588 100644 --- a/source/Jambo.Domain/Model/Posts/Events/PostPublishedDomainEvent.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Events/PostPublishedDomainEvent.cs @@ -1,7 +1,7 @@ -using System; - -namespace Jambo.Domain.Model.Posts.Events +namespace Jambo.Domain.Model.Posts.Events { + using System; + public class PostPublishedDomainEvent : DomainEvent { public PostPublishedDomainEvent(Guid aggregateRootId, int version, diff --git a/source/Jambo.Domain/Model/Posts/IPostReadOnlyRepository.cs b/source/Shared/Jambo.Domain/Model/Posts/IPostReadOnlyRepository.cs similarity index 55% rename from source/Jambo.Domain/Model/Posts/IPostReadOnlyRepository.cs rename to source/Shared/Jambo.Domain/Model/Posts/IPostReadOnlyRepository.cs index 0b8372a..2a33385 100644 --- a/source/Jambo.Domain/Model/Posts/IPostReadOnlyRepository.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/IPostReadOnlyRepository.cs @@ -1,9 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Jambo.Domain.Model.Posts +namespace Jambo.Domain.Model.Posts { + using System; + using System.Collections.Generic; + using System.Threading.Tasks; + public interface IPostReadOnlyRepository { Task> GetBlogPosts(Guid blogId); diff --git a/source/Jambo.Domain/Model/Posts/IPostWriteOnlyRepository.cs b/source/Shared/Jambo.Domain/Model/Posts/IPostWriteOnlyRepository.cs similarity index 64% rename from source/Jambo.Domain/Model/Posts/IPostWriteOnlyRepository.cs rename to source/Shared/Jambo.Domain/Model/Posts/IPostWriteOnlyRepository.cs index b672b63..9eb2015 100644 --- a/source/Jambo.Domain/Model/Posts/IPostWriteOnlyRepository.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/IPostWriteOnlyRepository.cs @@ -1,7 +1,7 @@ -using System.Threading.Tasks; - -namespace Jambo.Domain.Model.Posts +namespace Jambo.Domain.Model.Posts { + using System.Threading.Tasks; + public interface IPostWriteOnlyRepository { Task AddPost(Post post); diff --git a/source/Jambo.Domain/Model/Posts/Post.cs b/source/Shared/Jambo.Domain/Model/Posts/Post.cs similarity index 96% rename from source/Jambo.Domain/Model/Posts/Post.cs rename to source/Shared/Jambo.Domain/Model/Posts/Post.cs index c744059..0927f9a 100644 --- a/source/Jambo.Domain/Model/Posts/Post.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Post.cs @@ -1,10 +1,10 @@ -using Jambo.Domain.Model.Posts.Events; -using Jambo.Domain.Exceptions; -using System; -using System.Collections.Generic; - -namespace Jambo.Domain.Model.Posts +namespace Jambo.Domain.Model.Posts { + using Jambo.Domain.Model.Posts.Events; + using Jambo.Domain.Exceptions; + using System; + using System.Collections.Generic; + public class Post : AggregateRoot { private Title title; diff --git a/source/Jambo.Domain/Model/Posts/Title.cs b/source/Shared/Jambo.Domain/Model/Posts/Title.cs similarity index 76% rename from source/Jambo.Domain/Model/Posts/Title.cs rename to source/Shared/Jambo.Domain/Model/Posts/Title.cs index 2fafeaf..da34818 100644 --- a/source/Jambo.Domain/Model/Posts/Title.cs +++ b/source/Shared/Jambo.Domain/Model/Posts/Title.cs @@ -1,10 +1,10 @@ -using Jambo.Domain.Exceptions; -using System; -using System.Collections.Generic; -using System.Text; - -namespace Jambo.Domain.Model.Posts +namespace Jambo.Domain.Model.Posts { + using Jambo.Domain.Exceptions; + using System; + using System.Collections.Generic; + using System.Text; + public class Title { public string Text { get; private set; } diff --git a/source/Jambo.Domain/ServiceBus/IPublisher.cs b/source/Shared/Jambo.Domain/ServiceBus/IPublisher.cs similarity index 54% rename from source/Jambo.Domain/ServiceBus/IPublisher.cs rename to source/Shared/Jambo.Domain/ServiceBus/IPublisher.cs index 8284dd2..d5373dd 100644 --- a/source/Jambo.Domain/ServiceBus/IPublisher.cs +++ b/source/Shared/Jambo.Domain/ServiceBus/IPublisher.cs @@ -1,10 +1,10 @@ -using Jambo.Domain.Model; -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Jambo.Domain.ServiceBus +namespace Jambo.Domain.ServiceBus { + using Jambo.Domain.Model; + using System; + using System.Collections.Generic; + using System.Threading.Tasks; + public interface IPublisher : IDisposable { Task Publish(DomainEvent domainEvent); diff --git a/source/Jambo.Domain/ServiceBus/ISubscriber.cs b/source/Shared/Jambo.Domain/ServiceBus/ISubscriber.cs similarity index 58% rename from source/Jambo.Domain/ServiceBus/ISubscriber.cs rename to source/Shared/Jambo.Domain/ServiceBus/ISubscriber.cs index 71baf15..8b57102 100644 --- a/source/Jambo.Domain/ServiceBus/ISubscriber.cs +++ b/source/Shared/Jambo.Domain/ServiceBus/ISubscriber.cs @@ -1,8 +1,8 @@ -using MediatR; -using System; - -namespace Jambo.Domain.ServiceBus +namespace Jambo.Domain.ServiceBus { + using MediatR; + using System; + public interface ISubscriber : IDisposable { void Listen(IMediator mediator);