Skip to content

Commit

Permalink
Merge pull request #38 from Genocs/develop
Browse files Browse the repository at this point in the history
Version 2.2.0
  • Loading branch information
giovanninocco authored Oct 31, 2024
2 parents ab80ab7 + 0f3cb73 commit f0bb9dc
Show file tree
Hide file tree
Showing 68 changed files with 1,967 additions and 2,089 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build and test

on:
push:
branches: [ main ]
branches: [ main, develop ]
pull_request:
branches: [ main ]
branches: [ main, develop ]

jobs:
build:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [2.2.0](https://github.com/Genocs/microservice-template/compare/1.0.4...2.2.0)

> 31 October 2024
- Update NuGet package version in README files to 2.3.0 [`#37`](https://github.com/Genocs/microservice-template/pull/37)
- Prepare for V 2.2.0 [`#36`](https://github.com/Genocs/microservice-template/pull/36)
- Ver 200 [`#35`](https://github.com/Genocs/microservice-template/pull/35)
- Remove initial migration files and update EF Core models [`e0eeb1d`](https://github.com/Genocs/microservice-template/commit/e0eeb1d8183e02f917e6ea34fe7a9399570a3881)
- Refactor multi-tenancy and JWT handling [`285974e`](https://github.com/Genocs/microservice-template/commit/285974e2f82af42230bd1dcf304273289385a5bf)
- Refactor EF Core migrations and add SQLite support [`6422cae`](https://github.com/Genocs/microservice-template/commit/6422cae117cace9c3902b32758e45090caf7616c)

#### [1.0.4](https://github.com/Genocs/microservice-template/compare/1.0.3...1.0.4)

> 4 November 2023
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[license-url]: https://github.com/Genocs/microservice-template/blob/main/LICENSE
[build-shield]: https://github.com/Genocs/microservice-template/actions/workflows/build_and_test.yml/badge.svg?branch=main
[build-url]: https://github.com/Genocs/microservice-template/actions/workflows/build_and_test.yml
[package-shield]: https://img.shields.io/badge/nuget-v.2.1.1-blue?&label=latests&logo=nuget
[package-shield]: https://img.shields.io/badge/nuget-v.2.2.0-blue?&label=latests&logo=nuget
[package-url]: https://github.com/Genocs/microservice-template/actions/workflows/build_and_test.yml
[downloads-shield]: https://img.shields.io/nuget/dt/Genocs.Microservice.Template.svg?color=2da44e&label=downloads&logo=nuget
[downloads-url]: https://www.nuget.org/packages/Genocs.Microservice.Template
Expand Down
2 changes: 1 addition & 1 deletion README_NUGET.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[license-url]: https://github.com/Genocs/microservice-template/blob/main/LICENSE
[build-shield]: https://github.com/Genocs/microservice-template/actions/workflows/build_and_test.yml/badge.svg?branch=main
[build-url]: https://github.com/Genocs/microservice-template/actions/workflows/build_and_test.yml
[package-shield]: https://img.shields.io/badge/nuget-v.2.1.1-blue?&label=latests&logo=nuget
[package-shield]: https://img.shields.io/badge/nuget-v.2.2.0-blue?&label=latests&logo=nuget
[package-url]: https://github.com/Genocs/microservice-template/actions/workflows/build_and_test.yml
[downloads-shield]: https://img.shields.io/nuget/dt/Genocs.Microservice.Template.svg?color=2da44e&label=downloads&logo=nuget
[downloads-url]: https://www.nuget.org/packages/Genocs.Microservice.Template
Expand Down
2 changes: 1 addition & 1 deletion src/template/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Roslynator.Analyzers" Version="4.12.4">
<PackageReference Include="Roslynator.Analyzers" Version="4.12.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/template/docker-compose/docker-compose.mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
volumes:
- mysql-data:/data/db
healthcheck:
test: "/usr/bin/mysql --user=root --password=root --execute \"SHOW DATABASES;\""
test: '/usr/bin/mysql --user=root --password=root --execute "SHOW DATABASES;"'
interval: 2s
timeout: 40s
retries: 10
Expand Down
3 changes: 1 addition & 2 deletions src/template/docker-compose/docker-compose.postgresql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
ports:
- 5433:5433
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U admin" ]
test: ["CMD-SHELL", "pg_isready -U admin"]
interval: 10s
timeout: 5s
retries: 5
Expand All @@ -57,7 +57,6 @@ services:
# networks:
# - genocs


networks:
genocs:
name: genocs-network
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"info": {
"_postman_id": "09274f07-3b68-474c-952d-416b0effe6f9",
"name": "Genocs.Microservice.Template",
"description": "# Genocs.Microservice.Template home page\n\nThis is the home page",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "53972",
"_collection_link": "https://genocs.postman.co/workspace/cac0ab1e-a0df-4c9e-875f-08faea91d1a3/collection/53972-09274f07-3b68-474c-952d-416b0effe6f9?action=share&source=collection_link&creator=53972"
},
"info": {
"_postman_id": "5f62b7de-2e37-4a71-b8e7-91366cd02ac6",
"name": "Genocs.Microservice.Template",
"description": "# Genocs.Microservice.Template home page\n\nThis is the home page",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "53972",
"_collection_link": "https://genocs.postman.co/workspace/Genocs~cac0ab1e-a0df-4c9e-875f-08faea91d1a3/collection/53972-5f62b7de-2e37-4a71-b8e7-91366cd02ac6?action=share&source=collection_link&creator=53972"
},
"item": [
{
"name": "Identity",
Expand Down Expand Up @@ -67,18 +67,16 @@
"header": [
{
"key": "tenant",
"value": "root",
"uuid": "7d70b783-5cb8-4095-8545-6aad72922398"
"value": "root"
},
{
"key": "Accept-Language",
"value": "en-US",
"uuid": "393f40cc-5c02-404f-9ca2-fdfe924cab3d"
"value": "en-US"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"email\": \"{{root_admin_username}}\",\r\n \"password\": \"123Pa$$word!\"\r\n}",
"raw": "{\r\n \"email\": \"{{root_admin_username}}\",\r\n \"password\": \"{{root_admin_password}}\"\r\n}",
"options": {
"raw": {
"language": "json"
Expand All @@ -105,13 +103,12 @@
{
"key": "tenant",
"value": "beta",
"type": "text",
"uuid": "bf6a1df3-133d-4511-999d-9f0389904c03"
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"firstName\": \"John\",\r\n \"lastName\": \"Smith\",\r\n \"email\": \"[email protected]\",\r\n \"userName\": \"john.smith\",\r\n \"password\": \"123Pa$$word!\",\r\n \"confirmPassword\": \"123Pa$$word!\",\r\n \"phoneNumber\": \"99999\"\r\n}",
"raw": "{\r\n \"firstName\": \"{{$randomNoun}}\",\r\n \"lastName\": \"Doe\",\r\n \"email\": \"{{$randomEmail}}\",\r\n \"userName\": \"{{$randomNoun}}\",\r\n \"password\": \"<your_password>\",\r\n \"confirmPassword\": \"<your_password>\",\r\n \"phoneNumber\": \"<your_mobile>\"\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -154,7 +151,7 @@
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\": \"Manager\",\r\n \"description\": \"tadaaaa!\"\r\n}",
"raw": "{\r\n \"name\": \"Manager\",\r\n \"description\": \"Manager Role for root Tenant\"\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -273,8 +270,7 @@
{
"key": "tenant",
"value": "root",
"type": "text",
"uuid": "f48242b8-1476-4565-9b4e-2740eca160aa"
"type": "text"
}
],
"body": {
Expand Down Expand Up @@ -307,8 +303,7 @@
{
"key": "tenant",
"value": "root",
"type": "text",
"uuid": "5579a6ad-f79f-4205-909b-0266050ee573"
"type": "text"
}
],
"body": {
Expand Down Expand Up @@ -379,13 +374,11 @@
"header": [
{
"key": "tenant",
"value": "root",
"uuid": "5615fa07-cf09-4194-9dc8-e28973348321"
"value": "root"
},
{
"key": "Accept-Language",
"value": "en-US",
"uuid": "878b1b9a-58fc-4fd7-8fec-9dd00d56b179"
"value": "en-US"
}
],
"body": {
Expand Down Expand Up @@ -426,13 +419,12 @@
{
"key": "tenant",
"value": "beta",
"type": "text",
"uuid": "30b923d7-ac55-40b3-a59e-2caceba17faa"
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"advancedSearch\": {\r\n \"fields\": [\r\n \"\"\r\n ],\r\n \"keyword\": \"\"\r\n },\r\n \"keyword\": \"\",\r\n \"pageNumber\": 0,\r\n \"pageSize\": 0,\r\n \"orderBy\": [\r\n \"id\"\r\n ]\r\n}",
"raw": "{\r\n \"advancedSearch\": {\r\n \"fields\": [\r\n \"\"\r\n ],\r\n \"keyword\": \"\"\r\n },\r\n \"keyword\": \"\",\r\n \"pageNumber\": 0,\r\n \"pageSize\": 50,\r\n \"orderBy\": [\r\n \"id\"\r\n ]\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -562,7 +554,6 @@
{
"key": "",
"value": "",
"uuid": "aeab0bac-5e7d-43b6-bc4e-1cd0811a6469",
"disabled": true
}
],
Expand Down Expand Up @@ -610,8 +601,7 @@
"header": [
{
"key": "tenant",
"value": "beta",
"uuid": "aac4da58-23b3-4d8d-9fa6-f5f3eb069c34"
"value": "beta"
}
],
"body": {
Expand Down Expand Up @@ -923,12 +913,12 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{root_url}}/health",
"raw": "{{root_url}}/hc",
"host": [
"{{root_url}}"
],
"path": [
"health"
"hc"
]
}
},
Expand All @@ -945,11 +935,12 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{root_url}}/v1/dashboard",
"raw": "{{root_url}}/api/v1/dashboard",
"host": [
"{{root_url}}"
],
"path": [
"api",
"v1",
"dashboard"
]
Expand Down
10 changes: 3 additions & 7 deletions src/template/scripts/nswag-regen.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ $currentDirectory = Get-Location
$rootDirectory = git rev-parse --show-toplevel

# use relative path to the template folder
$templateFolder = ''
$baseFolder = 'src'
# $templateFolder = 'src/template/'


$webApiDirectory = Join-Path -Path $rootDirectory -ChildPath $templateFolder'src/WebApi'
$infrastructurePrj = Join-Path -Path $rootDirectory -ChildPath $templateFolder'src/Infrastructure/Infrastructure.csproj'
$infrastructurePrj = Join-Path -Path $rootDirectory -ChildPath $baseFolder'/Infrastructure/Infrastructure.csproj'

Write-Host "Make sure you have run the Genocs.WebApi project. `n"
Write-Host "Make sure you have run the WebApi project is up and running. `n"
Write-Host "Press any key to continue... `n"
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');

Set-Location -Path $webApiDirectory
Write-Host "WebApi Directory is $webApiDirectory `n"

<# Run command #>
dotnet build -t:NSwag $infrastructurePrj

Expand Down
11 changes: 6 additions & 5 deletions src/template/src/Core/Application/Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Genocs.Microservice.Template.Application</RootNamespace>
<AssemblyName>Genocs.Microservice.Template.Application</AssemblyName>
<IsPackable>false</IsPackable>

</PropertyGroup>

<ItemGroup>
<PackageReference Include="Ardalis.Specification" Version="8.0.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.2" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.10.0" />
<PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="MediatR" Version="12.3.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.6" />
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.10" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Domain\Domain.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ public SendStatsChangedNotificationHandler(ILogger<SendStatsChangedNotificationH
(_logger, _notifications) = (logger, notifications);

public Task Handle(EventNotification<EntityCreatedEvent<Brand>> notification, CancellationToken cancellationToken) =>
SendStatsChangedNotification(notification.Event, cancellationToken);
SendStatsChangedNotificationAsync(notification.Event, cancellationToken);
public Task Handle(EventNotification<EntityDeletedEvent<Brand>> notification, CancellationToken cancellationToken) =>
SendStatsChangedNotification(notification.Event, cancellationToken);
SendStatsChangedNotificationAsync(notification.Event, cancellationToken);
public Task Handle(EventNotification<EntityCreatedEvent<Product>> notification, CancellationToken cancellationToken) =>
SendStatsChangedNotification(notification.Event, cancellationToken);
SendStatsChangedNotificationAsync(notification.Event, cancellationToken);
public Task Handle(EventNotification<EntityDeletedEvent<Product>> notification, CancellationToken cancellationToken) =>
SendStatsChangedNotification(notification.Event, cancellationToken);
SendStatsChangedNotificationAsync(notification.Event, cancellationToken);
public Task Handle(EventNotification<ApplicationRoleCreatedEvent> notification, CancellationToken cancellationToken) =>
SendStatsChangedNotification(notification.Event, cancellationToken);
SendStatsChangedNotificationAsync(notification.Event, cancellationToken);
public Task Handle(EventNotification<ApplicationRoleDeletedEvent> notification, CancellationToken cancellationToken) =>
SendStatsChangedNotification(notification.Event, cancellationToken);
SendStatsChangedNotificationAsync(notification.Event, cancellationToken);
public Task Handle(EventNotification<ApplicationUserCreatedEvent> notification, CancellationToken cancellationToken) =>
SendStatsChangedNotification(notification.Event, cancellationToken);
SendStatsChangedNotificationAsync(notification.Event, cancellationToken);

private Task SendStatsChangedNotification(IEvent @event, CancellationToken cancellationToken)
private Task SendStatsChangedNotificationAsync(IEvent @event, CancellationToken cancellationToken)
{
_logger.LogInformation("{event} Triggered => Sending StatsChangedNotification", @event.GetType().Name);

Expand Down
2 changes: 1 addition & 1 deletion src/template/src/Core/Domain/Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Genocs.Microservice.Template.Domain</RootNamespace>
<AssemblyName>Genocs.Microservice.Template.Domain</AssemblyName>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/template/src/Core/Shared/Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Genocs.Microservice.Template.Shared</RootNamespace>
<AssemblyName>Genocs.Microservice.Template.Shared</AssemblyName>
<IsPackable>false</IsPackable>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Genocs.Microservice.Template.Application.Common.Exceptions;
using System.Security.Claims;
using System.Text;
using Genocs.Microservice.Template.Application.Common.Exceptions;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using System.Security.Claims;
using System.Text;

namespace Genocs.Microservice.Template.Infrastructure.Auth.Jwt;

Expand Down
4 changes: 4 additions & 0 deletions src/template/src/Infrastructure/Auth/Jwt/JwtSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

namespace Genocs.Microservice.Template.Infrastructure.Auth.Jwt;

/// <summary>
/// The JwtSettings class is used to configure the JWT settings.
/// This class uses the IValidatableObject interface to validate the configuration.
/// </summary>
public class JwtSettings : IValidatableObject
{
public string Key { get; set; } = string.Empty;
Expand Down
1 change: 1 addition & 0 deletions src/template/src/Infrastructure/Auth/Jwt/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ internal static class Startup
{
internal static IServiceCollection AddJwtAuth(this IServiceCollection services)
{
// Add JwtSettings configuration and validation
services.AddOptions<JwtSettings>()
.BindConfiguration($"SecuritySettings:{nameof(JwtSettings)}")
.ValidateDataAnnotations()
Expand Down
Loading

0 comments on commit f0bb9dc

Please sign in to comment.