(refactor): reimplementing docker compose
This commit is contained in:
parent
750263d466
commit
4b858008a9
3
.gitignore
vendored
3
.gitignore
vendored
@ -230,3 +230,6 @@ _Pvt_Extensions
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# Custom
|
||||
webapi/docker-compose
|
||||
@ -10,7 +10,7 @@
|
||||
},
|
||||
{
|
||||
"locale": 2,
|
||||
"slug": "predefinit",
|
||||
"slug": "predefinita",
|
||||
"text": "Categoria predefinita"
|
||||
}
|
||||
]
|
||||
|
||||
@ -22,8 +22,4 @@
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
build
|
||||
README.md
|
||||
@ -7,7 +7,13 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Extensions\Extensions.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -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) { }
|
||||
}
|
||||
|
||||
42
webapi/Core/Middlewares/ErrorHandlerMiddleware.cs
Normal file
42
webapi/Core/Middlewares/ErrorHandlerMiddleware.cs
Normal file
@ -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 {
|
||||
|
||||
/// <summary>
|
||||
/// https://jasonwatmore.com/post/2022/01/17/net-6-global-error-handler-tutorial-with-example
|
||||
/// </summary>
|
||||
public class ErrorHandlerMiddleware {
|
||||
private readonly ILogger<ErrorHandlerMiddleware> _logger;
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public ErrorHandlerMiddleware(
|
||||
ILogger<ErrorHandlerMiddleware> 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,7 @@ namespace DataProviders.Buckets {
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SpecificBucketDataProviderBase : BucketDataProviderBase {
|
||||
public abstract class SpecificBucketDataProviderBase : BucketDataProviderBase {
|
||||
|
||||
private readonly string _bucketName;
|
||||
|
||||
|
||||
22
webapi/ReverseProxy/Dockerfile
Normal file
22
webapi/ReverseProxy/Dockerfile
Normal file
@ -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"]
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,9 +4,13 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||
<UserSecretsId>a3a6c5ea-054e-4e38-b7a4-800796fa0dd3</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
|
||||
<PackageReference Include="Yarp.ReverseProxy" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -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/"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -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
|
||||
|
||||
@ -6,38 +6,38 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using WeatherForecast.Models.Requests;
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AuthenticationController : ControllerBase {
|
||||
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AuthenticationController : ControllerBase {
|
||||
/// <param name="authenticationService"></param>
|
||||
public AuthenticationController(
|
||||
IAuthenticationService authenticationService
|
||||
) {
|
||||
_authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="authenticationService"></param>
|
||||
public AuthenticationController(
|
||||
IAuthenticationService authenticationService
|
||||
) {
|
||||
_authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{siteId}")]
|
||||
public IActionResult Post([FromRoute] Guid siteId, [FromBody] AuthenticationRequestModel requestData) {
|
||||
var result = _authenticationService.Post(siteId, requestData);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{siteId}")]
|
||||
public IActionResult Post([FromRoute] Guid siteId, [FromBody] AuthenticationRequestModel requestData) {
|
||||
var result = _authenticationService.Post(siteId, requestData);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,86 +6,86 @@ using DomainResults.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
using WeatherForecast.Models.Requests;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize(Policy = "")]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BlogItemController : ControllerBase {
|
||||
|
||||
private readonly IBlogItemService _blogItemService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BlogItemController : ControllerBase {
|
||||
/// <param name="blogItemService"></param>
|
||||
public BlogItemController(
|
||||
IBlogItemService blogItemService
|
||||
) {
|
||||
_blogItemService = blogItemService;
|
||||
}
|
||||
|
||||
private readonly IBlogItemService _blogItemService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{siteId}")]
|
||||
public IActionResult Post([FromRoute] Guid siteId, [FromBody] BlogItemRequestModel requestData) {
|
||||
var result = _blogItemService.Post(siteId, requestData);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="blogItemService"></param>
|
||||
public BlogItemController(
|
||||
IBlogItemService blogItemService
|
||||
) {
|
||||
_blogItemService = blogItemService;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns full object
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}/{blogId}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid blogId) {
|
||||
var result = _blogItemService.Get(siteId, blogId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{siteId}")]
|
||||
public IActionResult Post([FromRoute] Guid siteId, [FromBody] BlogItemRequestModel requestData) {
|
||||
var result = _blogItemService.Post(siteId, requestData);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="slug"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||
var result = _blogItemService.GetSlug(siteId, slug);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns full object
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}/{blogId}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid blogId) {
|
||||
var result = _blogItemService.Get(siteId, blogId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="blogId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="slug"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||
var result = _blogItemService.GetSlug(siteId, slug);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="blogId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="blogId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}/{blogId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid blogId) {
|
||||
var result = _blogItemService.Delete(siteId, blogId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="blogId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}/{blogId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid blogId) {
|
||||
var result = _blogItemService.Delete(siteId, blogId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ namespace WeatherForecast.Controllers;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[Authorize(Policy = "")]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class BlogItemsController : ControllerBase {
|
||||
@ -37,6 +37,7 @@ public class BlogItemsController : ControllerBase {
|
||||
/// <param name="itemsPerPage"></param>
|
||||
/// <param name="locale"></param>
|
||||
/// <returns></returns>
|
||||
[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);
|
||||
|
||||
@ -6,86 +6,86 @@ using DomainResults.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
using WeatherForecast.Models.Requests;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CategoryItemController : ControllerBase {
|
||||
|
||||
private readonly ICategoryItemService _categoryItemService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CategoryItemController : ControllerBase {
|
||||
/// <param name="categoryItemService"></param>
|
||||
public CategoryItemController(
|
||||
ICategoryItemService categoryItemService) {
|
||||
_categoryItemService = categoryItemService;
|
||||
}
|
||||
|
||||
private readonly ICategoryItemService _categoryItemService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{siteId}")]
|
||||
public IActionResult Post([FromRoute] Guid siteId, [FromBody] CategoryItemRequestModel requestData) {
|
||||
var result = _categoryItemService.Post(siteId, requestData);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="categoryItemService"></param>
|
||||
public CategoryItemController(
|
||||
ICategoryItemService categoryItemService) {
|
||||
_categoryItemService = categoryItemService;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns full object
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="categoryId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}/{categoryId}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid categoryId) {
|
||||
var result = _categoryItemService.Get(siteId, categoryId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{siteId}")]
|
||||
public IActionResult Post([FromRoute] Guid siteId, [FromBody] CategoryItemRequestModel requestData) {
|
||||
var result = _categoryItemService.Post(siteId, requestData);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="slug"></param>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||
var result = _categoryItemService.GetSlug(siteId, slug);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns full object
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="categoryId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}/{categoryId}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid categoryId) {
|
||||
var result = _categoryItemService.Get(siteId, categoryId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="categoryId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="slug"></param>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||
var result = _categoryItemService.GetSlug(siteId, slug);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="categoryId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="categoryId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}/{categoryId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid categoryId) {
|
||||
var result = _categoryItemService.Delete(siteId, categoryId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="categoryId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}/{categoryId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid categoryId) {
|
||||
var result = _categoryItemService.Delete(siteId, categoryId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,50 +5,50 @@ using DomainResults.Mvc;
|
||||
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CategoryItemsController : ControllerBase {
|
||||
|
||||
private readonly ICategoryItemsService _categoryItemsService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class CategoryItemsController : ControllerBase {
|
||||
/// <param name="categoryItemsService"></param>
|
||||
public CategoryItemsController(
|
||||
ICategoryItemsService categoryItemsService
|
||||
) {
|
||||
_categoryItemsService = categoryItemsService;
|
||||
}
|
||||
|
||||
private readonly ICategoryItemsService _categoryItemsService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="locale"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] string? locale) {
|
||||
var result = _categoryItemsService.Get(siteId, locale);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="categoryItemsService"></param>
|
||||
public CategoryItemsController(
|
||||
ICategoryItemsService categoryItemsService
|
||||
) {
|
||||
_categoryItemsService = categoryItemsService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="locale"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromQuery] string? locale) {
|
||||
var result = _categoryItemsService.Get(siteId, locale);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpDelete("{siteId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId) {
|
||||
var result = _categoryItemsService.Delete(siteId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpDelete("{siteId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId) {
|
||||
var result = _categoryItemsService.Delete(siteId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,72 +4,72 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net.Http.Headers;
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
public class FileController : Controller {
|
||||
|
||||
private readonly IFileService _fileService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
public class FileController : Controller {
|
||||
/// <param name="fileService"></param>
|
||||
public FileController(
|
||||
IFileService fileService
|
||||
) {
|
||||
_fileService = fileService;
|
||||
}
|
||||
|
||||
private readonly IFileService _fileService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{siteId}/{userId}")]
|
||||
public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, IFormFile file) {
|
||||
var result = _fileService.Post(siteId, userId, file);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="fileService"></param>
|
||||
public FileController(
|
||||
IFileService fileService
|
||||
) {
|
||||
_fileService = fileService;
|
||||
}
|
||||
/// <summary>
|
||||
/// https://www.c-sharpcorner.com/article/fileresult-in-asp-net-core-mvc2/
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userid"></param>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}/{userId}/{fileId}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] Guid userid, [FromRoute] Guid fileId) {
|
||||
var (file, result) = _fileService.Get(siteId, userid, fileId);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// https://www.c-sharpcorner.com/article/fileresult-in-asp-net-core-mvc2/
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userid"></param>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
[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
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,52 +3,52 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
public class FilesController : Controller {
|
||||
|
||||
private readonly IFilesService _filesService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
public class FilesController : Controller {
|
||||
/// <param name="filesService"></param>
|
||||
public FilesController(
|
||||
IFilesService filesService
|
||||
) {
|
||||
_filesService = filesService;
|
||||
}
|
||||
|
||||
private readonly IFilesService _filesService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{siteId}/{userId}")]
|
||||
public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, List<IFormFile> file) {
|
||||
var result = _filesService.Post(siteId, userId, file);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="filesService"></param>
|
||||
public FilesController(
|
||||
IFilesService filesService
|
||||
) {
|
||||
_filesService = filesService;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{siteId}/{userId}")]
|
||||
public IActionResult Post([FromRoute] Guid siteId, [FromRoute] Guid userId, List<IFormFile> file) {
|
||||
var result = _filesService.Post(siteId, userId, file);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,49 +4,48 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using WeatherForecast.Services;
|
||||
using DomainResults.Mvc;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ImageController : ControllerBase {
|
||||
|
||||
private readonly IImageService _imageService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ImageController : ControllerBase {
|
||||
|
||||
private readonly IImageService _imageService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="imgeService"></param>
|
||||
public ImageController(
|
||||
IImageService imgeService
|
||||
) {
|
||||
_imageService = imgeService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <param name="imageId"></param>
|
||||
/// <returns></returns>
|
||||
[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
|
||||
};
|
||||
}
|
||||
|
||||
/// <param name="imgeService"></param>
|
||||
public ImageController(
|
||||
IImageService imgeService
|
||||
) {
|
||||
_imageService = imgeService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <param name="imageId"></param>
|
||||
/// <returns></returns>
|
||||
[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
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,34 +5,35 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using WeatherForecast.Models.Requests;
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class PasswordController : ControllerBase {
|
||||
|
||||
private readonly IPasswordService _passwordService;
|
||||
|
||||
public PasswordController(
|
||||
IPasswordService passwordService
|
||||
) {
|
||||
_passwordService = passwordService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class PasswordController : ControllerBase {
|
||||
|
||||
private readonly IPasswordService _passwordService;
|
||||
|
||||
public PasswordController(
|
||||
IPasswordService passwordService
|
||||
) {
|
||||
_passwordService = passwordService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,78 +6,78 @@ using DomainResults.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
using WeatherForecast.Models.Requests;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
public class ShopCartItemController : ControllerBase {
|
||||
|
||||
private readonly IShopCartItemService _shopCartItemService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
public class ShopCartItemController : ControllerBase {
|
||||
/// <param name="shopCartItemService"></param>
|
||||
public ShopCartItemController(
|
||||
IShopCartItemService shopCartItemService
|
||||
) {
|
||||
_shopCartItemService = shopCartItemService;
|
||||
}
|
||||
|
||||
private readonly IShopCartItemService _shopCartItemService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="shopCartItemService"></param>
|
||||
public ShopCartItemController(
|
||||
IShopCartItemService shopCartItemService
|
||||
) {
|
||||
_shopCartItemService = shopCartItemService;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,50 +5,49 @@ using DomainResults.Mvc;
|
||||
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
public class ShopCartItemsController : ControllerBase {
|
||||
|
||||
private readonly IShopCartItemsService _shopCartItemsService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[AllowAnonymous]
|
||||
[Route("api/[controller]")]
|
||||
public class ShopCartItemsController : ControllerBase {
|
||||
|
||||
private readonly IShopCartItemsService _shopCartItemsService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="shopCartItemsService"></param>
|
||||
public ShopCartItemsController(
|
||||
IShopCartItemsService shopCartItemsService
|
||||
) {
|
||||
_shopCartItemsService = shopCartItemsService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}/{userId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId) {
|
||||
var result = _shopCartItemsService.Delete(siteId, userId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <param name="shopCartItemsService"></param>
|
||||
public ShopCartItemsController(
|
||||
IShopCartItemsService shopCartItemsService
|
||||
) {
|
||||
_shopCartItemsService = shopCartItemsService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}/{userId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] Guid userId) {
|
||||
var result = _shopCartItemsService.Delete(siteId, userId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,89 +6,89 @@ using DomainResults.Mvc;
|
||||
using WeatherForecast.Services;
|
||||
using WeatherForecast.Models.Requests;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ShopItemController : ControllerBase {
|
||||
|
||||
private readonly IShopItemService _shopItemService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ShopItemController : ControllerBase {
|
||||
/// <param name="shopItemService"></param>
|
||||
public ShopItemController(
|
||||
IShopItemService shopItemService
|
||||
) {
|
||||
_shopItemService = shopItemService;
|
||||
}
|
||||
|
||||
private readonly IShopItemService _shopItemService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="shopItemService"></param>
|
||||
public ShopItemController(
|
||||
IShopItemService shopItemService
|
||||
) {
|
||||
_shopItemService = shopItemService;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns full object
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}/{sku}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] string sku) {
|
||||
var result = _shopItemService.Get(siteId, sku);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="slug"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||
var result = _shopItemService.GetSlug(siteId, slug);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns full object
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{siteId}/{sku}")]
|
||||
public IActionResult Get([FromRoute] Guid siteId, [FromRoute] string sku) {
|
||||
var result = _shopItemService.Get(siteId, sku);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="slug"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("{siteId}")]
|
||||
public IActionResult GetSlug([FromRoute] Guid siteId, [FromQuery] string slug) {
|
||||
var result = _shopItemService.GetSlug(siteId, slug);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <param name="requestData"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}/{sku}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] string sku) {
|
||||
var result = _shopItemService.Delete(siteId, sku);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="sku"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}/{sku}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId, [FromRoute] string sku) {
|
||||
var result = _shopItemService.Delete(siteId, sku);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,53 +5,52 @@ using DomainResults.Mvc;
|
||||
|
||||
using WeatherForecast.Services;
|
||||
|
||||
namespace WeatherForecast.Controllers {
|
||||
namespace WeatherForecast.Controllers;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ShopItemsController : ControllerBase {
|
||||
|
||||
private readonly IShopItemsService _shopItemsService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class ShopItemsController : ControllerBase {
|
||||
|
||||
private readonly IShopItemsService _shopItemsService;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="shopCatalogService"></param>
|
||||
public ShopItemsController(
|
||||
IShopItemsService shopCatalogService
|
||||
) {
|
||||
_shopItemsService = shopCatalogService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <param name="currentPage"></param>
|
||||
/// <param name="itemsPerPage"></param>
|
||||
/// <param name="locale"></param>
|
||||
/// <param name="searchText"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId) {
|
||||
var result = _shopItemsService.Delete(siteId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
/// <param name="shopCatalogService"></param>
|
||||
public ShopItemsController(
|
||||
IShopItemsService shopCatalogService
|
||||
) {
|
||||
_shopItemsService = shopCatalogService;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <param name="currentPage"></param>
|
||||
/// <param name="itemsPerPage"></param>
|
||||
/// <param name="locale"></param>
|
||||
/// <param name="searchText"></param>
|
||||
/// <returns></returns>
|
||||
[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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="siteId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{siteId}")]
|
||||
public IActionResult Delete([FromRoute] Guid siteId) {
|
||||
var result = _shopItemsService.Delete(siteId);
|
||||
return result.ToActionResult();
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,4 +34,4 @@ public class WeatherForecastController : ControllerBase {
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<ErrorHandlerMiddleware>();
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
"Database": {
|
||||
"ConnectionString": "mongodb://localhost:27017"
|
||||
"ConnectionString": "mongodb://root:example@mongo:27017"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectVersion>2.1</ProjectVersion>
|
||||
<DockerTargetOS>Linux</DockerTargetOS>
|
||||
<ProjectGuid>38a28e4b-319a-44b0-aa9b-54f3f0362317</ProjectGuid>
|
||||
<ProjectGuid>7fc6f0ba-2dcb-4b53-a3b3-61ceef42b9d0</ProjectGuid>
|
||||
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
|
||||
<DockerServiceName>weatherforecast</DockerServiceName>
|
||||
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}</DockerServiceUrl>
|
||||
<DockerServiceName>reverseproxy</DockerServiceName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="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
|
||||
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"
|
||||
|
||||
@ -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
|
||||
|
||||
11
webapi/launchSettings.json
Normal file
11
webapi/launchSettings.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Docker Compose": {
|
||||
"commandName": "DockerCompose",
|
||||
"commandVersion": "1.0",
|
||||
"serviceActions": {
|
||||
"weatherforecast": "StartDebugging"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user