Skip to content

Commit

Permalink
Merge pull request #207 from AntonioFalcao/release
Browse files Browse the repository at this point in the history
Updating
  • Loading branch information
AntonioFalcaoJr authored Apr 30, 2021
2 parents 36a7628 + 891a339 commit ac74d56
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 46 deletions.
Binary file added .assets/img/diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 21 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,37 @@
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (webAPI)",
"name": "WebAPI",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Dotnet5.GraphQL3.Store.WebAPI/bin/Debug/net5.0/Dotnet5.GraphQL3.Store.WebAPI.dll",
"program": "${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebAPI/bin/Debug/net6.0/Dotnet6.GraphQL4.Store.WebAPI.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Dotnet5.GraphQL3.Store.WebAPI",
"cwd": "${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebAPI",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
"pattern": "\\bNow listening on:\\s+(https?://\\S+)",
"uriFormat": "%s/ui/playground"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
},
"launchBrowser": {
"enabled": true
}
},
{
"name": ".NET Core Launch (webMVC)",
"name": "WebMVC",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/Dotnet5.GraphQL3.Store.WebMVC/bin/Debug/net5.0/Dotnet5.GraphQL3.Store.WebMVC.dll",
"program": "${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebMVC/bin/Debug/net6.0/Dotnet6.GraphQL4.Store.WebMVC.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Dotnet5.GraphQL3.Store.WebMVC",
"cwd": "${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebMVC",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
Expand All @@ -39,13 +43,18 @@
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
},
"launchBrowser": {
"enabled": true
}
},
}
],
"compounds": [
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
"name": "WebAPI/WebMVC",
"configurations": ["WebAPI", "WebMVC"],
"preLaunchTask": "${defaultBuildTask}",
"stopAll": true
}
]
}
43 changes: 40 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/Dotnet5.GraphQL3.Store.WebAPI/Dotnet5.GraphQL3.Store.WebAPI.csproj",
"${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebAPI/Dotnet6.GraphQL4.Store.WebAPI.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/Dotnet5.GraphQL3.Store.WebAPI/Dotnet5.GraphQL3.Store.WebAPI.csproj",
"${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebAPI/Dotnet6.GraphQL4.Store.WebAPI.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -32,7 +32,44 @@
"args": [
"watch",
"run",
"${workspaceFolder}/src/Dotnet5.GraphQL3.Store.WebAPI/Dotnet5.GraphQL3.Store.WebAPI.csproj",
"${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebAPI/Dotnet6.GraphQL4.Store.WebAPI.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebMVC/Dotnet6.GraphQL4.Store.WebMVC.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebMVC/Dotnet6.GraphQL4.Store.WebMVC.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/src/Dotnet6.GraphQL4.Store.WebMVC/Dotnet6.GraphQL4.Store.WebMVC.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand Down
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
<Microsoft_HealthChecks_EntityFrameworkCore_Version>6.0.0-preview.3.21201.13</Microsoft_HealthChecks_EntityFrameworkCore_Version>

<!--GraphQL-->
<GraphQL_Server_Version>5.0.1</GraphQL_Server_Version>
<GraphQL_Server_Version>5.0.2</GraphQL_Server_Version>
<GraphQL_Client_Version>3.2.3</GraphQL_Client_Version>
<GraphQL_Version>4.3.0</GraphQL_Version>
<GraphQL_Version>4.5.0</GraphQL_Version>

<!--AutoMapper-->
<AutoMapper_DependencyInjection_Version>8.1.1</AutoMapper_DependencyInjection_Version>
Expand All @@ -31,7 +31,7 @@
<HealthChecks_Version>5.0.1</HealthChecks_Version>

<!--Others-->
<FluentValidation_Version>10.0.4</FluentValidation_Version>
<FluentValidation_Version>10.1.0</FluentValidation_Version>
<Scrutor_Version>3.3.0</Scrutor_Version>

</PropertyGroup>
Expand Down
42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ This project exemplifies the implementation and **dockerization** of a simple Ra

---

![diagram](./.assets/img/diagram.png)

---

## Running

### Development (secrets)
Expand Down Expand Up @@ -171,27 +175,29 @@ networks:
```
### GraphQL Playground
By default **Playground** respond at `http://localhost:5000/ui/playground` but is possible configure the host and many others details in [`../....WebAPI/Graphs/Extensions/DependencyInjection/ApplicationBuilderExtensions.cs`](./src/Dotnet6.GraphQL4.Store.WebAPI/Graphs/Extensions/DependencyInjection/ApplicationBuilderExtensions.cs)
By default **Playground** respond at `http://localhost:5000/ui/playground` but is possible configure the host and many others details in [`../DependencyInjection/Extensions/ApplicationBuilderExtensions.cs`](./src/Dotnet6.GraphQL4.Store.WebAPI/DependencyInjection/Extensions/ApplicationBuilderExtensions.cs)

```c#
app.UseGraphQLPlayground(
new GraphQLPlaygroundOptions
{
Path = "/ui/playground",
BetaUpdates = true,
RequestCredentials = RequestCredentials.Omit,
HideTracingResponse = false,
EditorCursorShape = EditorCursorShape.Line,
EditorTheme = EditorTheme.Dark,
EditorFontSize = 14,
EditorReuseHeaders = true,
EditorFontFamily = "JetBrains Mono"
});
options: new()
{
BetaUpdates = true,
RequestCredentials = RequestCredentials.Omit,
HideTracingResponse = false,
EditorCursorShape = EditorCursorShape.Line,
EditorTheme = EditorTheme.Dark,
EditorFontSize = 14,
EditorReuseHeaders = true,
EditorFontFamily = "JetBrains Mono"
},
path: "/ui/playground");
```

### Health checks

Based on cloud-native concepts, **Readiness** and **Liveness** integrity verification strategies were implemented.
Based on cloud-native concepts, **Readiness** and **Liveness** integrity verification strategies were implemented.

If using [xabarilcoding/healthchecksui](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/doc/ui-docker.md) container image it will responde on `http://localhost:8000/healthchecks-ui/`.

> `/health`
> Just check if the instance is running.
Expand Down Expand Up @@ -248,8 +254,8 @@ The implementation of the `UnitOfWork` gives support to the `ExecutionStrategy`
```c#
public Task<Review> AddReviewAsync(ReviewModel reviewModel, CancellationToken cancellationToken)
{
return UnitOfWork.ExecuteInTransactionAsync(
operationAsync: async ct => // Func<CancellationToken, Task<TResult>>
return UnitOfWork.ExecuteInTransactionScopeAsync(
operationAsync: async ct =>
{
var product = await Repository.GetByIdAsync(
id: reviewModel.ProductId,
Expand All @@ -262,8 +268,8 @@ public Task<Review> AddReviewAsync(ReviewModel reviewModel, CancellationToken ca
await OnEditAsync(product, ct);
return review;
},
condition: _ => NotificationContext.AllValidAsync, // Func<CancellationToken, Task<bool>>
cancellationToken: cancellationToken);
condition: _ => NotificationContext.AllValidAsync,
cancellationToken: cancellationToken);
}
```

Expand Down
1 change: 0 additions & 1 deletion src/Dotnet6.GraphQL4.Store.WebAPI/Graphs/StoreQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public StoreQuery()
.Name("Reviews")
.Argument<GuidGraphType>("productId")
.Resolve()
.WithScope()
.WithService<IProductService>()
.ResolveAsync(
async (context, service) =>
Expand Down
11 changes: 6 additions & 5 deletions src/Dotnet6.GraphQL4.Store.WebAPI/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:46086/",
"sslPort": 44365
"applicationUrl": "http://localhost:5000/"
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"launchBrowser": true,
"launchUrl": "ui/playground",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Dotnet5.GraphQL.Store.WebAPI": {
"commandName": "Project",
"launchBrowser": false,
"applicationUrl": "http://localhost:5000/",
"launchBrowser": true,
"applicationUrl": "http://localhost:5000",
"launchUrl": "ui/playground",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public async Task<IEnumerable<ReviewModel>> GetReviewByProductIdAsync(Guid id, C
{
var request = new GraphQLRequest
{
Query = @"query ReviewsByProductQuery($productId: ID!) {
Query = @"query ReviewsByProductQuery($productId: Guid!) {
reviews(productId: $productId) {
id
title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:48344/",
"sslPort": 44359
"applicationUrl": "http://localhost:7000"
}
},
"profiles": {
Expand All @@ -18,7 +17,7 @@
"Dotnet5.GraphQL.Store.WebMVC": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "http://localhost:7000/",
"applicationUrl": "http://localhost:7000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down

0 comments on commit ac74d56

Please sign in to comment.