-
- Challenge 1 - Pokemons
-
- Challenge 2 - Pokemon Favorites
-
- Challenge 3 - Pokemon Details
-
- Folder structuring
-
- Install
-
- Results
- API: https://pokeapi.co
- Given the name of the pokemon return the type by:
- Console - Terminal
- Via Endpoint Http Body Json
- Control exceptions (Pokemon not found, PokeApi is down).
- The input via argument has to continue to work even if the api is down.
- Commits bounded
- One class per file
- Create the classes strictly necessary to avoid duplicating the logic of the use case.
Enable management of a user's favorite pokemon via HTTP endpoint, use cases:
- Create new User (saving on local memory).
- Add pokemons to User.
- Unit testing
Conditions:
- We assume that the user is authenticated and we receive his user_id in the header.
- A user cannot have the same pokemon as favorite more than once.
- We assume that the pokemon ID exists.
- We generate a new Bounded Content User, to encapsulate funcionality in a single domain model.
Use cases:
- AddPokemonToUserFavorite: Requires UserId and PokemonName, verify that user exist to add the pokemon to favorite.
- Create User: Creates a new User from UserId (ValueObject) on local memory if not exist.
- GetPokemonUserFavorite: From a UserId return the list of favorite pokemons if exist.
We want to obtain the details of a pokemon based on an ID via HTTP endpoint: JSON Response:
- ID
- Name
- Types (only names)
Acceptance test and Integration test.
Conditions:
- Catch and drive when pokemon not exist
- Catch and drive when the external API is offline.
- We generate a new Module inside the previous Pokedex Bounded Content, to encapsulate similar funcionality.
Current global project structure:
- Pokedex (BC)
- Pokemons (Module)
- Types (Module)
- Users (BC)
- Users (Module)
-
Boundend context: Objective to divide and isolate domain models.
- Module: Concepts within a bounded context.
- Infraestructura Layer
- Application Layer
- Domain Layer
- Aggregator: Group of domain objects (entities and VOs) that can be treated as a single unit.
- Entities: Unique identity Mutable .
- Domain Services: Encapsulate application behaviors not belonging to any entity. Input and output of domain objects.
- Value Objects: Objects of our application.
- Module: Concepts within a bounded context.
DDD Layers:
- Dotnet is required to build and run the app, you can downloand from official page (we recommend 5.0): https://dotnet.microsoft.com/download/dotnet/5.0
git clone https://github.com/CarLoOSX/mdas-api-g3
cd mdas-api-g3
cd src/main/Pokedex/Context/Pokemons/Types/Infrastructure/Pokemons.Types.CliConsole/
dotnet build Pokemons.Types.CliConsole.csproj
dotnet run charizard
cd mdas-api-g3
cd src/main/Pokedex/Context/Pokemons/Types/Infrastructure/Pokemons.Types.Api
dotnet build Pokemons.Types.Api.csproj
dotnet run Pokemons.Types.Api.csproj --urls="http://localhost:5001"
http://localhost:5001/swagger/index.html
cd mdas-api-g3
cd src/main/Pokedex/Context/Users/Users/Infrastructure/Users.Users.Api
dotnet build Users.Users.Api.csproj
dotnet run Users.Users.Api.csproj --urls="http://localhost:5002"
http://localhost:5002/swagger/index.html
cd mdas-api-g3
dotnet test test/main/Pokedex-test
Note:
- Unitary testing: *.Application.Test y *.Domain.Test
cd mdas-api-g3
cd src/main/Pokedex/Context/Pokemons/Pokemons/Infrastructure/Pokemons.Pokemons.Api
dotnet build Pokemons.Pokemons.Api.csproj
dotnet run Pokemons.Pokemons.Api.csproj --urls="http://localhost:5003"
http://localhost:5003/swagger/index.html
cd mdas-api-g3
dotnet test test/main/Pokedex-test
Note:
- Acceptance test: *.Apit.Test
- Integration test: *.Persistence.Test
Note:
- Acceptance test: *.Api.Test
- Integration test: *.Persistence.Test
- Unitary testing: *.Application.Test y *.Domain.Test