Skip to content

Commit f07cd01

Browse files
Merge pull request #167 from Genocs/ver_900
Ver 900
2 parents 7594f23 + c7cb7df commit f07cd01

File tree

217 files changed

+4019
-1561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+4019
-1561
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</PropertyGroup>
2727

2828
<ItemGroup>
29-
<PackageReference Include="Roslynator.Analyzers" Version="4.12.10">
29+
<PackageReference Include="Roslynator.Analyzers" Version="4.13.1">
3030
<PrivateAssets>all</PrivateAssets>
3131
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3232
</PackageReference>

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
build:
22
dotnet build
33
start:
4-
dotnet run --project ./src/Genocs.TelegramIntegration.WebApi
4+
dotnet run --project ./src/apps/Genocs.TelegramIntegration.WebApi
55
nuget:
66
nuget pack -NoDefaultExcludes -OutputDirectory nupkgs
77
publish:
@@ -23,4 +23,12 @@ fds: # force rededeploy aws ecs service
2323
gw: # git docker workflow to push docker image to the repository based on the main branch
2424
@echo triggering github workflow to push docker image to container
2525
@echo ensure that you have the gh-cli installed and authenticated.
26-
gh workflow run dockerhub-publish -f push_to_docker=true
26+
gh workflow run dockerhub-publish -f push_to_docker=true
27+
28+
d-build: # docker build images
29+
@echo building docker images
30+
@echo you should have docker installed and running
31+
bash ./src/apps/scripts/build-images.sh
32+
d-push: # docker tag and push images
33+
@echo tag images as latest and publish
34+
bash ./src/apps/scripts/push-images.sh

README.md

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ Use [**api-workbench**](./api-workbench.rest) inside Visual Studio code with [RE
289289
"password": "test",
290290
"rawData": ""
291291
},
292-
"issuer": "genocs-identity-service",
293-
"validIssuer": "genocs-identity-service",
292+
"issuer": "genocs-identities-service",
293+
"validIssuer": "genocs-identities-service",
294294
"validateAudience": false,
295295
"validateIssuer": true,
296296
"validateLifetime": true,
@@ -521,35 +521,60 @@ docker builder prune
521521
Following commands are useful to build and push the images one by one
522522

523523
``` bash
524-
cd src/apps
524+
# Build images
525+
./src/apps/scripts/build-images.sh
525526

526-
# Build the api gateway
527-
docker build -t genocs/apigateway:1.0.0 -t genocs/apigateway:latest -f ./apigateway.dockerfile .
527+
# Push images
528+
./src/apps/scripts/push-images.sh
529+
```
530+
531+
### How to deploy the application on Kubernetes
528532

529-
# Build the identity service
530-
docker build -t genocs/identities:1.0.0 -t genocs/identities:latest -f ./identity.dockerfile .
533+
You can deploy the application on Kubernetes cluster.
531534

532-
# Build the order service
533-
docker build -t genocs/orders:1.0.0 -t genocs/orders:latest -f ./containers/order.dockerfile .
535+
``` bash
536+
# Build images
537+
./src/apps/scripts/deploy-k8s.sh
538+
```
534539

535-
# Build the product service
536-
docker build -t genocs/products:1.0.0 -t genocs/products:latest -f ./product.dockerfile .
540+
### How to use makefile
537541

538-
# Build the signalr service
539-
docker build -t genocs/signalr:1.0.0 -t genocs/signalr:latest -f ./signalr.dockerfile .
542+
Prerequisites:
543+
- make
540544

545+
To install make on MacOS you can use brew
541546

