-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add product page and refactor code (#16)
- Loading branch information
1 parent
dd7d1a9
commit f097f49
Showing
151 changed files
with
13,161 additions
and
1,128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Developer Guide | ||
|
||
## Install pre-requisites | ||
|
||
- Docker for Desktop installed with Kubernetes is enabled. | ||
- Follow those steps at https://github.com/dapr/cli to install Dapr CLI. | ||
- Follow these steps at https://github.com/dotnet/tye/blob/master/docs/getting_started.md to install `tye` CLI. | ||
- EF Core CLI | ||
|
||
## Building the code | ||
|
||
Clone the source code at https://github.com/thangchung/practical-dapr | ||
|
||
```bash | ||
$ git@github.com:thangchung/practical-dapr.git | ||
``` | ||
|
||
## Development | ||
|
||
- Step 1: Open up `src\Identity\CoolStore.IdentityServer\appsettings.json`, and turn `IsDev` to `true` | ||
- Step 2: Open up `tye.yaml`, and comment out `name: webui` | ||
- Step 3: At root of project, open up terminal and type `tye run`, and we get `IdentityUrl` and `GraphQLUrl` from the `tye dashboard` | ||
- Step 4: Open up `src\WebUI\CoolStore.WebUI.Host\appsettings.json`, and turn `IsDev` to `true`, and replace `IdentityUrl` with the value at Step 3, and also replace `GraphQLUrl` with the value at Step 3. Final step, change `src\WebUI\CoolStore.WebUI.Host\GraphQL\berry.json` with the `GraphQL` endpoint at the Step 3 | ||
- Step 5: Run `CoolStore.WebUI.Host` at the debug mode, then we are ready to develop the `practical-dapr` project. | ||
|
||
### One tye command to rule them all | ||
|
||
```bash | ||
$ tye run | ||
``` | ||
|
||
Then you can see `tye dashboard` as below | ||
|
||
![](assets/tye-dashboard.png) | ||
|
||
### Testing it | ||
|
||
- Go to `webui`, and on `Bindings` column click to `http` link (http://localhost:58275 in the picture) to access to `Blazor Web UI` | ||
- Go to `identity-api`, and on `Bindings` column click to `http` link (http://localhost:58269 in the picture) to access to `Identity Server 4` | ||
- Go to `graph-api`, and on `Bindings` column click to `http` link (http://localhost:58267 in the picture) to access to `GraphQL Api Server` | ||
|
||
#### GraphQL server playground | ||
|
||
On the `graph-api` link above, you will be redirected to GraphQL Playground, and you can play with it as following: | ||
|
||
```js | ||
query { | ||
products( | ||
page: 1 | ||
pageSize: 5 | ||
where: { price_lte: 10000 } | ||
order_by: { price: DESC } | ||
) { | ||
edges { | ||
id | ||
name | ||
imageUrl | ||
price | ||
categoryId | ||
categoryName | ||
inventoryId | ||
inventoryLocation | ||
} | ||
totalCount | ||
} | ||
} | ||
``` | ||
|
||
![](assets/graphql_playground_query_products.png) | ||
|
||
#### Mutation | ||
|
||
```js | ||
mutation createProductMutation($createProductInput: CreateProductInput!) { | ||
createProduct(createProductInput: $createProductInput) { | ||
product { | ||
id | ||
name | ||
} | ||
} | ||
} | ||
``` | ||
|
||
```js | ||
{ | ||
"createProductInput": { | ||
"name": "product 1", | ||
"description": "this is a description", | ||
"imageUrl": "https://picsum.photos/1200/900?image=100", | ||
"price": 100, | ||
"categoryId": "77666AA8-682C-4047-B075-04839281630A", | ||
"inventoryId": "90C9479E-A11C-4D6D-AAAA-0405B6C0EFCD" | ||
} | ||
} | ||
``` | ||
|
||
![](assets/graphql_playground_mutation.png) | ||
|
||
# Communication style | ||
|
||
![](assets/commucation_style.png) | ||
|
||
## Debugging the application | ||
|
||
Follow steps at [Debugging Dapr application using Tye tool](https://dev.to/thangchung/debugging-dapr-application-using-tye-tool-1djb) | ||
|
||
## Setup azure cloud services | ||
|
||
- [Publish docker image to ACR and AKS](https://docs.microsoft.com/en-us/azure/dev-spaces/how-to/github-actions) and [example](https://github.com/Azure/dev-spaces/blob/master/.github/workflows/bikes.yml) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using MediatR; | ||
|
||
namespace N8T.Domain | ||
{ | ||
public interface IDomainEvent : INotification | ||
{ | ||
DateTime CreatedAt { get; } | ||
} | ||
|
||
public interface IDomainEventContext | ||
{ | ||
IEnumerable<DomainEventBase> GetDomainEvents(); | ||
} | ||
|
||
public abstract class DomainEventBase : IDomainEvent | ||
{ | ||
public DateTime CreatedAt { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.