diff --git a/.gitignore b/.gitignore
index 362d53f..985ffa3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -230,3 +230,6 @@ _Pvt_Extensions
# FAKE - F# Make
.fake/
+
+# Custom
+webapi/docker-compose
\ No newline at end of file
diff --git a/db/DML/categories.json b/db/DML/categories.json
index 0f72a97..6f05769 100644
--- a/db/DML/categories.json
+++ b/db/DML/categories.json
@@ -10,7 +10,7 @@
},
{
"locale": 2,
- "slug": "predefinit",
+ "slug": "predefinita",
"text": "Categoria predefinita"
}
]
diff --git a/webapi/.dockerignore b/webapi/.dockerignore
index 017d90e..3729ff0 100644
--- a/webapi/.dockerignore
+++ b/webapi/.dockerignore
@@ -22,8 +22,4 @@
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
-README.md
-
-**/node_modules
-**/npm-debug.log
-build
\ No newline at end of file
+README.md
\ No newline at end of file
diff --git a/webapi/Core/Core.csproj b/webapi/Core/Core.csproj
index e984ac7..6e4001c 100644
--- a/webapi/Core/Core.csproj
+++ b/webapi/Core/Core.csproj
@@ -7,7 +7,13 @@
+
+
+
+
+
+
diff --git a/webapi/Core/Enumerations/Errors.cs b/webapi/Core/Enumerations/Errors.cs
index a085767..e1ea229 100644
--- a/webapi/Core/Enumerations/Errors.cs
+++ b/webapi/Core/Enumerations/Errors.cs
@@ -7,9 +7,11 @@ using System.Threading.Tasks;
namespace Core.Enumerations {
public class Errors : Enumeration {
- public static Errors NullOrWhiteSpace = new(0, "is null or white space");
- public static Errors WrongOrNotManaged = new(1, "is wrong or not managed");
- public static Errors NullOrEmpty = new(2, "is null or empty");
+ public static Errors Generic = new(0, "generic error occured");
+
+ public static Errors NullOrWhiteSpace = new(1, "is null or white space");
+ public static Errors WrongOrNotManaged = new(2, "is wrong or not managed");
+ public static Errors NullOrEmpty = new(3, "is null or empty");
private Errors(int id, string displayName) : base(id, displayName) { }
}
diff --git a/webapi/Core/Middlewares/ErrorHandlerMiddleware.cs b/webapi/Core/Middlewares/ErrorHandlerMiddleware.cs
new file mode 100644
index 0000000..1aead0f
--- /dev/null
+++ b/webapi/Core/Middlewares/ErrorHandlerMiddleware.cs
@@ -0,0 +1,42 @@
+using Core.Enumerations;
+using ExtensionMethods;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+using System.Net;
+
+namespace Core.Middlewares {
+
+ ///
+ /// https://jasonwatmore.com/post/2022/01/17/net-6-global-error-handler-tutorial-with-example
+ ///
+ public class ErrorHandlerMiddleware {
+ private readonly ILogger _logger;
+ private readonly RequestDelegate _next;
+
+ public ErrorHandlerMiddleware(
+ ILogger logger,
+ RequestDelegate next) {
+ _logger = logger;
+ _next = next;
+ }
+
+ public async Task Invoke(HttpContext context) {
+ try {
+ await _next(context);
+ }
+ catch (Exception ex) {
+ _logger.LogError(ex, "Unhandled error");
+
+ var response = context.Response;
+ response.ContentType = "application/json";
+ response.StatusCode = (int)HttpStatusCode.InternalServerError;
+
+ await response.WriteAsync(new ProblemDetails {
+ Title = Errors.Generic.Name,
+ Detail = $"{Errors.Generic.Id}"
+ }.ToJson());
+ }
+ }
+ }
+}
diff --git a/webapi/DataProviders/Abstractions/SpecificBucketDataProviderBase.cs b/webapi/DataProviders/Abstractions/SpecificBucketDataProviderBase.cs
index dc282b2..7924736 100644
--- a/webapi/DataProviders/Abstractions/SpecificBucketDataProviderBase.cs
+++ b/webapi/DataProviders/Abstractions/SpecificBucketDataProviderBase.cs
@@ -12,7 +12,7 @@ namespace DataProviders.Buckets {
///
///
///
- public class SpecificBucketDataProviderBase : BucketDataProviderBase {
+ public abstract class SpecificBucketDataProviderBase : BucketDataProviderBase {
private readonly string _bucketName;
diff --git a/webapi/ReverseProxy/Dockerfile b/webapi/ReverseProxy/Dockerfile
new file mode 100644
index 0000000..016862f
--- /dev/null
+++ b/webapi/ReverseProxy/Dockerfile
@@ -0,0 +1,22 @@
+#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 ["ReverseProxy/ReverseProxy.csproj", "ReverseProxy/"]
+RUN dotnet restore "ReverseProxy/ReverseProxy.csproj"
+COPY . .
+WORKDIR "/src/ReverseProxy"
+RUN dotnet build "ReverseProxy.csproj" -c Release -o /app/build
+
+FROM build AS publish
+RUN dotnet publish "ReverseProxy.csproj" -c Release -o /app/publish
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "ReverseProxy.dll"]
diff --git a/webapi/ReverseProxy/Properties/launchSettings.json b/webapi/ReverseProxy/Properties/launchSettings.json
index 4562b2f..314e69e 100644
--- a/webapi/ReverseProxy/Properties/launchSettings.json
+++ b/webapi/ReverseProxy/Properties/launchSettings.json
@@ -1,4 +1,4 @@
-{
+{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
@@ -10,12 +10,12 @@
"profiles": {
"ReverseProxy": {
"commandName": "Project",
- "dotnetRunMessages": true,
"launchBrowser": true,
- "applicationUrl": "https://localhost:7174;http://localhost:5178",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
- }
+ },
+ "applicationUrl": "https://localhost:7174;http://localhost:5178",
+ "dotnetRunMessages": true
},
"IIS Express": {
"commandName": "IISExpress",
@@ -23,6 +23,13 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchBrowser": true,
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
+ "publishAllPorts": true,
+ "useSSL": false
}
}
-}
+}
\ No newline at end of file
diff --git a/webapi/ReverseProxy/ReverseProxy.csproj b/webapi/ReverseProxy/ReverseProxy.csproj
index b97183c..05a71f8 100644
--- a/webapi/ReverseProxy/ReverseProxy.csproj
+++ b/webapi/ReverseProxy/ReverseProxy.csproj
@@ -4,9 +4,13 @@
net6.0
enable
enable
+ ..\docker-compose.dcproj
+ a3a6c5ea-054e-4e38-b7a4-800796fa0dd3
+ Linux
+
diff --git a/webapi/ReverseProxy/appsettings.json b/webapi/ReverseProxy/appsettings.json
index 7eb8d1c..33f6967 100644
--- a/webapi/ReverseProxy/appsettings.json
+++ b/webapi/ReverseProxy/appsettings.json
@@ -25,6 +25,12 @@
]
},
"route3": {
+ "ClusterId": "cluster1",
+ "Match": {
+ "Path": "swagger/{**catchall}"
+ }
+ },
+ "route4": {
"ClusterId": "cluster2",
"Match": {
"Path": "{**catchall}"
@@ -35,7 +41,7 @@
"cluster1": {
"Destinations": {
"destination1": {
- "Address": "https://localhost:7151/"
+ "Address": "http://weatherforecast:5133/"
}
}
},
diff --git a/webapi/WeatherForecast.sln b/webapi/WeatherForecast.sln
index f8ca220..a797124 100644
--- a/webapi/WeatherForecast.sln
+++ b/webapi/WeatherForecast.sln
@@ -15,8 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataProviders", "DataProviders\DataProviders.csproj", "{13EDFAD4-5D8B-4879-96F7-D896265FB0DC}"
EndProject
-Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{38A28E4B-319A-44B0-AA9B-54F3F0362317}"
-EndProject
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "ClientApp", "ClientApp\ClientApp.njsproj", "{8531F7E2-07D6-4EC5-B3E6-316BBF4499E4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extensions", "Extensions\Extensions.csproj", "{94A44D75-4AE2-4F1A-A7E9-821710B19F93}"
@@ -33,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileSecurityService", "Serv
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReverseProxy", "ReverseProxy\ReverseProxy.csproj", "{281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}"
EndProject
+Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -59,10 +59,6 @@ Global
{13EDFAD4-5D8B-4879-96F7-D896265FB0DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13EDFAD4-5D8B-4879-96F7-D896265FB0DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13EDFAD4-5D8B-4879-96F7-D896265FB0DC}.Release|Any CPU.Build.0 = Release|Any CPU
- {38A28E4B-319A-44B0-AA9B-54F3F0362317}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {38A28E4B-319A-44B0-AA9B-54F3F0362317}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {38A28E4B-319A-44B0-AA9B-54F3F0362317}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {38A28E4B-319A-44B0-AA9B-54F3F0362317}.Release|Any CPU.Build.0 = Release|Any CPU
{8531F7E2-07D6-4EC5-B3E6-316BBF4499E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8531F7E2-07D6-4EC5-B3E6-316BBF4499E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8531F7E2-07D6-4EC5-B3E6-316BBF4499E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -91,6 +87,10 @@ Global
{281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{281F43C5-3B40-4DA6-B32B-8E8BC39D3DA3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7FC6F0BA-2DCB-4B53-A3B3-61CEEF42B9D0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/webapi/WeatherForecast/Controllers/AuthenticationController.cs b/webapi/WeatherForecast/Controllers/AuthenticationController.cs
index e0afe63..7f6ca7f 100644
--- a/webapi/WeatherForecast/Controllers/AuthenticationController.cs
+++ b/webapi/WeatherForecast/Controllers/AuthenticationController.cs
@@ -6,38 +6,38 @@ using Microsoft.AspNetCore.Mvc;
using WeatherForecast.Models.Requests;
using WeatherForecast.Services;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+
+///
+///
+///
+[AllowAnonymous]
+[ApiController]
+[Route("api/[controller]")]
+public class AuthenticationController : ControllerBase {
+
+ private readonly IAuthenticationService _authenticationService;
///
///
///
- [AllowAnonymous]
- [ApiController]
- [Route("api/[controller]")]
- public class AuthenticationController : ControllerBase {
+ ///
+ public AuthenticationController(
+ IAuthenticationService authenticationService
+ ) {
+ _authenticationService = authenticationService;
+ }
- private readonly IAuthenticationService _authenticationService;
-
- ///
- ///
- ///
- ///
- public AuthenticationController(
- IAuthenticationService authenticationService
- ) {
- _authenticationService = authenticationService;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPost("{siteId}")]
- public IActionResult Post([FromRoute] Guid siteId, [FromBody] AuthenticationRequestModel requestData) {
- var result = _authenticationService.Post(siteId, requestData);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("{siteId}")]
+ public IActionResult Post([FromRoute] Guid siteId, [FromBody] AuthenticationRequestModel requestData) {
+ var result = _authenticationService.Post(siteId, requestData);
+ return result.ToActionResult();
}
}
+
diff --git a/webapi/WeatherForecast/Controllers/BlogItemController.cs b/webapi/WeatherForecast/Controllers/BlogItemController.cs
index efa94ea..4c157bf 100644
--- a/webapi/WeatherForecast/Controllers/BlogItemController.cs
+++ b/webapi/WeatherForecast/Controllers/BlogItemController.cs
@@ -6,86 +6,86 @@ using DomainResults.Mvc;
using WeatherForecast.Services;
using WeatherForecast.Models.Requests;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+///
+///
+///
+[Authorize(Policy = "")]
+[ApiController]
+[Route("api/[controller]")]
+public class BlogItemController : ControllerBase {
+
+ private readonly IBlogItemService _blogItemService;
///
///
///
- [Authorize]
- [ApiController]
- [Route("api/[controller]")]
- public class BlogItemController : ControllerBase {
+ ///
+ public BlogItemController(
+ IBlogItemService blogItemService
+ ) {
+ _blogItemService = blogItemService;
+ }
- private readonly IBlogItemService _blogItemService;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("{siteId}")]
+ public IActionResult Post([FromRoute] Guid siteId, [FromBody] BlogItemRequestModel requestData) {
+ var result = _blogItemService.Post(siteId, requestData);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- public BlogItemController(
- IBlogItemService blogItemService
- ) {
- _blogItemService = blogItemService;
- }
+ ///
+ /// Returns full object
+ ///
+ ///
+ [HttpGet("{siteId}/{blogId}")]
+ public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid blogId) {
+ var result = _blogItemService.Get(siteId, blogId);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPost("{siteId}")]
- public IActionResult Post([FromRoute] Guid siteId, [FromBody] BlogItemRequestModel requestData) {
- var result = _blogItemService.Post(siteId, requestData);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [AllowAnonymous]
+ [HttpGet("{siteId}")]
+ public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
+ var result = _blogItemService.GetSlug(siteId, slug);
+ return result.ToActionResult();
+ }
- ///
- /// Returns full object
- ///
- ///
- [HttpGet("{siteId}/{blogId}")]
- public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid blogId) {
- var result = _blogItemService.Get(siteId, blogId);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPut("{siteId}/{blogId}")]
+ public IActionResult Update([FromRoute] Guid siteId, [FromRoute] Guid blogId, [FromBody] BlogItemRequestModel requestData) {
+ var result = _blogItemService.Update(siteId, blogId, requestData);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpGet("{siteId}")]
- public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
- var result = _blogItemService.GetSlug(siteId, slug);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPut("{siteId}/{blogId}")]
- public IActionResult Update([FromRoute] Guid siteId, [FromRoute] Guid blogId, [FromBody] BlogItemRequestModel requestData) {
- var result = _blogItemService.Update(siteId, blogId, requestData);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpDelete("{siteId}/{blogId}")]
- public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid blogId) {
- var result = _blogItemService.Delete(siteId, blogId);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpDelete("{siteId}/{blogId}")]
+ public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid blogId) {
+ var result = _blogItemService.Delete(siteId, blogId);
+ return result.ToActionResult();
}
}
+
diff --git a/webapi/WeatherForecast/Controllers/BlogItemsController.cs b/webapi/WeatherForecast/Controllers/BlogItemsController.cs
index 3b0751f..8e59ca6 100644
--- a/webapi/WeatherForecast/Controllers/BlogItemsController.cs
+++ b/webapi/WeatherForecast/Controllers/BlogItemsController.cs
@@ -10,7 +10,7 @@ namespace WeatherForecast.Controllers;
///
///
///
-[AllowAnonymous]
+[Authorize(Policy = "")]
[ApiController]
[Route("api/[controller]")]
public class BlogItemsController : ControllerBase {
@@ -37,6 +37,7 @@ public class BlogItemsController : ControllerBase {
///
///
///
+ [AllowAnonymous]
[HttpGet("{siteId}")]
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] string? searchText, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale) {
var result = _blogItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, locale, searchText);
diff --git a/webapi/WeatherForecast/Controllers/CategoryItemController.cs b/webapi/WeatherForecast/Controllers/CategoryItemController.cs
index 5f52e89..0688340 100644
--- a/webapi/WeatherForecast/Controllers/CategoryItemController.cs
+++ b/webapi/WeatherForecast/Controllers/CategoryItemController.cs
@@ -6,86 +6,86 @@ using DomainResults.Mvc;
using WeatherForecast.Services;
using WeatherForecast.Models.Requests;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+
+///
+///
+///
+[Authorize]
+[ApiController]
+[Route("api/[controller]")]
+public class CategoryItemController : ControllerBase {
+
+ private readonly ICategoryItemService _categoryItemService;
///
///
///
- [Authorize]
- [ApiController]
- [Route("api/[controller]")]
- public class CategoryItemController : ControllerBase {
+ ///
+ public CategoryItemController(
+ ICategoryItemService categoryItemService) {
+ _categoryItemService = categoryItemService;
+ }
- private readonly ICategoryItemService _categoryItemService;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("{siteId}")]
+ public IActionResult Post([FromRoute] Guid siteId, [FromBody] CategoryItemRequestModel requestData) {
+ var result = _categoryItemService.Post(siteId, requestData);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- public CategoryItemController(
- ICategoryItemService categoryItemService) {
- _categoryItemService = categoryItemService;
- }
+ ///
+ /// Returns full object
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{siteId}/{categoryId}")]
+ public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid categoryId) {
+ var result = _categoryItemService.Get(siteId, categoryId);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPost("{siteId}")]
- public IActionResult Post([FromRoute] Guid siteId, [FromBody] CategoryItemRequestModel requestData) {
- var result = _categoryItemService.Post(siteId, requestData);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ [AllowAnonymous]
+ [HttpGet("{siteId}")]
+ public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
+ var result = _categoryItemService.GetSlug(siteId, slug);
+ return result.ToActionResult();
+ }
- ///
- /// Returns full object
- ///
- ///
- ///
- ///
- [HttpGet("{siteId}/{categoryId}")]
- public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid categoryId) {
- var result = _categoryItemService.Get(siteId, categoryId);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPut("{siteId}/{categoryId}")]
+ public IActionResult Update([FromRoute] Guid siteId, [FromRoute] Guid categoryId, [FromBody] CategoryItemRequestModel requestData) {
+ var result = _categoryItemService.Update(siteId, categoryId, requestData);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- ///
- [AllowAnonymous]
- [HttpGet("{siteId}")]
- public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
- var result = _categoryItemService.GetSlug(siteId, slug);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPut("{siteId}/{categoryId}")]
- public IActionResult Update([FromRoute] Guid siteId, [FromRoute] Guid categoryId, [FromBody] CategoryItemRequestModel requestData) {
- var result = _categoryItemService.Update(siteId, categoryId, requestData);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpDelete("{siteId}/{categoryId}")]
- public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid categoryId) {
- var result = _categoryItemService.Delete(siteId, categoryId);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpDelete("{siteId}/{categoryId}")]
+ public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid categoryId) {
+ var result = _categoryItemService.Delete(siteId, categoryId);
+ return result.ToActionResult();
}
}
+
diff --git a/webapi/WeatherForecast/Controllers/CategoryItemsController.cs b/webapi/WeatherForecast/Controllers/CategoryItemsController.cs
index 5dcd939..64c2667 100644
--- a/webapi/WeatherForecast/Controllers/CategoryItemsController.cs
+++ b/webapi/WeatherForecast/Controllers/CategoryItemsController.cs
@@ -5,50 +5,50 @@ using DomainResults.Mvc;
using WeatherForecast.Services;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+
+///
+///
+///
+[Authorize]
+[ApiController]
+[Route("api/[controller]")]
+public class CategoryItemsController : ControllerBase {
+
+ private readonly ICategoryItemsService _categoryItemsService;
///
///
///
- [Authorize]
- [ApiController]
- [Route("api/[controller]")]
- public class CategoryItemsController : ControllerBase {
+ ///
+ public CategoryItemsController(
+ ICategoryItemsService categoryItemsService
+ ) {
+ _categoryItemsService = categoryItemsService;
+ }
- private readonly ICategoryItemsService _categoryItemsService;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{siteId}")]
+ public IActionResult Get([FromRoute] Guid siteId, [FromQuery] string? locale) {
+ var result = _categoryItemsService.Get(siteId, locale);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- public CategoryItemsController(
- ICategoryItemsService categoryItemsService
- ) {
- _categoryItemsService = categoryItemsService;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpGet("{siteId}")]
- public IActionResult Get([FromRoute] Guid siteId, [FromQuery] string? locale) {
- var result = _categoryItemsService.Get(siteId, locale);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- [AllowAnonymous]
- [HttpDelete("{siteId}")]
- public IActionResult Delete([FromRoute] Guid siteId) {
- var result = _categoryItemsService.Delete(siteId);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ [AllowAnonymous]
+ [HttpDelete("{siteId}")]
+ public IActionResult Delete([FromRoute] Guid siteId) {
+ var result = _categoryItemsService.Delete(siteId);
+ return result.ToActionResult();
}
}
+
diff --git a/webapi/WeatherForecast/Controllers/FileController.cs b/webapi/WeatherForecast/Controllers/FileController.cs
index a85ea4d..f675f2c 100644
--- a/webapi/WeatherForecast/Controllers/FileController.cs
+++ b/webapi/WeatherForecast/Controllers/FileController.cs
@@ -4,72 +4,72 @@ using Microsoft.AspNetCore.Mvc;
using System.Net.Http.Headers;
using WeatherForecast.Services;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+
+///
+///
+///
+[Authorize]
+[AllowAnonymous]
+[Route("api/[controller]")]
+public class FileController : Controller {
+
+ private readonly IFileService _fileService;
///
///
///
- [Authorize]
- [AllowAnonymous]
- [Route("api/[controller]")]
- public class FileController : Controller {
+ ///
+ public FileController(
+ IFileService fileService
+ ) {
+ _fileService = fileService;
+ }
- private readonly IFileService _fileService;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("{siteId}/{userId}")]
+ public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, IFormFile file) {
+ var result = _fileService.Post(siteId, userId, file);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- public FileController(
- IFileService fileService
- ) {
- _fileService = fileService;
- }
+ ///
+ /// https://www.c-sharpcorner.com/article/fileresult-in-asp-net-core-mvc2/
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{siteId}/{userId}/{fileId}")]
+ public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userid, [FromRoute] Guid fileId) {
+ var (file, result) = _fileService.Get(siteId, userid, fileId);
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPost("{siteId}/{userId}")]
- public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, IFormFile file) {
- var result = _fileService.Post(siteId, userId, file);
+ if (!result.IsSuccess || file == null)
return result.ToActionResult();
- }
- ///
- /// https://www.c-sharpcorner.com/article/fileresult-in-asp-net-core-mvc2/
- ///
- ///
- ///
- ///
- ///
- [HttpGet("{siteId}/{userId}/{fileId}")]
- public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userid, [FromRoute] Guid fileId) {
- var (file, result) = _fileService.Get(siteId, userid, fileId);
+ var stream = new MemoryStream(file.Bytes);
+ return new FileStreamResult(stream, file.ContentType) {
+ FileDownloadName = file.Name
+ };
+ }
- if (!result.IsSuccess || file == null)
- return result.ToActionResult();
-
- var stream = new MemoryStream(file.Bytes);
- return new FileStreamResult(stream, file.ContentType) {
- FileDownloadName = file.Name
- };
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpDelete("{siteId}/{userId}/{fileId}")]
- public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] Guid fileId) {
- var result = _fileService.Delete(siteId, userId, fileId);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpDelete("{siteId}/{userId}/{fileId}")]
+ public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] Guid fileId) {
+ var result = _fileService.Delete(siteId, userId, fileId);
+ return result.ToActionResult();
}
}
+
diff --git a/webapi/WeatherForecast/Controllers/FilesController.cs b/webapi/WeatherForecast/Controllers/FilesController.cs
index bda1d78..69ea626 100644
--- a/webapi/WeatherForecast/Controllers/FilesController.cs
+++ b/webapi/WeatherForecast/Controllers/FilesController.cs
@@ -3,52 +3,52 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using WeatherForecast.Services;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+
+///
+///
+///
+[Authorize]
+[AllowAnonymous]
+[Route("api/[controller]")]
+public class FilesController : Controller {
+
+ private readonly IFilesService _filesService;
///
///
///
- [Authorize]
- [AllowAnonymous]
- [Route("api/[controller]")]
- public class FilesController : Controller {
+ ///
+ public FilesController(
+ IFilesService filesService
+ ) {
+ _filesService = filesService;
+ }
- private readonly IFilesService _filesService;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("{siteId}/{userId}")]
+ public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, List file) {
+ var result = _filesService.Post(siteId, userId, file);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- public FilesController(
- IFilesService filesService
- ) {
- _filesService = filesService;
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPost("{siteId}/{userId}")]
- public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, List file) {
- var result = _filesService.Post(siteId, userId, file);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
-
- [HttpDelete("{siteId}/{userId}")]
- public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId) {
- var result = _filesService.Delete(siteId, userId);
- return result.ToActionResult();
- }
+ [HttpDelete("{siteId}/{userId}")]
+ public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId) {
+ var result = _filesService.Delete(siteId, userId);
+ return result.ToActionResult();
}
}
+
diff --git a/webapi/WeatherForecast/Controllers/ImageController.cs b/webapi/WeatherForecast/Controllers/ImageController.cs
index 0920acf..aecbcf3 100644
--- a/webapi/WeatherForecast/Controllers/ImageController.cs
+++ b/webapi/WeatherForecast/Controllers/ImageController.cs
@@ -4,49 +4,48 @@ using Microsoft.AspNetCore.Authorization;
using WeatherForecast.Services;
using DomainResults.Mvc;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+
+///
+///
+///
+[AllowAnonymous]
+[Route("api/[controller]")]
+[ApiController]
+public class ImageController : ControllerBase {
+
+ private readonly IImageService _imageService;
///
///
///
- [AllowAnonymous]
- [Route("api/[controller]")]
- [ApiController]
- public class ImageController : ControllerBase {
-
- private readonly IImageService _imageService;
-
- ///
- ///
- ///
- ///
- public ImageController(
- IImageService imgeService
- ) {
- _imageService = imgeService;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpGet("{siteId}/{width}x{height}/{imageId}")]
- public IActionResult Get([FromRoute] Guid siteId, [FromRoute] int width, [FromRoute] int height, [FromRoute] Guid imageId) {
-
- var (file, result) = _imageService.Get(siteId, width, height, imageId);
-
- if (!result.IsSuccess || file == null)
- return result.ToActionResult();
-
- var stream = new MemoryStream(file.Bytes);
- return new FileStreamResult(stream, file.ContentType) {
- FileDownloadName = file.Name
- };
- }
-
+ ///
+ public ImageController(
+ IImageService imgeService
+ ) {
+ _imageService = imgeService;
}
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{siteId}/{width}x{height}/{imageId}")]
+ public IActionResult Get([FromRoute] Guid siteId, [FromRoute] int width, [FromRoute] int height, [FromRoute] Guid imageId) {
+
+ var (file, result) = _imageService.Get(siteId, width, height, imageId);
+
+ if (!result.IsSuccess || file == null)
+ return result.ToActionResult();
+
+ var stream = new MemoryStream(file.Bytes);
+ return new FileStreamResult(stream, file.ContentType) {
+ FileDownloadName = file.Name
+ };
+ }
+
}
diff --git a/webapi/WeatherForecast/Controllers/PasswordController.cs b/webapi/WeatherForecast/Controllers/PasswordController.cs
index 72153d5..410978c 100644
--- a/webapi/WeatherForecast/Controllers/PasswordController.cs
+++ b/webapi/WeatherForecast/Controllers/PasswordController.cs
@@ -5,34 +5,35 @@ using Microsoft.AspNetCore.Mvc;
using WeatherForecast.Models.Requests;
using WeatherForecast.Services;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+
+///
+///
+///
+[Authorize]
+[Route("api/[controller]")]
+[ApiController]
+public class PasswordController : ControllerBase {
+
+ private readonly IPasswordService _passwordService;
+
+ public PasswordController(
+ IPasswordService passwordService
+ ) {
+ _passwordService = passwordService;
+ }
+
///
///
///
- [Authorize]
- [Route("api/[controller]")]
- [ApiController]
- public class PasswordController : ControllerBase {
-
- private readonly IPasswordService _passwordService;
-
- public PasswordController(
- IPasswordService passwordService
- ) {
- _passwordService = passwordService;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPost("{siteId}/{userId}")]
- public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromBody] PasswordRequestModel requestData) {
- var result = _passwordService.Post(siteId, userId, requestData);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("{siteId}/{userId}")]
+ public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromBody] PasswordRequestModel requestData) {
+ var result = _passwordService.Post(siteId, userId, requestData);
+ return result.ToActionResult();
}
}
+
diff --git a/webapi/WeatherForecast/Controllers/ShopCartItemController.cs b/webapi/WeatherForecast/Controllers/ShopCartItemController.cs
index caa1ae5..2ceaa69 100644
--- a/webapi/WeatherForecast/Controllers/ShopCartItemController.cs
+++ b/webapi/WeatherForecast/Controllers/ShopCartItemController.cs
@@ -6,78 +6,78 @@ using DomainResults.Mvc;
using WeatherForecast.Services;
using WeatherForecast.Models.Requests;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+///
+///
+///
+[Authorize]
+[AllowAnonymous]
+[Route("api/[controller]")]
+public class ShopCartItemController : ControllerBase {
+
+ private readonly IShopCartItemService _shopCartItemService;
+
///
///
///
- [Authorize]
- [AllowAnonymous]
- [Route("api/[controller]")]
- public class ShopCartItemController : ControllerBase {
+ ///
+ public ShopCartItemController(
+ IShopCartItemService shopCartItemService
+ ) {
+ _shopCartItemService = shopCartItemService;
+ }
- private readonly IShopCartItemService _shopCartItemService;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("{siteId}/{userId}/{sku}")]
+ public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku, [FromBody] ShopCartItemRequestModel requestData) {
+ var result = _shopCartItemService.Post(siteId, userId, sku, requestData);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- public ShopCartItemController(
- IShopCartItemService shopCartItemService
- ) {
- _shopCartItemService = shopCartItemService;
- }
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{siteId}/{userId}/{sku}")]
+ public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku, [FromQuery] string? locale) {
+ var result = _shopCartItemService.Get(siteId, userId, sku, locale);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPost("{siteId}/{userId}/{sku}")]
- public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku, [FromBody] ShopCartItemRequestModel requestData) {
- var result = _shopCartItemService.Post(siteId, userId, sku, requestData);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPut("{siteId}/{userId}/{sku}")]
+ public IActionResult Update([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku, [FromBody] ShopCartItemRequestModel requestData) {
+ var result = _shopCartItemService.Update(siteId, userId, sku, requestData);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- [HttpGet("{siteId}/{userId}/{sku}")]
- public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku, [FromQuery] string? locale) {
- var result = _shopCartItemService.Get(siteId, userId, sku, locale);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPut("{siteId}/{userId}/{sku}")]
- public IActionResult Update([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku, [FromBody] ShopCartItemRequestModel requestData) {
- var result = _shopCartItemService.Update(siteId, userId, sku, requestData);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpDelete("{siteId}/{userId}/{sku}")]
- public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku) {
- var result = _shopCartItemService.Delete(siteId, userId, sku);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpDelete("{siteId}/{userId}/{sku}")]
+ public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromRoute] string sku) {
+ var result = _shopCartItemService.Delete(siteId, userId, sku);
+ return result.ToActionResult();
}
}
+
diff --git a/webapi/WeatherForecast/Controllers/ShopCartItemsController.cs b/webapi/WeatherForecast/Controllers/ShopCartItemsController.cs
index b467e70..91ebf13 100644
--- a/webapi/WeatherForecast/Controllers/ShopCartItemsController.cs
+++ b/webapi/WeatherForecast/Controllers/ShopCartItemsController.cs
@@ -5,50 +5,49 @@ using DomainResults.Mvc;
using WeatherForecast.Services;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+///
+///
+///
+[Authorize]
+[AllowAnonymous]
+[Route("api/[controller]")]
+public class ShopCartItemsController : ControllerBase {
+
+ private readonly IShopCartItemsService _shopCartItemsService;
+
///
///
///
- [Authorize]
- [AllowAnonymous]
- [Route("api/[controller]")]
- public class ShopCartItemsController : ControllerBase {
-
- private readonly IShopCartItemsService _shopCartItemsService;
-
- ///
- ///
- ///
- ///
- public ShopCartItemsController(
- IShopCartItemsService shopCartItemsService
- ) {
- _shopCartItemsService = shopCartItemsService;
- }
-
- ///
- ///
- ///
- ///
- [HttpGet("{siteId}/{userId}")]
- public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromQuery] string? locale) {
- var result = _shopCartItemsService.Get(siteId, userId, locale);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpDelete("{siteId}/{userId}")]
- public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId) {
- var result = _shopCartItemsService.Delete(siteId, userId);
- return result.ToActionResult();
- }
-
+ ///
+ public ShopCartItemsController(
+ IShopCartItemsService shopCartItemsService
+ ) {
+ _shopCartItemsService = shopCartItemsService;
}
+
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{siteId}/{userId}")]
+ public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userId, [FromQuery] string? locale) {
+ var result = _shopCartItemsService.Get(siteId, userId, locale);
+ return result.ToActionResult();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpDelete("{siteId}/{userId}")]
+ public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId) {
+ var result = _shopCartItemsService.Delete(siteId, userId);
+ return result.ToActionResult();
+ }
+
}
diff --git a/webapi/WeatherForecast/Controllers/ShopItemController.cs b/webapi/WeatherForecast/Controllers/ShopItemController.cs
index 0f61c11..1aa681a 100644
--- a/webapi/WeatherForecast/Controllers/ShopItemController.cs
+++ b/webapi/WeatherForecast/Controllers/ShopItemController.cs
@@ -6,89 +6,89 @@ using DomainResults.Mvc;
using WeatherForecast.Services;
using WeatherForecast.Models.Requests;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+
+///
+///
+///
+[Authorize]
+[ApiController]
+[Route("api/[controller]")]
+public class ShopItemController : ControllerBase {
+
+ private readonly IShopItemService _shopItemService;
///
///
///
- [Authorize]
- [ApiController]
- [Route("api/[controller]")]
- public class ShopItemController : ControllerBase {
+ ///
+ public ShopItemController(
+ IShopItemService shopItemService
+ ) {
+ _shopItemService = shopItemService;
+ }
- private readonly IShopItemService _shopItemService;
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("{siteId}/{sku}")]
+ public IActionResult Post([FromRoute] Guid siteId, [FromRoute] string sku, [FromBody] ShopItemRequestModel requestData) {
+ var result = _shopItemService.Post(siteId, sku, requestData);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- public ShopItemController(
- IShopItemService shopItemService
- ) {
- _shopItemService = shopItemService;
- }
+ ///
+ /// Returns full object
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{siteId}/{sku}")]
+ public IActionResult Get([FromRoute] Guid siteId, [FromRoute] string sku) {
+ var result = _shopItemService.Get(siteId, sku);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPost("{siteId}/{sku}")]
- public IActionResult Post([FromRoute] Guid siteId, [FromRoute] string sku, [FromBody] ShopItemRequestModel requestData) {
- var result = _shopItemService.Post(siteId, sku, requestData);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [AllowAnonymous]
+ [HttpGet("{siteId}")]
+ public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
+ var result = _shopItemService.GetSlug(siteId, slug);
+ return result.ToActionResult();
+ }
- ///
- /// Returns full object
- ///
- ///
- ///
- ///
- [HttpGet("{siteId}/{sku}")]
- public IActionResult Get([FromRoute] Guid siteId, [FromRoute] string sku) {
- var result = _shopItemService.Get(siteId, sku);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPut("{siteId}/{sku}")]
+ public IActionResult Update([FromRoute] Guid siteId, [FromRoute] string sku, [FromBody] ShopItemRequestModel requestData) {
+ var result = _shopItemService.Update(siteId, sku, requestData);
+ return result.ToActionResult();
+ }
- ///
- ///
- ///
- ///
- ///
- ///
- [AllowAnonymous]
- [HttpGet("{siteId}")]
- public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
- var result = _shopItemService.GetSlug(siteId, slug);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpPut("{siteId}/{sku}")]
- public IActionResult Update([FromRoute] Guid siteId, [FromRoute] string sku, [FromBody] ShopItemRequestModel requestData) {
- var result = _shopItemService.Update(siteId, sku, requestData);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpDelete("{siteId}/{sku}")]
- public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] string sku) {
- var result = _shopItemService.Delete(siteId, sku);
- return result.ToActionResult();
- }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpDelete("{siteId}/{sku}")]
+ public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] string sku) {
+ var result = _shopItemService.Delete(siteId, sku);
+ return result.ToActionResult();
}
}
+
diff --git a/webapi/WeatherForecast/Controllers/ShopItemsController.cs b/webapi/WeatherForecast/Controllers/ShopItemsController.cs
index db9cccc..e920732 100644
--- a/webapi/WeatherForecast/Controllers/ShopItemsController.cs
+++ b/webapi/WeatherForecast/Controllers/ShopItemsController.cs
@@ -5,53 +5,52 @@ using DomainResults.Mvc;
using WeatherForecast.Services;
-namespace WeatherForecast.Controllers {
+namespace WeatherForecast.Controllers;
+
+///
+///
+///
+[Authorize]
+[ApiController]
+[Route("api/[controller]")]
+public class ShopItemsController : ControllerBase {
+
+ private readonly IShopItemsService _shopItemsService;
///
///
///
- [Authorize]
- [ApiController]
- [Route("api/[controller]")]
- public class ShopItemsController : ControllerBase {
-
- private readonly IShopItemsService _shopItemsService;
-
- ///
- ///
- ///
- ///
- public ShopItemsController(
- IShopItemsService shopCatalogService
- ) {
- _shopItemsService = shopCatalogService;
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- [HttpGet("{siteId}")]
- public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale, [FromQuery] string? searchText) {
- var result = _shopItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, locale, searchText);
- return result.ToActionResult();
- }
-
- ///
- ///
- ///
- ///
- ///
- [HttpDelete("{siteId}")]
- public IActionResult Delete([FromRoute] Guid siteId) {
- var result = _shopItemsService.Delete(siteId);
- return result.ToActionResult();
- }
+ ///
+ public ShopItemsController(
+ IShopItemsService shopCatalogService
+ ) {
+ _shopItemsService = shopCatalogService;
}
-}
\ No newline at end of file
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{siteId}")]
+ public IActionResult Get([FromRoute] Guid siteId, [FromQuery] Guid? category, [FromQuery] int? currentPage, [FromQuery] int? itemsPerPage, [FromQuery] string? locale, [FromQuery] string? searchText) {
+ var result = _shopItemsService.Get(siteId, category, currentPage ?? 1, itemsPerPage ?? 8, locale, searchText);
+ return result.ToActionResult();
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpDelete("{siteId}")]
+ public IActionResult Delete([FromRoute] Guid siteId) {
+ var result = _shopItemsService.Delete(siteId);
+ return result.ToActionResult();
+ }
+}
diff --git a/webapi/WeatherForecast/Controllers/WeatherForecastController.cs b/webapi/WeatherForecast/Controllers/WeatherForecastController.cs
index 4167175..747b7b2 100644
--- a/webapi/WeatherForecast/Controllers/WeatherForecastController.cs
+++ b/webapi/WeatherForecast/Controllers/WeatherForecastController.cs
@@ -34,4 +34,4 @@ public class WeatherForecastController : ControllerBase {
})
.ToArray();
}
-}
+}
\ No newline at end of file
diff --git a/webapi/WeatherForecast/Dockerfile b/webapi/WeatherForecast/Dockerfile
index a08bf6f..f0864d2 100644
--- a/webapi/WeatherForecast/Dockerfile
+++ b/webapi/WeatherForecast/Dockerfile
@@ -8,7 +8,13 @@ EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["WeatherForecast/WeatherForecast.csproj", "WeatherForecast/"]
+COPY ["Services/FileSecurityService/FileSecurityService.csproj", "Services/FileSecurityService/"]
+COPY ["Extensions/Extensions.csproj", "Extensions/"]
COPY ["Core/Core.csproj", "Core/"]
+COPY ["Services/ImageProvider/ImageProvider.csproj", "Services/ImageProvider/"]
+COPY ["DataProviders/DataProviders.csproj", "DataProviders/"]
+COPY ["Services/JWTService/JWTService.csproj", "Services/JWTService/"]
+COPY ["Services/HashService/HashService.csproj", "Services/HashService/"]
RUN dotnet restore "WeatherForecast/WeatherForecast.csproj"
COPY . .
WORKDIR "/src/WeatherForecast"
diff --git a/webapi/WeatherForecast/Properties/launchSettings.json b/webapi/WeatherForecast/Properties/launchSettings.json
index 359f488..2859bff 100644
--- a/webapi/WeatherForecast/Properties/launchSettings.json
+++ b/webapi/WeatherForecast/Properties/launchSettings.json
@@ -11,7 +11,7 @@
"profiles": {
"WeatherForecast": {
"commandName": "Project",
- "launchBrowser": true,
+ "launchBrowser": false,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
@@ -21,7 +21,7 @@
},
"IIS Express": {
"commandName": "IISExpress",
- "launchBrowser": true,
+ "launchBrowser": false,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
@@ -30,12 +30,9 @@
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
- "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- },
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true,
- "useSSL": true
+ "useSSL": false
}
}
}
\ No newline at end of file
diff --git a/webapi/WeatherForecast/Startup.cs b/webapi/WeatherForecast/Startup.cs
index e305ed1..bda41b7 100644
--- a/webapi/WeatherForecast/Startup.cs
+++ b/webapi/WeatherForecast/Startup.cs
@@ -10,6 +10,7 @@ using FileSecurityService.Extensions;
using ImageProvider.Extensions;
using JWTService.Extensions;
using HashService.Extensions;
+using Core.Middlewares;
namespace WeatherForecast {
@@ -196,8 +197,11 @@ namespace WeatherForecast {
app.UseRouting();
// UseCors must be called before UseResponseCaching
- app.UseCors(MyAllowSpecificOrigins);
-
+ app.UseCors(MyAllowSpecificOrigins);
+
+ // global error handler
+ app.UseMiddleware();
+
app.UseAuthentication();
app.UseAuthorization();
diff --git a/webapi/WeatherForecast/appsettings.json b/webapi/WeatherForecast/appsettings.json
index 33b44e7..2a0cd54 100644
--- a/webapi/WeatherForecast/appsettings.json
+++ b/webapi/WeatherForecast/appsettings.json
@@ -22,7 +22,7 @@
"Database": {
- "ConnectionString": "mongodb://localhost:27017"
+ "ConnectionString": "mongodb://root:example@mongo:27017"
}
}
diff --git a/webapi/docker-compose.dcproj b/webapi/docker-compose.dcproj
index 8e4fcde..be68195 100644
--- a/webapi/docker-compose.dcproj
+++ b/webapi/docker-compose.dcproj
@@ -3,10 +3,10 @@
2.1
Linux
- 38a28e4b-319a-44b0-aa9b-54f3f0362317
+ 7fc6f0ba-2dcb-4b53-a3b3-61ceef42b9d0
LaunchBrowser
- {Scheme}://localhost:{ServicePort}/swagger
- weatherforecast
+ {Scheme}://localhost:{ServicePort}
+ reverseproxy
diff --git a/webapi/docker-compose.override.yml b/webapi/docker-compose.override.yml
index f8c3c97..5fb2e27 100644
--- a/webapi/docker-compose.override.yml
+++ b/webapi/docker-compose.override.yml
@@ -1,12 +1,54 @@
version: '3.4'
-#services:
-# weatherforecast:
-# environment:
-# - ASPNETCORE_ENVIRONMENT=Development
-# - ASPNETCORE_URLS=https://+:443;http://+:80
-# ports:
-# - "80"
-# - "443"
-# volumes:
-# - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
\ No newline at end of file
+networks:
+ my-network:
+ driver: "bridge"
+
+services:
+ reverseproxy:
+ environment:
+ - ASPNETCORE_ENVIRONMENT=Development
+ - ASPNETCORE_URLS=https://+:7174;http://+:5178
+ ports:
+ - "7174:7174"
+ - "5178:5178"
+ volumes:
+ - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
+ - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
+ networks:
+ - "my-network"
+
+ weatherforecast:
+ environment:
+ - ASPNETCORE_ENVIRONMENT=Development
+ - ASPNETCORE_URLS=https://+:7151;http://+:5133
+ volumes:
+ - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
+ - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
+ networks:
+ - "my-network"
+
+ mongo:
+ image: mongo
+ restart: always
+ ports:
+ - 27018:27017
+ environment:
+ MONGO_INITDB_ROOT_USERNAME: root
+ MONGO_INITDB_ROOT_PASSWORD: example
+ volumes:
+ - ./docker-compose/mongo/data/db:/data/db
+ networks:
+ - "my-network"
+
+ mongo-express:
+ image: mongo-express
+ restart: always
+ ports:
+ - 8081:8081
+ environment:
+ ME_CONFIG_MONGODB_ADMINUSERNAME: root
+ ME_CONFIG_MONGODB_ADMINPASSWORD: example
+ ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
+ networks:
+ - "my-network"
diff --git a/webapi/docker-compose.yml b/webapi/docker-compose.yml
index 230f8b1..b6cc30d 100644
--- a/webapi/docker-compose.yml
+++ b/webapi/docker-compose.yml
@@ -1,15 +1,14 @@
version: '3.4'
services:
- clientapp:
- image: ${DOCKER_REGISTRY-}clientapp
+ weatherforecast:
+ image: ${DOCKER_REGISTRY-}weatherforecast
build:
context: .
- dockerfile: ClientApp/Dockerfile
+ dockerfile: WeatherForecast/Dockerfile
+ reverseproxy:
+ image: ${DOCKER_REGISTRY-}reverseproxy
+ build:
+ context: .
+ dockerfile: ReverseProxy/Dockerfile
-
- #weatherforecast:
- # image: ${DOCKER_REGISTRY-}weatherforecast
- # build:
- # context: .
- # dockerfile: WeatherForecast/Dockerfile
diff --git a/webapi/launchSettings.json b/webapi/launchSettings.json
new file mode 100644
index 0000000..3045b6f
--- /dev/null
+++ b/webapi/launchSettings.json
@@ -0,0 +1,11 @@
+{
+ "profiles": {
+ "Docker Compose": {
+ "commandName": "DockerCompose",
+ "commandVersion": "1.0",
+ "serviceActions": {
+ "weatherforecast": "StartDebugging"
+ }
+ }
+ }
+}
\ No newline at end of file