diff --git a/deploy/helm/cgen-api/templates/deployment.yaml b/deploy/helm/cgen-api/templates/deployment.yaml index d4dc035d..164fca3d 100644 --- a/deploy/helm/cgen-api/templates/deployment.yaml +++ b/deploy/helm/cgen-api/templates/deployment.yaml @@ -46,11 +46,11 @@ spec: protocol: TCP livenessProbe: httpGet: - path: / + path: /version port: http readinessProbe: httpGet: - path: / + path: /version port: http resources: {{- toYaml .Values.resources | nindent 12 }} diff --git a/deploy/helm/cgen-api/values.yaml b/deploy/helm/cgen-api/values.yaml index c86853d3..43bf6b69 100644 --- a/deploy/helm/cgen-api/values.yaml +++ b/deploy/helm/cgen-api/values.yaml @@ -58,7 +58,7 @@ ingress: env: values: - name: ConnectionString - value: Server=tcp:mssql-data;Initial Catalog=O2Bionics.O2NextGen.IdentityDb;User ID=sa;Password=yourStrong(!)Password;Connection Timeout=30; + value: Server=tcp:mssql-data;Initial Catalog=O2Bionics.O2NextGen.CGenDb;User ID=sa;Password=yourStrong(!)Password;Connection Timeout=30; resources: {} # We usually recommend not to specify default resources and to leave this as a conscious diff --git a/src/DesktopApps/O2.Business b/src/DesktopApps/O2.Business index 84a7fb91..9303c5f6 160000 --- a/src/DesktopApps/O2.Business +++ b/src/DesktopApps/O2.Business @@ -1 +1 @@ -Subproject commit 84a7fb9169fb0c959701876d723ba13fea5ad66c +Subproject commit 9303c5f63ae9c71f72c3d1a9b79bbaadd9eca62c diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/c-gen/CertificateViewModel.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/CGen/CertificateViewModel.cs similarity index 74% rename from src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/c-gen/CertificateViewModel.cs rename to src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/CGen/CertificateViewModel.cs index 04f7e12e..2036d972 100644 --- a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/c-gen/CertificateViewModel.cs +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/CGen/CertificateViewModel.cs @@ -1,4 +1,4 @@ -namespace O2NextGen.Sdk.NetCore.Models.c_gen +namespace O2NextGen.Sdk.NetCore.Models.CGen { public class CertificateViewModel { diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/e-sender/EmailRequestViewModel.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/ESender/EmailRequestViewModel.cs similarity index 90% rename from src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/e-sender/EmailRequestViewModel.cs rename to src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/ESender/EmailRequestViewModel.cs index bab91a2c..3133ca4f 100644 --- a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/e-sender/EmailRequestViewModel.cs +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/ESender/EmailRequestViewModel.cs @@ -1,4 +1,4 @@ -namespace O2NextGen.Sdk.NetCore.Models.e_sender +namespace O2NextGen.Sdk.NetCore.Models.ESender { public class EmailRequestViewModel : IViewModel { diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/e-sender/IViewModel.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/ESender/IViewModel.cs similarity index 84% rename from src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/e-sender/IViewModel.cs rename to src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/ESender/IViewModel.cs index f991eeca..6b30bfac 100644 --- a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/e-sender/IViewModel.cs +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/ESender/IViewModel.cs @@ -1,4 +1,4 @@ -namespace O2NextGen.Sdk.NetCore.Models.e_sender +namespace O2NextGen.Sdk.NetCore.Models.ESender { public interface IViewModel { diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/UnixDateExtensions.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/UnixDateExtensions.cs new file mode 100644 index 00000000..94da2443 --- /dev/null +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/UnixDateExtensions.cs @@ -0,0 +1,20 @@ +using System; +namespace O2NextGen.Sdk.NetCore.Models +{ + public static class UnixDateExtensions + { + private static readonly DateTime UnixEpoch = + new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime(); + + public static DateTime ConvertToDateTime(this long seconds, bool isSeconds = true) + { + return isSeconds ? UnixEpoch.AddSeconds(seconds) : UnixEpoch.AddMinutes(seconds); + } + + public static long ConvertToUnixTime(this DateTime datetime, bool isSeconds = true) + { + return isSeconds ? (long)(datetime - UnixEpoch).TotalSeconds : (long)(datetime - UnixEpoch).TotalMinutes; + } + } +} + diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/media-basket/MediaViewModel.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/media-basket/MediaViewModel.cs index 98c83840..a62a261e 100644 --- a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/media-basket/MediaViewModel.cs +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/media-basket/MediaViewModel.cs @@ -1,7 +1,7 @@ using System; using Microsoft.AspNetCore.Http; -namespace O2NextGen.Sdk.NetCore.Models.media_basket +namespace O2NextGen.Sdk.NetCore.Models.MediaBasket { public class MediaViewModel { diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatEvent.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatEvent.cs index 893fec09..bb9a91ac 100644 --- a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatEvent.cs +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatEvent.cs @@ -1,4 +1,4 @@ -namespace O2NextGen.Sdk.NetCore.Models.smalltalk +namespace O2NextGen.Sdk.NetCore.Models.SmallTalk { public class ChatEvent { diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatMessage.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatMessage.cs index 5152b63e..ad6a4855 100644 --- a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatMessage.cs +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatMessage.cs @@ -1,4 +1,4 @@ -namespace O2NextGen.Sdk.NetCore.Models.smalltalk +namespace O2NextGen.Sdk.NetCore.Models.SmallTalk { public class ChatMessage { diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatMessageViewModel.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatMessageViewModel.cs index 99e020e8..65ad7140 100644 --- a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatMessageViewModel.cs +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatMessageViewModel.cs @@ -1,4 +1,4 @@ -namespace O2NextGen.Sdk.NetCore.Models.smalltalk +namespace O2NextGen.Sdk.NetCore.Models.SmallTalk { public class ChatMessageViewModel diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatSession.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatSession.cs index 330d14bd..8fafb68e 100644 --- a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatSession.cs +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatSession.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace O2NextGen.Sdk.NetCore.Models.smalltalk +namespace O2NextGen.Sdk.NetCore.Models.SmallTalk { public class ChatSession diff --git a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatSessionInvite.cs b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatSessionInvite.cs index 26aabc5f..f1d959fe 100644 --- a/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatSessionInvite.cs +++ b/src/SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/smalltalk/ChatSessionInvite.cs @@ -1,4 +1,4 @@ -namespace O2NextGen.Sdk.NetCore.Models.smalltalk +namespace O2NextGen.Sdk.NetCore.Models.SmallTalk { public abstract class ChatSessionInvite { diff --git a/src/Services/c-gen/Dockerfile b/src/Services/c-gen/Dockerfile index 5c6e50c2..4d8e2e66 100644 --- a/src/Services/c-gen/Dockerfile +++ b/src/Services/c-gen/Dockerfile @@ -2,24 +2,24 @@ FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app -EXPOSE 80 +EXPOSE 80 +EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src -COPY ["O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj", "O2NextGen.CertificateManagement.Api/"] -COPY ["../../SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/O2NextGen.Sdk.NetCore.Models.csproj", "../../SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/"] -COPY ["O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj", "O2NextGen.CertificateManagement.Business/"] -COPY ["O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj", "O2NextGen.CertificateManagement.Data/"] -COPY ["O2NextGen.CertificateManagement.Impl/O2NextGen.CertificateManagement.Impl.csproj", "O2NextGen.CertificateManagement.Impl/"] -RUN dotnet restore "O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj" +COPY ["O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj", "O2NextGen.CertificateManagement.Application/"] +COPY ["O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj", "O2NextGen.CertificateManagement.Domain/"] +COPY ["O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj", "O2NextGen.CertificateManagement.Infrastructure/"] +COPY ["O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.csproj", "O2NextGen.CertificateManagement.StartupTasks/"] +RUN dotnet restore "O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj" COPY . . -WORKDIR "/src/O2NextGen.CertificateManagement.Api" -RUN dotnet build "O2NextGen.CertificateManagement.Api.csproj" -c Release -o /app/build +WORKDIR "/src/O2NextGen.CertificateManagement.Application" +RUN dotnet build "O2NextGen.CertificateManagement.Application.csproj" -c Release -o /app/build FROM build AS publish -RUN dotnet publish "O2NextGen.CertificateManagement.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false +RUN dotnet publish "O2NextGen.CertificateManagement.Application.csproj" -c Release -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "O2NextGen.CertificateManagement.Api.dll"] +ENTRYPOINT ["dotnet", "O2NextGen.CertificateManagement.Application.dll"] diff --git a/src/Services/c-gen/O2NextGen.CGen.sln b/src/Services/c-gen/O2NextGen.CGen.sln index 9da04b6a..a616a905 100644 --- a/src/Services/c-gen/O2NextGen.CGen.sln +++ b/src/Services/c-gen/O2NextGen.CGen.sln @@ -3,25 +3,39 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.32112.339 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Api", "O2NextGen.CertificateManagement.Api\O2NextGen.CertificateManagement.Api.csproj", "{EA540B06-8A73-49C7-A799-49423B316458}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.CertificateManagement.Api", "O2NextGen.CertificateManagement.Api\O2NextGen.CertificateManagement.Api.csproj", "{EA540B06-8A73-49C7-A799-49423B316458}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Business", "O2NextGen.CertificateManagement.Business\O2NextGen.CertificateManagement.Business.csproj", "{C6E0B2A5-6349-4C1D-8E14-82249AF8F58A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.CertificateManagement.Business", "O2NextGen.CertificateManagement.Business\O2NextGen.CertificateManagement.Business.csproj", "{C6E0B2A5-6349-4C1D-8E14-82249AF8F58A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Impl", "O2NextGen.CertificateManagement.Impl\O2NextGen.CertificateManagement.Impl.csproj", "{01805439-2954-49CE-93D2-5EB06B82146C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.CertificateManagement.Impl", "O2NextGen.CertificateManagement.Impl\O2NextGen.CertificateManagement.Impl.csproj", "{01805439-2954-49CE-93D2-5EB06B82146C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{12E83C2A-23C7-4E71-B137-AC56CE28F9E4}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Data", "O2NextGen.CertificateManagement.Data\O2NextGen.CertificateManagement.Data.csproj", "{B8C8A05D-0D30-40FF-8BDD-B2FBA2ED7AB0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "O2NextGen.CertificateManagement.Data", "O2NextGen.CertificateManagement.Data\O2NextGen.CertificateManagement.Data.csproj", "{B8C8A05D-0D30-40FF-8BDD-B2FBA2ED7AB0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests.O2NextGen.CertificateManagement.Api", "Tests\IntegrationTests.O2NextGen.CertificateManagement.Api\IntegrationTests.O2NextGen.CertificateManagement.Api.csproj", "{454CB1E8-8060-49CB-9752-140F93E7829C}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.O2NextGen.CertificateManagement.Api", "Tests\Tests.O2NextGen.CertificateManagement.Api\Tests.O2NextGen.CertificateManagement.Api.csproj", "{CEA7184F-87D5-4141-A4BC-A983BF257AC6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.O2NextGen.CertificateManagement.Api", "Tests\Tests.O2NextGen.CertificateManagement.Api\Tests.O2NextGen.CertificateManagement.Api.csproj", "{CEA7184F-87D5-4141-A4BC-A983BF257AC6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.O2NextGen.CertificateManagement.Impl", "Tests\Tests.O2NextGen.CertificateManagement.Impl\Tests.O2NextGen.CertificateManagement.Impl.csproj", "{6FB50F98-47E7-4960-80F0-58562914ADDE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.O2NextGen.CertificateManagement.Impl", "Tests\Tests.O2NextGen.CertificateManagement.Impl\Tests.O2NextGen.CertificateManagement.Impl.csproj", "{6FB50F98-47E7-4960-80F0-58562914ADDE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests.O2NextGen.CertificateManagement.Api", "Tests\IntegrationTests.O2NextGen.CertificateManagement.Api\IntegrationTests.O2NextGen.CertificateManagement.Api.csproj", "{094FF4EB-0351-44BF-9739-4F3A62721DFC}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SDKs", "SDKs", "{629874CA-6688-43CA-9716-48FB42D41150}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SDKs", "SDKs", "{54AADF48-C069-49F7-B8A8-3B72F5FC3F14}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.Sdk.NetCore.Models", "..\..\SDKs\O2NG.Sdk.NetCore\O2NG.Sdk.NetCore.Models\O2NextGen.Sdk.NetCore.Models.csproj", "{8C88AA87-9C8E-42D7-BAF1-28401C563FDF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.Sdk.NetCore.Models", "..\..\SDKs\O2NG.Sdk.NetCore\O2NG.Sdk.NetCore.Models\O2NextGen.Sdk.NetCore.Models.csproj", "{AFA64E01-DA06-4432-9BEA-34D0F4AD6A54}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Domain", "O2NextGen.CertificateManagement.Domain\O2NextGen.CertificateManagement.Domain.csproj", "{30072535-9AFD-45CE-8258-87BF3CAA2EC2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.StartupTasks", "O2NextGen.CertificateManagement.StartupTasks\O2NextGen.CertificateManagement.StartupTasks.csproj", "{9BE85DEE-293B-4E57-BD0F-01E3B48F7A61}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Infrastructure", "O2NextGen.CertificateManagement.Infrastructure\O2NextGen.CertificateManagement.Infrastructure.csproj", "{125F9B7B-1508-4F01-A9AA-2EBC01BE0C19}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CQRS", "CQRS", "{716B7603-CDF7-460D-A869-20FE90F84EC2}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Skeleton", "Skeleton", "{2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "O2NextGen.CertificateManagement.Application", "O2NextGen.CertificateManagement.Application\O2NextGen.CertificateManagement.Application.csproj", "{BC6D2691-1006-4B6D-B661-81157E493F3B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrationTests.O2NextGen.CertificateManagement.Application", "Tests\IntegrationTests.O2NextGen.CertificateManagement.Application\IntegrationTests.O2NextGen.CertificateManagement.Application.csproj", "{58CC0839-863D-4708-A6D4-42F245593538}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,10 +59,6 @@ Global {B8C8A05D-0D30-40FF-8BDD-B2FBA2ED7AB0}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8C8A05D-0D30-40FF-8BDD-B2FBA2ED7AB0}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8C8A05D-0D30-40FF-8BDD-B2FBA2ED7AB0}.Release|Any CPU.Build.0 = Release|Any CPU - {454CB1E8-8060-49CB-9752-140F93E7829C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {454CB1E8-8060-49CB-9752-140F93E7829C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {454CB1E8-8060-49CB-9752-140F93E7829C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {454CB1E8-8060-49CB-9752-140F93E7829C}.Release|Any CPU.Build.0 = Release|Any CPU {CEA7184F-87D5-4141-A4BC-A983BF257AC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CEA7184F-87D5-4141-A4BC-A983BF257AC6}.Debug|Any CPU.Build.0 = Debug|Any CPU {CEA7184F-87D5-4141-A4BC-A983BF257AC6}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -57,19 +67,52 @@ Global {6FB50F98-47E7-4960-80F0-58562914ADDE}.Debug|Any CPU.Build.0 = Debug|Any CPU {6FB50F98-47E7-4960-80F0-58562914ADDE}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FB50F98-47E7-4960-80F0-58562914ADDE}.Release|Any CPU.Build.0 = Release|Any CPU - {8C88AA87-9C8E-42D7-BAF1-28401C563FDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8C88AA87-9C8E-42D7-BAF1-28401C563FDF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C88AA87-9C8E-42D7-BAF1-28401C563FDF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8C88AA87-9C8E-42D7-BAF1-28401C563FDF}.Release|Any CPU.Build.0 = Release|Any CPU + {094FF4EB-0351-44BF-9739-4F3A62721DFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {094FF4EB-0351-44BF-9739-4F3A62721DFC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {094FF4EB-0351-44BF-9739-4F3A62721DFC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {094FF4EB-0351-44BF-9739-4F3A62721DFC}.Release|Any CPU.Build.0 = Release|Any CPU + {AFA64E01-DA06-4432-9BEA-34D0F4AD6A54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFA64E01-DA06-4432-9BEA-34D0F4AD6A54}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFA64E01-DA06-4432-9BEA-34D0F4AD6A54}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFA64E01-DA06-4432-9BEA-34D0F4AD6A54}.Release|Any CPU.Build.0 = Release|Any CPU + {30072535-9AFD-45CE-8258-87BF3CAA2EC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30072535-9AFD-45CE-8258-87BF3CAA2EC2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30072535-9AFD-45CE-8258-87BF3CAA2EC2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30072535-9AFD-45CE-8258-87BF3CAA2EC2}.Release|Any CPU.Build.0 = Release|Any CPU + {9BE85DEE-293B-4E57-BD0F-01E3B48F7A61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9BE85DEE-293B-4E57-BD0F-01E3B48F7A61}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BE85DEE-293B-4E57-BD0F-01E3B48F7A61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9BE85DEE-293B-4E57-BD0F-01E3B48F7A61}.Release|Any CPU.Build.0 = Release|Any CPU + {125F9B7B-1508-4F01-A9AA-2EBC01BE0C19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {125F9B7B-1508-4F01-A9AA-2EBC01BE0C19}.Debug|Any CPU.Build.0 = Debug|Any CPU + {125F9B7B-1508-4F01-A9AA-2EBC01BE0C19}.Release|Any CPU.ActiveCfg = Release|Any CPU + {125F9B7B-1508-4F01-A9AA-2EBC01BE0C19}.Release|Any CPU.Build.0 = Release|Any CPU + {BC6D2691-1006-4B6D-B661-81157E493F3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BC6D2691-1006-4B6D-B661-81157E493F3B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BC6D2691-1006-4B6D-B661-81157E493F3B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BC6D2691-1006-4B6D-B661-81157E493F3B}.Release|Any CPU.Build.0 = Release|Any CPU + {58CC0839-863D-4708-A6D4-42F245593538}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {58CC0839-863D-4708-A6D4-42F245593538}.Debug|Any CPU.Build.0 = Debug|Any CPU + {58CC0839-863D-4708-A6D4-42F245593538}.Release|Any CPU.ActiveCfg = Release|Any CPU + {58CC0839-863D-4708-A6D4-42F245593538}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {454CB1E8-8060-49CB-9752-140F93E7829C} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} {CEA7184F-87D5-4141-A4BC-A983BF257AC6} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} {6FB50F98-47E7-4960-80F0-58562914ADDE} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} - {8C88AA87-9C8E-42D7-BAF1-28401C563FDF} = {629874CA-6688-43CA-9716-48FB42D41150} + {094FF4EB-0351-44BF-9739-4F3A62721DFC} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} + {AFA64E01-DA06-4432-9BEA-34D0F4AD6A54} = {54AADF48-C069-49F7-B8A8-3B72F5FC3F14} + {EA540B06-8A73-49C7-A799-49423B316458} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} + {C6E0B2A5-6349-4C1D-8E14-82249AF8F58A} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} + {B8C8A05D-0D30-40FF-8BDD-B2FBA2ED7AB0} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} + {01805439-2954-49CE-93D2-5EB06B82146C} = {2561455C-AAF2-4B6F-BA84-DA8AD57EB3E4} + {30072535-9AFD-45CE-8258-87BF3CAA2EC2} = {716B7603-CDF7-460D-A869-20FE90F84EC2} + {125F9B7B-1508-4F01-A9AA-2EBC01BE0C19} = {716B7603-CDF7-460D-A869-20FE90F84EC2} + {9BE85DEE-293B-4E57-BD0F-01E3B48F7A61} = {716B7603-CDF7-460D-A869-20FE90F84EC2} + {BC6D2691-1006-4B6D-B661-81157E493F3B} = {716B7603-CDF7-460D-A869-20FE90F84EC2} + {58CC0839-863D-4708-A6D4-42F245593538} = {12E83C2A-23C7-4E71-B137-AC56CE28F9E4} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A6DFC9F0-3FA7-492B-ACE9-3EFBF3477712} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CategoryController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CategoryController.cs new file mode 100644 index 00000000..7793b011 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CategoryController.cs @@ -0,0 +1,82 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using O2NextGen.CertificateManagement.Api.Setup; +using O2NextGen.CertificateManagement.Business.Services; +using O2NextGen.CertificateManagement.Api.Mappings; +using O2NextGen.Sdk.NetCore.Models.c_gen; +using O2NextGen.CertificateManagement.Api.ViewModels; + +namespace O2NextGen.CertificateManagement.Api.Controllers +{ + [Route("category")] + public class CategoryController : ControllerBase + { + #region Fields + + private readonly ICategoryService _categoryService; + private readonly UrlsConfig _config; + + #endregion + + + #region Ctors + + public CategoryController(ICategoryService categoryService, UrlsConfig config) + { + _categoryService = categoryService; + _config = config; + } + + #endregion + + + #region Methods + + [HttpGet] + [Route("")] + public async Task GetAllAsync() + { + var url = _config.Auth; + var models = await _categoryService.GetAllAsync(CancellationToken.None); + return Ok(models.ToViewModel()); + } + + [HttpGet] + [Route("{id}")] + public async Task GetByIdAsync(long id, CancellationToken ct) + { + var certificate = await _categoryService.GetByIdAsync(id, ct); + if (certificate == null) + return NotFound(); + return Ok(certificate.ToViewModel()); + } + + [HttpPut] + [Route("id")] + public async Task UpdateAsync(long id, CategoryViewModel model, CancellationToken ct) + { + var certificate = await _categoryService.UpdateAsync(model.ToModel(), ct); + return Ok(certificate.ToViewModel()); + } + + [HttpPost] + [HttpPut] + [Route("")] + public async Task AddAsync(CategoryViewModel model, CancellationToken ct) + { + var certificate = await _categoryService.AddAsync(model.ToModel(), ct); + return CreatedAtAction(nameof(GetByIdAsync), new { id = certificate.Id }, certificate); + } + + [HttpDelete] + [Route("id")] + public async Task RemoveAsync(long id, CancellationToken ct) + { + await _categoryService.RemoveAsync(id, ct); + return NoContent(); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CertificatesController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CertificatesController.cs index aedcba5b..70262f6f 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CertificatesController.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/CertificatesController.cs @@ -5,10 +5,13 @@ using O2NextGen.CertificateManagement.Business.Services; using O2NextGen.CertificateManagement.Api.Mappings; using O2NextGen.Sdk.NetCore.Models.c_gen; +using O2NextGen.CertificateManagement.Impl.Services; +using MediatR; +using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate; namespace O2NextGen.CertificateManagement.Api.Controllers { - [Route("certificates")] + [Route("api/[controller]")] public class CertificatesController : ControllerBase { #region Fields @@ -65,17 +68,17 @@ public async Task UpdateAsync(long id, CertificateViewModel model public async Task AddAsync(CertificateViewModel model, CancellationToken ct) { var certificate = await _certificatesService.AddAsync(model.ToModel(), ct); - return CreatedAtAction(nameof(GetByIdAsync), new {id = certificate.Id}, certificate); + return CreatedAtAction(nameof(GetByIdAsync), new { id = certificate.Id }, certificate); } - #endregion - [HttpDelete] [Route("id")] - public async Task RemoveAsync(long id,CancellationToken ct) + public async Task RemoveAsync(long id, CancellationToken ct) { await _certificatesService.RemoveAsync(id, ct); return NoContent(); } + + #endregion } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/VersionController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/VersionController.cs index d639422f..a35164d5 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/VersionController.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Controllers/VersionController.cs @@ -8,7 +8,7 @@ namespace O2NextGen.CertificateManagement.Api.Controllers { [AllowAnonymous] - public class VersionController:ControllerBase + public class VersionController : ControllerBase { #region Fields @@ -17,7 +17,7 @@ public class VersionController:ControllerBase #endregion - + #region Ctors public VersionController(IWebHostEnvironment environment, ILogger logger) diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Dockerfile b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Dockerfile index 5c6e50c2..693a0c39 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Dockerfile +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Dockerfile @@ -7,7 +7,6 @@ EXPOSE 80 FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj", "O2NextGen.CertificateManagement.Api/"] -COPY ["../../SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/O2NextGen.Sdk.NetCore.Models.csproj", "../../SDKs/O2NG.Sdk.NetCore/O2NG.Sdk.NetCore.Models/"] COPY ["O2NextGen.CertificateManagement.Business/O2NextGen.CertificateManagement.Business.csproj", "O2NextGen.CertificateManagement.Business/"] COPY ["O2NextGen.CertificateManagement.Data/O2NextGen.CertificateManagement.Data.csproj", "O2NextGen.CertificateManagement.Data/"] COPY ["O2NextGen.CertificateManagement.Impl/O2NextGen.CertificateManagement.Impl.csproj", "O2NextGen.CertificateManagement.Impl/"] diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CategoryMappings.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CategoryMappings.cs new file mode 100644 index 00000000..a5b7f968 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Mappings/CategoryMappings.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using O2NextGen.CertificateManagement.Api.ViewModels; +using O2NextGen.CertificateManagement.Business.Models; + +namespace O2NextGen.CertificateManagement.Api.Mappings +{ + public static class CategoryMappinsg + { + public static CategoryViewModel ToViewModel(this Category model) + { + if (model == null) + return null; + + var viewModel = new CategoryViewModel(); + + //Bindings + viewModel.Id = model.Id; + viewModel.Name = model.Name; + + return viewModel; + } + + public static Category ToModel(this CategoryViewModel viewModel) + { + if (viewModel == null) + return null; + + var model = new Category(); + + //Bindings + model.Id = viewModel.Id; + model.Name = viewModel.Name; + + return model; + } + + public static IReadOnlyCollection ToViewModel( + this IReadOnlyCollection models) + { + if (models.Count == 0) + { + return Array.Empty(); + } + + var subscription = new CategoryViewModel[models.Count]; + var i = 0; + foreach (var model in models) + { + subscription[i] = ToViewModel(model); + ++i; + } + + return new ReadOnlyCollection(subscription); + } + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj index baf54af8..3f2a4725 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/O2NextGen.CertificateManagement.Api.csproj @@ -10,6 +10,8 @@ + + @@ -20,15 +22,23 @@ + + + + + + - + + + @@ -48,13 +58,10 @@ - - - - - - - + + + + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Properties/launchSettings.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Properties/launchSettings.json index bcc6375f..df128c43 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Properties/launchSettings.json +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Properties/launchSettings.json @@ -3,8 +3,7 @@ "O2NextGen.CertificateManagement.Api": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:10002;http://localhost:5002", + "applicationUrl": "http://localhost:39903", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/CustomerService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/CustomerService.cs new file mode 100644 index 00000000..01455903 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/CustomerService.cs @@ -0,0 +1,21 @@ +using System; +using Microsoft.AspNetCore.Http; + +namespace O2NextGen.CertificateManagement.Api.Services +{ + public class CustomerService : ICustomerService + { + // ReSharper disable once NotAccessedField.Local + private IHttpContextAccessor _context; + + public CustomerService(IHttpContextAccessor context) + { + _context = context ?? throw new ArgumentNullException(nameof(context)); + } + + public Guid CustomerId { get; } = Guid.Parse("A6D86517-CF70-4EEF-8340-BCBAA4B60C4A"); + public string CustomerDescription { get; set; } = "#PF_R Community"; + public string RegisterLink { get; set; } = "https://pfr-centr.com"; + public string AccountLink { get; set; } = "https://pfr-centr.com"; + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/ICustomerService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/ICustomerService.cs new file mode 100644 index 00000000..71cd9379 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Services/ICustomerService.cs @@ -0,0 +1,12 @@ +using System; + +namespace O2NextGen.CertificateManagement.Api.Services +{ + public interface ICustomerService + { + Guid CustomerId { get; } + string CustomerDescription { get; set; } + string RegisterLink { get; set; } + string AccountLink { get; set; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Startup.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Startup.cs index 80d72e28..2c092f89 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Startup.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/Startup.cs @@ -27,6 +27,7 @@ public Startup(IConfiguration appConfiguration, IWebHostEnvironment env) this.HostingEnvironment = env; this.AppConfiguration = appConfiguration; } + public void ConfigureServices(IServiceCollection services) { services.AddRequiredMvcComponents(); diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Api/ViewModels/CategoryViewModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/ViewModels/CategoryViewModel.cs new file mode 100644 index 00000000..862aa9b2 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Api/ViewModels/CategoryViewModel.cs @@ -0,0 +1,10 @@ +using System; +namespace O2NextGen.CertificateManagement.Api.ViewModels +{ + public class CategoryViewModel + { + public long Id { get; internal set; } + public string Name { get; internal set; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs new file mode 100644 index 00000000..fda1c655 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Controllers/VersionController.cs @@ -0,0 +1,43 @@ +using System.Reflection; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace O2NextGen.CertificateManagement.Application.Controllers +{ + + [AllowAnonymous] + public class VersionController : ControllerBase + { + #region Fields + + private readonly IWebHostEnvironment _environment; + private readonly ILogger _logger; + + #endregion + + + #region Ctors + + public VersionController(IWebHostEnvironment environment, ILogger logger) + { + _environment = environment; + _logger = logger; + } + + #endregion + + [HttpGet("[controller]")] + public object Index() + { + var exVersion = Assembly.GetExecutingAssembly().GetName().Version; + _logger.LogInformation($"get version - {exVersion}"); + return new + { + Environment = _environment.EnvironmentName, + Version = exVersion.ToString() + }; + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Dockerfile b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Dockerfile new file mode 100644 index 00000000..4d8e2e66 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Dockerfile @@ -0,0 +1,25 @@ +#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 +EXPOSE 443 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj", "O2NextGen.CertificateManagement.Application/"] +COPY ["O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj", "O2NextGen.CertificateManagement.Domain/"] +COPY ["O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj", "O2NextGen.CertificateManagement.Infrastructure/"] +COPY ["O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.csproj", "O2NextGen.CertificateManagement.StartupTasks/"] +RUN dotnet restore "O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj" +COPY . . +WORKDIR "/src/O2NextGen.CertificateManagement.Application" +RUN dotnet build "O2NextGen.CertificateManagement.Application.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "O2NextGen.CertificateManagement.Application.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "O2NextGen.CertificateManagement.Application.dll"] diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs new file mode 100644 index 00000000..4eaabc44 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CertificatesController.cs @@ -0,0 +1,95 @@ +using System; +using System.Threading; +using MediatR; +using Microsoft.AspNetCore.Mvc; +using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate; +using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.DeleteCertificate; +using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate; +using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.UpdateCertificate; + +namespace O2NextGen.CertificateManagement.Application.Controllers +{ + [Route("api/[controller]")] + public partial class CertificatesController : ControllerBase + { + #region Fields + + private readonly IMediator _mediator; + private readonly ILogger logger; + + private static readonly string GetByIdActionName + = nameof(GetByIdAsync).Replace("Async", string.Empty); + #endregion + + + #region Ctors + + public CertificatesController(IMediator mediator, ILogger logger) + { + _mediator = mediator; + this.logger = logger; + } + + #endregion + + + #region Methods + + [HttpGet] + [Route("{id}")] + public async Task GetByIdAsync(long id, CancellationToken ct) + { + var result = await _mediator.Send(new GetCertificateQuery(id)); + + if (result is null) + return NotFound(); + + return Ok(result); + } + + [HttpGet] + [Route("")] + public async Task GetAllAsync() + { + var result = await _mediator.Send(new GetCertificatesQuery()); + return Ok(result.Certificates); + } + + [HttpPut] + [Route("id")] + public async Task> UpdateAsync( + long id, UpdateCertificateDetailsCommandModel model, CancellationToken ct) + { + var result = await _mediator.Send(new UpdateCertificateDetailsCommand(id, + model.Name)); + + if (result is null) + { + return NotFound(); + } + + return result; + } + + [HttpPut] + [HttpPost] + [Route("")] + public async Task> AddAsync( + CreateCertificateDetailsCommandModel model, + CancellationToken ct) + { + var result = await _mediator.Send(new CreateCertificateCommand(model.Name)); + return CreatedAtAction(GetByIdActionName, new { id = result.Id }, result); + } + + [HttpDelete] + [Route("{id}")] + public async Task RemoveAsync(long id, CancellationToken ct) + { + await _mediator.Send(new DeleteCertificateCommand(id)); + return NoContent(); + } + } + + #endregion +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs new file mode 100644 index 00000000..eaa4d560 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/CreateCertificateDetailsCommandModel.cs @@ -0,0 +1,5 @@ +public class CreateCertificateDetailsCommandModel +{ + public string Name { get; set; } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs new file mode 100644 index 00000000..dd519c9b --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Features/Certificates/UpdateCertificateDetailsCommandModel.cs @@ -0,0 +1,5 @@ +public class UpdateCertificateDetailsCommandModel +{ + public string Name { get; set; } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs new file mode 100644 index 00000000..1c9482d7 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/IoC/ServiceCollectionExtensions.cs @@ -0,0 +1,72 @@ +using System; +using MediatR; +using Microsoft.EntityFrameworkCore; +using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate; +using O2NextGen.CertificateManagement.Infrastructure.Data; +using Microsoft.Extensions.Configuration; +using O2NextGen.CertificateManagement.Domain.Data; +using System.Text.RegularExpressions; +using O2NextGen.CertificateManagement.Business.Models; +using O2NextGen.CertificateManagement.Domain.Data.Queries; + +namespace Microsoft.Extensions.DependencyInjection + { + public static class ServiceCollectionExtensions + { + public static IServiceCollection AddBusiness(this IServiceCollection services) + { + services.AddMediatR( + typeof(GetCertificateQuery)); + + return services; + } + + public static TConfig ConfigurePOCO(this IServiceCollection services, IConfiguration configuration) + where TConfig : class, new() + { + if (services == null) throw new ArgumentNullException(nameof(services)); + if (configuration == null) throw new ArgumentNullException(nameof(configuration)); + + var config = new TConfig(); + configuration.Bind(config); + services.AddSingleton(config); + return config; + } + + public static IServiceCollection AddConfigEf(this IServiceCollection services, IConfiguration configuration) + { + var connectionString = configuration["ConnectionString"]; + services.AddDbContext(x => + x.UseSqlServer(connectionString)); + return services; + } + + public static IServiceCollection AddInfrastructure(this IServiceCollection services) + { + //services.AddSingleton(); + + services.Scan(scan => + scan + .FromAssembliesOf(typeof(CertificateManagementDbContext)) + .AddClasses(classes => classes.AssignableTo(typeof(IRepository<>))) + .AsImplementedInterfaces() + .WithScopedLifetime() + .AddClasses(classes => classes.AssignableTo(typeof(IQueryHandler<,>))) + .AsImplementedInterfaces() + .WithScopedLifetime() + ); + + // without Scrutor (or an alternative) we'd need to do everything by hand, like: + /* + services.AddScoped, EfRepository>(); + services.AddScoped, EfRepository>(); + services.AddScoped>, UserGroupsQueryHandler>(); + services.AddScoped, UserGroupQueryHandler>(); + // ... + */ + return services; + } + } + +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj new file mode 100644 index 00000000..dae4806d --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/O2NextGen.CertificateManagement.Application.csproj @@ -0,0 +1,42 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs new file mode 100644 index 00000000..e5a829fb --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Program.cs @@ -0,0 +1,47 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using O2NextGen.CertificateManagement.Infrastructure.Data; +using O2NextGen.CertificateManagement.StartupTasks.DatabaseInitializer; + +var builder = WebApplication.CreateBuilder(args); +ConfigurationManager configuration = builder.Configuration; +IWebHostEnvironment environment = builder.Environment; + +// Add services to the container. +builder.Services.AddControllers(); +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); +builder.Services + .AddConfigEf(configuration) + .AddDatabaseInitializer() + .AddBusiness() + .AddInfrastructure(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} +app.Use(async (context, next) => +{ + context.Response.OnStarting(() => + { + context.Response.Headers.Add("X-Powered-By", "O2NextGen Platform"); + return Task.CompletedTask; + }); + + await next.Invoke(); +}); +app.UseRouting(); +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Properties/launchSettings.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Properties/launchSettings.json new file mode 100644 index 00000000..bb0fe2e9 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/Properties/launchSettings.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:53435", + "sslPort": 44357 + } + }, + "profiles": { + "O2NextGen.CertificateManagement.Application": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "http://localhost:33597", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/WeatherForecast.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/WeatherForecast.cs new file mode 100644 index 00000000..aee3dfcc --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/WeatherForecast.cs @@ -0,0 +1,15 @@ +using System; + +namespace O2NextGen.CertificateManagement.Application +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json new file mode 100644 index 00000000..612a141b --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "ConnectionString": "Server=20.112.192.201;Initial Catalog=O2NextGen.CertificateDb-Dev;Persist Security Info=False;User ID=sa;Password=yourStrong(!)Password;Connection Timeout=30;", + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Information" + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json new file mode 100644 index 00000000..7a006974 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Application/appsettings.json @@ -0,0 +1,17 @@ +{ + "DatabaseInitializerSettings": { + "Initialize": false + }, + "ConnectionString": "Server=20.112.192.201;Initial Catalog=O2NextGen.CertificateDb;Persist Security Info=False;User ID=sa;Password=yourStrong(!)Password;Connection Timeout=30;", + "Urls": { + "Auth": "http://localhost:10001" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Models/Category.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Models/Category.cs new file mode 100644 index 00000000..86bbdb44 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Models/Category.cs @@ -0,0 +1,10 @@ +using System; +namespace O2NextGen.CertificateManagement.Business.Models +{ + public class Category + { + public long Id { get; set; } + public string Name { get; set; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICategoryService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICategoryService.cs new file mode 100644 index 00000000..50f72be1 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICategoryService.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using O2NextGen.CertificateManagement.Business.Models; + +namespace O2NextGen.CertificateManagement.Business.Services +{ + public interface ICategoryService + { + Task> GetAllAsync(CancellationToken ct); + + Task GetByIdAsync(long id, CancellationToken ct); + + Task UpdateAsync(Category category, CancellationToken ct); + + Task AddAsync(Category category, CancellationToken ct); + + Task RemoveAsync(long id, CancellationToken ct); + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICertificatesService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICertificatesService.cs index 26827ecb..1d46c006 100644 --- a/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICertificatesService.cs +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Business/Services/ICertificatesService.cs @@ -14,7 +14,7 @@ public interface ICertificatesService Task UpdateAsync(Certificate certificate, CancellationToken ct); Task AddAsync(Certificate certificate, CancellationToken ct); - + Task RemoveAsync(long id, CancellationToken ct); } } \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Data/Entities/CategoryEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Data/Entities/CategoryEntity.cs new file mode 100644 index 00000000..c82914d0 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Data/Entities/CategoryEntity.cs @@ -0,0 +1,8 @@ +namespace O2NextGen.CertificateManagement.Data.Entities +{ + public class CategoryEntity + { + public long Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs new file mode 100644 index 00000000..9e56e9ba --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IEntity.cs @@ -0,0 +1,8 @@ +using System; +namespace O2NextGen.CertificateManagement.Domain.Data +{ + public interface IEntity + { + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQuery.cs new file mode 100644 index 00000000..9b2f9689 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQuery.cs @@ -0,0 +1,8 @@ +namespace O2NextGen.CertificateManagement.Domain.Data +{ + public interface IQuery + { + + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQueryHandler.cs new file mode 100644 index 00000000..ce841088 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IQueryHandler.cs @@ -0,0 +1,11 @@ +using System.Threading; +using System.Threading.Tasks; + +namespace O2NextGen.CertificateManagement.Domain.Data +{ + public interface IQueryHandler where TQuery : IQuery + { + Task HandleAsync(TQuery query, CancellationToken ct); + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs new file mode 100644 index 00000000..d4367dbb --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/IRepository.cs @@ -0,0 +1,14 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace O2NextGen.CertificateManagement.Domain.Data +{ + public interface IRepository + { + Task AddAsync(T entity, CancellationToken ct); + Task UpdateAsync(T entity, CancellationToken ct); + Task DeleteAsync(T entity, CancellationToken ct); + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs new file mode 100644 index 00000000..19efaca1 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificateQuery.cs @@ -0,0 +1,18 @@ +using System; +using System.Text.RegularExpressions; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Domain.Data.Queries +{ + public class CertificateQuery: IQuery + { + + public CertificateQuery(long id) + { + Id = id; + } + + public long Id { get; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs new file mode 100644 index 00000000..b389776c --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Data/Queries/CertificatesQuery.cs @@ -0,0 +1,13 @@ +using System; +using O2NextGen.CertificateManagement.Domain.Data; +using System.Text.RegularExpressions; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Domain.Data.Queries +{ + public class CertificatesQuery: IQuery> + { + + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryEntity.cs new file mode 100644 index 00000000..e8a08699 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CategoryEntity.cs @@ -0,0 +1,10 @@ +using O2NextGen.CertificateManagement.Domain.Data; + +namespace O2NextGen.CertificateManagement.Domain.Entities +{ + public class CategoryEntity: IEntity + { + public long Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateEntity.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateEntity.cs new file mode 100644 index 00000000..aa63887b --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Entities/CertificateEntity.cs @@ -0,0 +1,10 @@ +using O2NextGen.CertificateManagement.Domain.Data; + +namespace O2NextGen.CertificateManagement.Domain.Entities +{ + public class CertificateEntity: IEntity + { + public long Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Mappings/MappingExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Mappings/MappingExtensions.cs new file mode 100644 index 00000000..6bba06fd --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/Mappings/MappingExtensions.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; + +namespace O2NextGen.CertificateManagement.Domain.Mappings +{ + internal static class MappingExtensions + { + public static IReadOnlyCollection MapAsReadOnly(this IEnumerable toMap, Func map) + { + _ = toMap ?? throw new ArgumentNullException(nameof(toMap)); + _ = map ?? throw new ArgumentNullException(nameof(map)); + + return toMap switch + { + IReadOnlyCollection readOnly => MapWithKnownCount(readOnly, readOnly.Count, map), + ICollection collection => MapWithKnownCount(collection, collection.Count, map), + _ => toMap.Select(map).ToList().AsReadOnly() + }; + } + + private static IReadOnlyCollection MapWithKnownCount( + IEnumerable collection, + int count, + Func map) + { + if (count == 0) + { + return Array.Empty(); + } + + var result = new TOut[count]; + var i = 0; + foreach (var entry in collection) + { + result[i] = map(entry); + ++i; + } + + return new ReadOnlyCollection(result); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj new file mode 100644 index 00000000..d12f699e --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/O2NextGen.CertificateManagement.Domain.csproj @@ -0,0 +1,59 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommand.cs new file mode 100644 index 00000000..a2d431e0 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommand.cs @@ -0,0 +1,9 @@ +using System; +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Category.CreateCategory +{ + public class CreateCategoryCommand: IRequest + { + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommandResult.cs new file mode 100644 index 00000000..b1430118 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryCommandResult.cs @@ -0,0 +1,8 @@ +using System; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Category.CreateCategory +{ + public class CreateCategoryCommandResult + { + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryHandler.cs new file mode 100644 index 00000000..5fc73ca9 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Category/CreateCategory/CreateCategoryHandler.cs @@ -0,0 +1,23 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Category.CreateCategory +{ + public class CreateCategoryHandler : IRequestHandler + { + public Task Handle(CreateCategoryCommand request, CancellationToken cancellationToken) + { + // grab user by id + + // setup category info + + // persist category + + // return persisted category info + + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs new file mode 100644 index 00000000..1a0560f0 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommand.cs @@ -0,0 +1,15 @@ +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate +{ + public class CreateCertificateCommand : IRequest + { + public string Name { get; set; } + + public CreateCertificateCommand(string name) + { + Name = name; + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs new file mode 100644 index 00000000..054ab6f3 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandHandler.cs @@ -0,0 +1,36 @@ +using System; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate +{ + public class CreateCertificateCommandHandler + : IRequestHandler + { + private readonly IRepository groupsRepository; + + public CreateCertificateCommandHandler(IRepository groupsRepository) + { + this.groupsRepository = groupsRepository; + } + public async Task Handle( + CreateCertificateCommand request, CancellationToken cancellationToken) + { + var group = new CertificateEntity + { + Name = request.Name + }; + + var addedGroup = await groupsRepository.AddAsync(group, cancellationToken); + + return new CreateCertificateCommandResult( + addedGroup.Id, + addedGroup.Name); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs new file mode 100644 index 00000000..29c2927c --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/CreateCertificate/CreateCertificateCommandResult.cs @@ -0,0 +1,17 @@ +using System; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.CreateCertificate +{ + public class CreateCertificateCommandResult + { + public CreateCertificateCommandResult(long id, string name) + { + Id = id; + Name = name; + } + + public long Id { get; } + public string Name { get; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommand.cs new file mode 100644 index 00000000..b1fb888e --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommand.cs @@ -0,0 +1,17 @@ +using System; +using System.Text.RegularExpressions; +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.DeleteCertificate +{ + public sealed class DeleteCertificateCommand : IRequest + { + public DeleteCertificateCommand(long id) + { + Id = id; + } + + public long Id { get; set; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs new file mode 100644 index 00000000..55c24a38 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/DeleteCertificate/DeleteCertificateCommandHandler.cs @@ -0,0 +1,35 @@ +using MediatR; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.DeleteCertificate +{ + public class DeleteCertificateCommandHandler : IRequestHandler + { + private readonly IQueryHandler _userGroupQueryHandler; + private readonly IRepository groupsRepository; + + public DeleteCertificateCommandHandler( + IQueryHandler userGroupQueryHandler, + IRepository groupsRepository) + { + _userGroupQueryHandler = userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler)); + this.groupsRepository = groupsRepository; + } + public async Task Handle(DeleteCertificateCommand request, CancellationToken cancellationToken) + { + var certificate = await _userGroupQueryHandler.HandleAsync( + new CertificateQuery(request.Id), + cancellationToken); + + if (certificate is object) + { + await groupsRepository.DeleteAsync(certificate, cancellationToken); + } + + return Unit.Value; + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQuery.cs new file mode 100644 index 00000000..d57c8da9 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQuery.cs @@ -0,0 +1,18 @@ +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate +{ + + public class GetCertificateQuery : IRequest + { + private long id; + + public GetCertificateQuery(long id) + { + this.Id = id; + } + + public long Id { get => id; set => id = value; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs new file mode 100644 index 00000000..9546c541 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryHandler.cs @@ -0,0 +1,47 @@ +using System; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate +{ + public class GetCertificateQueryHandler : + IRequestHandler + { + private readonly IQueryHandler _queryHandler; + + public GetCertificateQueryHandler(IQueryHandler queryHandler) + { + _queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler)); + + } + + public async Task Handle(GetCertificateQuery request, CancellationToken cancellationToken) + { + var certificate = await _queryHandler.HandleAsync( + new CertificateQuery(request.Id), + cancellationToken); + + if (certificate is null) + { + return null; + } + + return new GetCertificateQueryResult( + certificate.Id, + certificate.Name); + + //var result = await certificatesService.GetByIdAsync(request.Id, cancellationToken); + + //if (result == null) + // throw new Exception("Object not found"); + + //return new GetCertificateCommandResult(result.Id, result.Name); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs new file mode 100644 index 00000000..c980af9c --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificate/GetCertificateQueryResult.cs @@ -0,0 +1,17 @@ +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate +{ + public class GetCertificateQueryResult + { + private long id; + private string name; + + public GetCertificateQueryResult(long id, string name) + { + this.Id = id; + this.Name = name; + } + + public long Id { get => id; set => id = value; } + public string Name { get => name; set => name = value; } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQuery.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQuery.cs new file mode 100644 index 00000000..d81918b2 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQuery.cs @@ -0,0 +1,10 @@ +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate +{ + public class GetCertificatesQuery:IRequest + { + + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs new file mode 100644 index 00000000..c6d08220 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryHandler.cs @@ -0,0 +1,36 @@ +using System; +using MediatR; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; +using O2NextGen.CertificateManagement.Domain.Mappings; +using O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificates +{ + public class GetCertificatesQueryHandler + : IRequestHandler + { + private readonly IQueryHandler> queryHandler; + + public GetCertificatesQueryHandler( + IQueryHandler> queryHandler) + { + this.queryHandler = queryHandler ?? throw new ArgumentNullException(nameof(queryHandler)); + } + + public async Task Handle(GetCertificatesQuery request, CancellationToken cancellationToken) + { + var certificates = await queryHandler.HandleAsync( + new CertificatesQuery(), + cancellationToken); + + return new GetCertificatesQueryResult( + certificates.MapAsReadOnly(g => + new GetCertificatesQueryResult.Certificate( + g.Id, + g.Name))); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs new file mode 100644 index 00000000..2d0183c3 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/GetCertificates/GetCertificatesQueryResult.cs @@ -0,0 +1,26 @@ +using System.Text.RegularExpressions; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.GetCertificate +{ + public class GetCertificatesQueryResult + { + public GetCertificatesQueryResult(IReadOnlyCollection certificates) + { + Certificates = certificates; + } + + public IReadOnlyCollection Certificates { get; } + + + public class Certificate + { + public Certificate(long id, string name) + { + Id = id; + Name = name; + } + public long Id { get; set; } + public string Name { get; set; } + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs new file mode 100644 index 00000000..408c801a --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommand.cs @@ -0,0 +1,18 @@ +using System; +using MediatR; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.UpdateCertificate +{ + public class UpdateCertificateDetailsCommand: IRequest + { + public UpdateCertificateDetailsCommand(long id, string name) + { + Id = id; + Name = name; + } + + public long Id { get; } + public string Name { get; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs new file mode 100644 index 00000000..0cc8fd57 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandHandler.cs @@ -0,0 +1,45 @@ +using System.Text.RegularExpressions; +using MediatR; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Domain.UseCases.Certificate.UpdateCertificate +{ + public class UpdateCertificateDetailsCommandHandler + : IRequestHandler + { + private readonly IQueryHandler _userGroupQueryHandler; + private readonly IRepository _groupsRepository; + + public UpdateCertificateDetailsCommandHandler( + IQueryHandler userGroupQueryHandler, + IRepository groupsRepository) + { + _userGroupQueryHandler = + userGroupQueryHandler ?? throw new ArgumentNullException(nameof(userGroupQueryHandler)); + _groupsRepository = groupsRepository ?? throw new ArgumentNullException(nameof(groupsRepository)); + } + + public async Task Handle(UpdateCertificateDetailsCommand request, CancellationToken cancellationToken) + { + var certificate = await _userGroupQueryHandler.HandleAsync( + new CertificateQuery(request.Id), + cancellationToken); + + if (certificate is null) + { + return null; + } + + certificate.Name = request.Name; + + await _groupsRepository.UpdateAsync(certificate, cancellationToken); + + return new UpdateCertificateDetailsCommandResult( + certificate.Id, + certificate.Name); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs new file mode 100644 index 00000000..c71a5fe2 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Domain/UseCases/Certificate/UpdateCertificate/UpdateCertificateDetailsCommandResult.cs @@ -0,0 +1,14 @@ + +public class UpdateCertificateDetailsCommandResult +{ + public UpdateCertificateDetailsCommandResult(long id, string name) + { + Id = id; + Name = name; + } + + public long Id { get; } + public string Name { get; } +} + + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CategoryMappings.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CategoryMappings.cs new file mode 100644 index 00000000..ffeb6087 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Mappings/CategoryMappings.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using O2NextGen.CertificateManagement.Business.Models; +using O2NextGen.CertificateManagement.Data.Entities; + +namespace O2NextGen.CertificateManagement.Impl.Mappings +{ + internal static class CategoryMappings + { + public static Category ToService(this CategoryEntity entity) + { + return entity != null ? new Category() { Id = entity.Id, Name = entity.Name } : null; + } + + public static CategoryEntity ToEntity(this Category model) + { + return model != null ? new CategoryEntity() { Id = model.Id, Name = model.Name } : null; + } + + public static IReadOnlyCollection + ToService(this IReadOnlyCollection entities) => + entities.MapCollection(ToService); + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCategoriesService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCategoriesService.cs new file mode 100644 index 00000000..7747e9a5 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Impl/Services/InMemoryCategoriesService.cs @@ -0,0 +1,73 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using O2NextGen.CertificateManagement.Business.Models; +using O2NextGen.CertificateManagement.Business.Services; + +namespace O2NextGen.CertificateManagement.Impl.Services +{ + public class InMemoryCategoriesService : ICategoryService + { + #region Fields + + private static readonly List Categorys = new List() + { + new Category() + { + Id = 1, Name = "First" + } + }; + private long _currentId; + + #endregion + + #region Ctors + + public InMemoryCategoriesService() + { + _currentId = Categorys.Count(); + } + #endregion + + #region Methods + public async Task> GetAllAsync(CancellationToken ct) + { + await Task.Delay(3000, ct); + return await Task.FromResult>(Categorys.AsReadOnly()); + } + + public async Task GetByIdAsync(long id, CancellationToken ct) + { + await Task.Delay(3000, ct); + return await Task.FromResult(Categorys.SingleOrDefault(g => g.Id == id)); + } + + public async Task UpdateAsync(Category Category, CancellationToken ct) + { + await Task.Delay(5000, ct); + var toUpdate = Categorys.SingleOrDefault(g => g.Id == Category.Id); + if (toUpdate == null) + return null; + + toUpdate.Name = Category.Name; + + return await Task.FromResult(toUpdate); + } + + public async Task AddAsync(Category Category, CancellationToken ct) + { + await Task.Delay(3000, ct); + Category.Id = ++_currentId; + Categorys.Add(Category); + return await Task.FromResult(Category); + } + + public Task RemoveAsync(long id, CancellationToken ct) + { + throw new System.NotImplementedException(); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs new file mode 100644 index 00000000..554ab08e --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/CertificateManagementDbContext.cs @@ -0,0 +1,49 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Infrastructure.Data +{ + public class CertificateManagementDbContext : DbContext + { + + #region Fields + + public DbSet Certificates { get; set; } + + #endregion + + #region Ctors + + public CertificateManagementDbContext(DbContextOptions options) + : base(options) + { + } + + #endregion + + #region Configure + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfigurationsFromAssembly(GetType().Assembly); + } + + //protected override void OnModelCreating(ModelBuilder modelBuilder) + //{ + // modelBuilder.Entity(ConfigureCertificateEntity); + //} + + //private void ConfigureCertificateEntity(EntityTypeBuilder builder) + //{ + // builder.ToTable("Certificate"); + + // builder.Property(ci => ci.Id) + // .HasColumnType("bigint") + // .UseHiLo("certificate_hilo") + // .IsRequired(); + //} + + #endregion + } +} \ No newline at end of file diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateEntityConfiguration.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateEntityConfiguration.cs new file mode 100644 index 00000000..c8e68969 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Configurations/CertificateEntityConfiguration.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using O2NextGen.CertificateManagement.Domain.Entities; + +namespace O2NextGen.CertificateManagement.Infrastructure.Data.Configurations +{ + public class CertificateEntityConfiguration: IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable("Certificate"); + + builder.Property(ci => ci.Id) + .HasColumnType("bigint") + .UseHiLo("certificate_hilo") + .IsRequired(); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/EfRepository.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/EfRepository.cs new file mode 100644 index 00000000..878dc7ea --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/EfRepository.cs @@ -0,0 +1,46 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using O2NextGen.CertificateManagement.Data; +using O2NextGen.CertificateManagement.Domain.Data; + +namespace O2NextGen.CertificateManagement.Infrastructure.Data +{ + + public class EfRepository : IRepository where T : class + { + private readonly CertificateManagementDbContext _dbContext; + + public EfRepository(CertificateManagementDbContext dbContext) + { + _dbContext = dbContext; + } + + public async Task AddAsync(T entity, CancellationToken ct) + { + await _dbContext.Set().AddAsync(entity, ct); + await _dbContext.SaveChangesAsync(ct); + return entity; + } + + public async Task UpdateAsync(T entity, CancellationToken ct) + { + var entry = _dbContext.Entry(entity); + //if (entity is IVersionedEntity versionedEntity) + //{ + // entry.OriginalValues[nameof(IVersionedEntity.RowVersion)] = versionedEntity.RowVersion; + //} + entry.State = EntityState.Modified; + await _dbContext.SaveChangesAsync(ct); + } + + public async Task DeleteAsync(T entity, CancellationToken ct) + { + _dbContext.Set().Remove(entity); + await _dbContext.SaveChangesAsync(ct); + } + } + +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.Designer.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.Designer.cs new file mode 100644 index 00000000..8e29eaf9 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.Designer.cs @@ -0,0 +1,41 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using O2NextGen.CertificateManagement.Data; + +namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations +{ + [DbContext(typeof(CertificateManagementDbContext))] + [Migration("20211031114457_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.14-servicing-32113") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("Relational:Sequence:.certificate_hilo", "'certificate_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Data.Entities.CertificateEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:HiLoSequenceName", "certificate_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Certificate"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.cs new file mode 100644 index 00000000..8a92e8d0 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/20211031114457_InitialCreate.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations +{ + public partial class InitialCreate : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateSequence( + name: "certificate_hilo", + incrementBy: 10); + + migrationBuilder.CreateTable( + name: "Certificate", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false), + Name = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Certificate", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Certificate"); + + migrationBuilder.DropSequence( + name: "certificate_hilo"); + } + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagerDbContextModelSnapshot.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagerDbContextModelSnapshot.cs new file mode 100644 index 00000000..3f18d762 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Data/Migrations/CertificateManagerDbContextModelSnapshot.cs @@ -0,0 +1,39 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using O2NextGen.CertificateManagement.Data; + +namespace O2NextGen.CertificateManagement.Infrastructure.Data.Migrations +{ + [DbContext(typeof(CertificateManagementDbContext))] + partial class CertificateManagerDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.14-servicing-32113") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("Relational:Sequence:.certificate_hilo", "'certificate_hilo', '', '1', '10', '', '', 'Int64', 'False'") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("O2NextGen.CertificateManagement.Data.Entities.CertificateEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:HiLoSequenceName", "certificate_hilo") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Certificate"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj new file mode 100644 index 00000000..2ec5fcde --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/O2NextGen.CertificateManagement.Infrastructure.csproj @@ -0,0 +1,24 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + + + + + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs new file mode 100644 index 00000000..0859a68d --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificateQueryHandler.cs @@ -0,0 +1,27 @@ +using System; +using O2NextGen.CertificateManagement.Domain.Data; +using System.Text.RegularExpressions; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; +using O2NextGen.CertificateManagement.Infrastructure.Data; +using Microsoft.EntityFrameworkCore; + +namespace O2NextGen.CertificateManagement.Infrastructure.Queries +{ + public class CertificateQueryHandler : IQueryHandler + { + private readonly CertificateManagementDbContext context; + + public CertificateQueryHandler(CertificateManagementDbContext context) + { + this.context = context; + } + public async Task HandleAsync(CertificateQuery query, CancellationToken ct) + { + var result = await context.Set().FindAsync(new object[] { query.Id }, ct); + return result; + } + + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs new file mode 100644 index 00000000..54814a3d --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.Infrastructure/Queries/CertificatesQueryHandler.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using O2NextGen.CertificateManagement.Domain.Data; +using O2NextGen.CertificateManagement.Domain.Data.Queries; +using O2NextGen.CertificateManagement.Domain.Entities; +using O2NextGen.CertificateManagement.Infrastructure.Data; + +namespace O2NextGen.CertificateManagement.Infrastructure.Queries +{ + public class CertificatesQueryHandler : IQueryHandler> + { + private readonly CertificateManagementDbContext context; + + public CertificatesQueryHandler(CertificateManagementDbContext context) + { + this.context = context; + } + public async Task> HandleAsync(CertificatesQuery query, CancellationToken ct) + => (await context + .Certificates + .ToListAsync(ct)) + .AsReadOnly(); + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerHostedService.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerHostedService.cs new file mode 100644 index 00000000..2b4251fb --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerHostedService.cs @@ -0,0 +1,35 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace O2NextGen.CertificateManagement.StartupTasks.DatabaseInitializer +{ + public class DatabaseInitializerHostedService : IHostedService + where TDbContext : DbContext + { + private readonly IServiceScopeFactory _scopeFactory; + private readonly DatabaseInitializerSettings _settings; + + public DatabaseInitializerHostedService(IServiceScopeFactory scopeFactory, DatabaseInitializerSettings settings) + { + _scopeFactory = scopeFactory; + _settings = settings; + } + + public async Task StartAsync(CancellationToken cancellationToken) + { + using var scope = _scopeFactory.CreateScope(); + var dbContext = scope.ServiceProvider.GetRequiredService(); + + if (_settings.Initialize) + { + await dbContext.Database.MigrateAsync(cancellationToken); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerServiceCollectionExtensions.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerServiceCollectionExtensions.cs new file mode 100644 index 00000000..e7d2751d --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerServiceCollectionExtensions.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace O2NextGen.CertificateManagement.StartupTasks.DatabaseInitializer +{ + public static class DatabaseInitializerServiceCollectionExtensions + { + public static IServiceCollection AddDatabaseInitializer( + this IServiceCollection services, + string databaseInitializerSettingsPath = nameof(DatabaseInitializerSettings)) + where TDbContext : DbContext + { + services.AddSingleton(serviceProvider + => serviceProvider + .GetRequiredService() + .GetSection(databaseInitializerSettingsPath) + .Get()); + + return services.AddHostedService>(); + } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerSettings.cs b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerSettings.cs new file mode 100644 index 00000000..f27b3447 --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/DatabaseInitializer/DatabaseInitializerSettings.cs @@ -0,0 +1,8 @@ +namespace O2NextGen.CertificateManagement.StartupTasks.DatabaseInitializer +{ + public class DatabaseInitializerSettings + { + public bool Initialize { get; set; } + } +} + diff --git a/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.csproj b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.csproj new file mode 100644 index 00000000..ea6f48dd --- /dev/null +++ b/src/Services/c-gen/O2NextGen.CertificateManagement.StartupTasks/O2NextGen.CertificateManagement.StartupTasks.csproj @@ -0,0 +1,23 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + + + + diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryScenarioBase.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryScenarioBase.cs new file mode 100644 index 00000000..7a0fff26 --- /dev/null +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryScenarioBase.cs @@ -0,0 +1,29 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.TestHost; +using System.IO; +using System.Reflection; + +namespace IntegrationTests.O2NextGen.CertificateManagement.Api +{ + public class CategoryScenarioBase + { + public TestServer CreateServer() + { + var path = Assembly.GetAssembly(typeof(CertificateScenarioBase)) + .Location; + + var hostBuilder = new WebHostBuilder() + .UseContentRoot(Path.GetDirectoryName(path)) + .ConfigureAppConfiguration(cb => + { + // cb.AddJsonFile("appsettings.json", false) + // .AddEnvironmentVariables(); + }).UseStartup(); + + var testServer = new TestServer(hostBuilder); + + return testServer; + } + } +} + diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryServiceTests.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryServiceTests.cs new file mode 100644 index 00000000..07327f4a --- /dev/null +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CategoryServiceTests.cs @@ -0,0 +1,9 @@ +using System; +namespace IntegrationTests.O2NextGen.CertificateManagement.Api +{ + public class CategoryServiceTests : CategoryScenarioBase + { + + } +} + diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateManagementTestsStartup.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateManagementTestsStartup.cs index 1a97bb54..3fb1291d 100644 --- a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateManagementTestsStartup.cs +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateManagementTestsStartup.cs @@ -4,9 +4,9 @@ namespace IntegrationTests.O2NextGen.CertificateManagement.Api { - public class CertificateManagementTestsStartup : Startup + public class TestsStartup : Startup { - public CertificateManagementTestsStartup(IConfiguration config,IHostingEnvironment env) + public TestsStartup(IConfiguration config, IWebHostEnvironment env) : base(config,env) { } diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateScenarioBase.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateScenarioBase.cs index 13c98c59..0a4bd3e0 100644 --- a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateScenarioBase.cs +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateScenarioBase.cs @@ -18,7 +18,7 @@ public TestServer CreateServer() { // cb.AddJsonFile("appsettings.json", false) // .AddEnvironmentVariables(); - }).UseStartup(); + }).UseStartup(); var testServer = new TestServer(hostBuilder); @@ -48,10 +48,15 @@ public static string CertificateBy(int id) } } - //public static class Put - //{ - // public static string CancelOrder = "api/v1/orders/cancel"; - // public static string ShipOrder = "api/v1/orders/ship"; - //} + public static class Put + { + // public static string CancelOrder = "api/v1/orders/cancel"; + // public static string ShipOrder = "api/v1/orders/ship"; + } + + public static class Post + { + + } } } \ No newline at end of file diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateServiceTests.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateServiceTests.cs index 546b827e..0ba0d02e 100644 --- a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateServiceTests.cs +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/CertificateServiceTests.cs @@ -44,7 +44,7 @@ public class CertificateServiceTests : CertificateScenarioBase // } [Fact] - public async Task Get_get_catalogitem_by_id_and_response_not_found_status_code() + public async Task Get_certificate_item_by_id_and_response_not_found_status_code() { using (var server = CreateServer()) { diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/IntegrationTests.O2NextGen.CertificateManagement.Api.csproj b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/IntegrationTests.O2NextGen.CertificateManagement.Api.csproj index 12676734..e377fa4e 100644 --- a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/IntegrationTests.O2NextGen.CertificateManagement.Api.csproj +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Api/IntegrationTests.O2NextGen.CertificateManagement.Api.csproj @@ -8,8 +8,6 @@ - - @@ -17,10 +15,13 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + + + diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateControllerTests.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateControllerTests.cs new file mode 100644 index 00000000..061bfc1f --- /dev/null +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateControllerTests.cs @@ -0,0 +1,12 @@ +namespace IntegrationTests.O2NextGen.CertificateManagement.Application +{ + public class CertificateControllerTests + { + [Fact] + public void CertificateController_GetByIdAsync_Test() + { + + } + + } +} \ No newline at end of file diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateScenarioBase.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateScenarioBase.cs new file mode 100644 index 00000000..4219f56e --- /dev/null +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/CertificateScenarioBase.cs @@ -0,0 +1,48 @@ +using System.IO; +using System.Reflection; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.TestHost; + +namespace IntegrationTests.O2NextGen.CertificateManagement.Application +{ + public class CertificateScenarioBase + { + public TestServer CreateServer() + { + var path = Assembly.GetAssembly(typeof(CertificateScenarioBase)) + .Location; + + var hostBuilder = new WebHostBuilder() + .UseContentRoot(Path.GetDirectoryName(path)) + .ConfigureAppConfiguration(cb => + { + // cb.AddJsonFile("appsettings.json", false) + // .AddEnvironmentVariables(); + }).UseStartup(); + + var testServer = new TestServer(hostBuilder); + return testServer; + } + + public static class Get + { + public static string Certificates = "certificates"; + + public static string CertificateBy(int id) + { + return $"certificates/{id}"; + } + } + + public static class Put + { + // public static string CancelOrder = "api/v1/orders/cancel"; + // public static string ShipOrder = "api/v1/orders/ship"; + } + + public static class Post + { + + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.csproj b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.csproj new file mode 100644 index 00000000..1b839551 --- /dev/null +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/IntegrationTests.O2NextGen.CertificateManagement.Application.csproj @@ -0,0 +1,28 @@ + + + + net6.0 + enable + enable + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/TestsStartup.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/TestsStartup.cs new file mode 100644 index 00000000..398ebeb9 --- /dev/null +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/TestsStartup.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; + +namespace IntegrationTests.O2NextGen.CertificateManagement.Application +{ + public class TestsStartup : Startup + { + public TestsStartup(IConfiguration config, IWebHostEnvironment env) + : base(config, env) + { + } + } +} \ No newline at end of file diff --git a/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/Usings.cs b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/Usings.cs new file mode 100644 index 00000000..9df1d421 --- /dev/null +++ b/src/Services/c-gen/Tests/IntegrationTests.O2NextGen.CertificateManagement.Application/Usings.cs @@ -0,0 +1 @@ +global using Xunit; diff --git a/src/Services/e-sender/O2NextGen.ESender.Api/Properties/launchSettings.json b/src/Services/e-sender/O2NextGen.ESender.Api/Properties/launchSettings.json index 822f9fd5..d655c9cf 100644 --- a/src/Services/e-sender/O2NextGen.ESender.Api/Properties/launchSettings.json +++ b/src/Services/e-sender/O2NextGen.ESender.Api/Properties/launchSettings.json @@ -21,17 +21,16 @@ "commandName": "Project", "launchBrowser": true, "launchUrl": "swagger", + "applicationUrl": "https://localhost:10004;http://localhost:5004", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "https://localhost:10004;http://localhost:5004" + } }, "Docker": { "commandName": "Docker", "launchBrowser": true, "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values", - "publishAllPorts": true, - "useSSL": true + "environmentVariables": {} } } } \ No newline at end of file diff --git a/src/Services/media-basket/O2NextGen.MediaBasket.Api/Properties/launchSettings.json b/src/Services/media-basket/O2NextGen.MediaBasket.Api/Properties/launchSettings.json index a7ef2502..b02b8e8d 100644 --- a/src/Services/media-basket/O2NextGen.MediaBasket.Api/Properties/launchSettings.json +++ b/src/Services/media-basket/O2NextGen.MediaBasket.Api/Properties/launchSettings.json @@ -18,17 +18,16 @@ "O2NextGen.MediaBasket.Api": { "commandName": "Project", "launchBrowser": true, + "applicationUrl": "https://localhost:46897;http://localhost:22944", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "https://localhost:46897;http://localhost:22944" + } }, "Docker (1)": { "commandName": "Docker", "launchBrowser": true, "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", - "publishAllPorts": true, - "useSSL": true + "environmentVariables": {} } } } \ No newline at end of file diff --git a/src/Services/smalltalk/O2NextGen.SmallTalk.Api/O2NextGen.SmallTalk.Api.csproj b/src/Services/smalltalk/O2NextGen.SmallTalk.Api/O2NextGen.SmallTalk.Api.csproj index 4f32940c..87f6a0c6 100644 --- a/src/Services/smalltalk/O2NextGen.SmallTalk.Api/O2NextGen.SmallTalk.Api.csproj +++ b/src/Services/smalltalk/O2NextGen.SmallTalk.Api/O2NextGen.SmallTalk.Api.csproj @@ -21,8 +21,7 @@ - - 2.2.0 + diff --git a/src/Services/smalltalk/O2NextGen.SmallTalk.Api/Properties/launchSettings.json b/src/Services/smalltalk/O2NextGen.SmallTalk.Api/Properties/launchSettings.json index dacd9af9..53803c47 100644 --- a/src/Services/smalltalk/O2NextGen.SmallTalk.Api/Properties/launchSettings.json +++ b/src/Services/smalltalk/O2NextGen.SmallTalk.Api/Properties/launchSettings.json @@ -21,17 +21,16 @@ "commandName": "Project", "launchBrowser": true, "launchUrl": "swagger", + "applicationUrl": "https://localhost:10003;http://localhost:5003", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "https://localhost:10003;http://localhost:5003" + } }, "Docker": { "commandName": "Docker", "launchBrowser": true, "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values", - "publishAllPorts": true, - "useSSL": true + "environmentVariables": {} } } } \ No newline at end of file