542-
# Push on Dockerhub
543-
docker push genocs/apigateway:1.0.0
544-
docker push genocs/apigateway:latest
545-
docker push genocs/identities:1.0.0
546-
docker push genocs/identities:latest
547-
docker push genocs/orders:1.0.0
548-
docker push genocs/orders:latest
549-
docker push genocs/products:1.0.0
550-
docker push genocs/products:latest
551-
docker push genocs/signalr:1.0.0
552-
docker push genocs/signalr:latest
547+
``` bash
548+
brew install make
549+
```
550+
551+
To install make on Ubuntu you can use apt
552+
553+
``` bash
554+
sudo apt install make
555+
```
556+
557+
To install make on Windows you can use [choco](https://chocolatey.org/)
558+
559+
``` bash
560+
choco install make
561+
```
562+
563+
Upon installation you can use the makefile to build, run, deploy the application.
564+
565+
``` bash
566+
# Build the solution
567+
make build
568+
```
569+
570+
571+
### How to use Helm chart
572+
573+
Inside the folder **./src/apps/k8s/helm** you can find the Helm chart to deploy the application on Kubernetes.
574+
575+
``` bash
576+
cd ./src/apps/k8s/helm
577+
microk8s helm install genocs ./gnxchart
553578
```
554579

555580

containers/prometheus/prometheus.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ scrape_configs:
77
static_configs:
88
- targets: ["prometheus:9090"]
99

10-
- job_name: "api-gateway"
10+
- job_name: "apigateway"
1111
static_configs:
12-
- targets: ["api-gateway"]
12+
- targets: ["apigateway"]
1313

14-
- job_name: "identity-service"
14+
- job_name: "identities-service"
1515
static_configs:
16-
- targets: ["identity-service"]
16+
- targets: ["identities-service"]
1717

1818
- job_name: "products-service"
1919
static_configs:
@@ -23,6 +23,6 @@ scrape_configs:
2323
static_configs:
2424
- targets: ["orders-service"]
2525

26-
- job_name: "signalr-service"
26+
- job_name: "notifications-service"
2727
static_configs:
28-
- targets: ["signalr-service"]
28+
- targets: ["notifications-service"]

genocs.sln

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Application", "Application"
120120
src\apps\apigateway.dockerfile = src\apps\apigateway.dockerfile
121121
src\apps\docker-compose.override.yml = src\apps\docker-compose.override.yml
122122
src\apps\docker-compose.yml = src\apps\docker-compose.yml
123-
src\apps\identity.dockerfile = src\apps\identity.dockerfile
123+
src\apps\identities.dockerfile = src\apps\identities.dockerfile
124124
src\apps\local.env = src\apps\local.env
125125
src\apps\notifications.dockerfile = src\apps\notifications.dockerfile
126126
src\apps\orders.dockerfile = src\apps\orders.dockerfile
@@ -133,6 +133,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Genocs.OpenTelemetry", "src
133133
EndProject
134134
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Genocs.Core.Demo.HelloWorld", "src\Genocs.Core.Demo.HelloWorld\Genocs.Core.Demo.HelloWorld.csproj", "{D7C394CF-487D-470D-B05C-CC2DD7EC290B}"
135135
EndProject
136+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Genocs.Persistence.EFCore", "src\Genocs.Persistence.EFCore\Genocs.Persistence.EFCore.csproj", "{69A6FE21-8FB1-4D4D-8C6B-B18C06EFF2CF}"
137+
EndProject
136138
Global
137139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
138140
Debug|Any CPU = Debug|Any CPU
@@ -307,6 +309,10 @@ Global
307309
{D7C394CF-487D-470D-B05C-CC2DD7EC290B}.Debug|Any CPU.Build.0 = Debug|Any CPU
308310
{D7C394CF-487D-470D-B05C-CC2DD7EC290B}.Release|Any CPU.ActiveCfg = Release|Any CPU
309311
{D7C394CF-487D-470D-B05C-CC2DD7EC290B}.Release|Any CPU.Build.0 = Release|Any CPU
312+
{69A6FE21-8FB1-4D4D-8C6B-B18C06EFF2CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
313+
{69A6FE21-8FB1-4D4D-8C6B-B18C06EFF2CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
314+
{69A6FE21-8FB1-4D4D-8C6B-B18C06EFF2CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
315+
{69A6FE21-8FB1-4D4D-8C6B-B18C06EFF2CF}.Release|Any CPU.Build.0 = Release|Any CPU
310316
EndGlobalSection
311317
GlobalSection(SolutionProperties) = preSolution
312318
HideSolutionNode = FALSE

src/Genocs.Auth/Genocs.Auth.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,24 @@
1212
<Authors>Nocco Giovanni Emanuele</Authors>
1313
<PackageTags>authentication jwt genocs microservice microservices solid solid-principles</PackageTags>
1414
<PackageReadmeFile>README_NUGET.md</PackageReadmeFile>
15-
<PackageReleaseNotes>Upgraded to NET9.0</PackageReleaseNotes>
1615
<EnableNETAnalyzers>True</EnableNETAnalyzers>
1716
<AnalysisLevel>latest</AnalysisLevel>
17+
<PackageReleaseNotes>
18+
The change log and breaking changes are listed here.
19+
https://github.com/Genocs/genocs-library/releases
20+
</PackageReleaseNotes>
1821
</PropertyGroup>
1922

2023
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
2124
<ProjectReference Include="..\Genocs.Security\Genocs.Security.csproj" />
2225
</ItemGroup>
2326

2427
<ItemGroup Condition="'$(Configuration)' != 'Debug'">
25-
<PackageReference Include="Genocs.Security" Version="7.2.3" />
28+
<PackageReference Include="Genocs.Security" Version="7.2.*" />
2629
</ItemGroup>
2730

2831
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
29-
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="9.0.*" />
32+
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="9.0.4" />
3033
</ItemGroup>
3134

3235
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">

src/Genocs.Auth/README_NUGET.md

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# .NET Core Auth client library
22

33
This package contains a set of functionalities to handling authorization logic as JWT.
4-
First of all I have to say thanks to devmentors.
54

65
The libraries are built using .NET9, .NET8, .NET7, .NET6.
76

8-
97
## Description
108

119
This package contains a set of functionalities to handling authorization logic as JWT.
@@ -26,60 +24,22 @@ Following are the project settings needed to enable monitoring
2624
"password": "test",
2725
"rawData": ""
2826
},
29-
"issuer": "genocs-identity-service",
30-
"validIssuer": "genocs-identity-service",
27+
"issuer": "genocs-identities-service",
28+
"validIssuer": "genocs-identities-service",
3129
"validateAudience": false,
3230
"validateIssuer": true,
3331
"validateLifetime": true,
3432
"expiry": "01:00:00"
3533
}
3634
```
3735

38-
## Release notes
39-
40-
### [2024-06-15] 6.0.0
41-
- Added support for Azure Key Vault
42-
- Unified settings
43-
44-
### [2024-01-23] 5.0.6
45-
- Refactory Settings
46-
- Updated nuget packages
47-
48-
### [2023-11-25] 5.0.5
49-
- Moved to NET8
50-
51-
### [yyyy-mm-dd] 5.0.4
52-
-
53-
54-
### [yyyy-mm-dd] 5.0.3
55-
-
56-
57-
### [yyyy-mm-dd] 5.0.2
58-
-
59-
60-
### [yyyy-mm-dd] 5.0.1
61-
-
62-
63-
### [2023-11-25] 5.0.0
64-
- Moved to NET8
65-
66-
### [2023-10-13] 5.0.0-preview.5.0
67-
- Added [editorconfig](https://editorconfig.org/)
68-
- Added StyleCop
69-
- Updated logo
70-
- Updated readme
36+
## Support
7137

72-
### [2023-03-12] 5.0.0-preview.4.0
73-
- Implemented MongoDB repository interfaces
38+
Please check the [GitHub repository](https://github.com/Genocs/genocs-library) to get more info.
7439

75-
### [2023-03-24] 5.0.0
76-
- New Architecture
7740

78-
### [2023-03-12] 3.1.0
79-
- Added Builders
41+
## Release notes
8042

81-
### [2023-03-12] 3.0.0
82-
- Refactory to implement CQRS pattern
43+
The change log and breaking changes are listed here.
8344

84-
### [2023-03-04] 2.4.1
85-
- Updated System.Text.Json
45+
- [releases](https://github.com/Genocs/genocs-library/releases)

src/Genocs.Common/Genocs.Common.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77
<AssemblyName>Genocs.Common</AssemblyName>
88
<Title>The Genocs common components.</Title>
99
<Description>The common components to build .NET Core projects along with Genocs Library.</Description>
10+
<Summary>The common components to build .NET Core projects along with Genocs Library.</Summary>
1011
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1112
<MinClientVersion>5.0.0</MinClientVersion>
1213
<Authors>Nocco Giovanni Emanuele</Authors>
1314
<PackageTags>microservice microservices solid solid-principles genocs</PackageTags>
1415
<PackageReadmeFile>README_NUGET.md</PackageReadmeFile>
15-
<PackageReleaseNotes>Upgraded to NET9.0</PackageReleaseNotes>
1616
<EnableNETAnalyzers>True</EnableNETAnalyzers>
1717
<AnalysisLevel>latest</AnalysisLevel>
18+
<PackageReleaseNotes>
19+
The change log and breaking changes are listed here.
20+
https://github.com/Genocs/genocs-library/releases
21+
</PackageReleaseNotes>
1822
</PropertyGroup>
1923

2024
</Project>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Security.Claims;
2+
3+
namespace Genocs.Common.Interfaces;
4+
5+
/// <summary>
6+
/// The CurrentUser interface.
7+
/// </summary>
8+
public interface ICurrentUser
9+
{
10+
/// <summary>
11+
/// The user id.
12+
/// </summary>
13+
string? Name { get; }
14+
15+
/// <summary>
16+
/// Gets the user id.
17+
/// </summary>
18+
/// <returns>The default Id Type.</returns>
19+
DefaultIdType GetUserId();
20+
21+
string? GetUserEmail();
22+
23+
string? GetTenant();
24+
25+
bool IsAuthenticated();
26+
27+
/// <summary>
28+
/// Checks if the user is in a specific role.
29+
/// </summary>
30+
/// <param name="role">Role to check.</param>
31+
/// <returns>True in case of sucesful otherwise False.</returns>
32+
bool IsInRole(string role);
33+
34+
/// <summary>
35+
/// Gets the user claims.
36+
/// </summary>
37+
/// <returns>List of the claims.</returns>
38+
IEnumerable<Claim>? GetUserClaims();
39+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Genocs.Common.Interfaces;
2+
3+
/// <summary>
4+
/// Interface for DTOs.
5+
/// </summary>
6+
public interface IDto;

0 commit comments

Comments
 (0)