Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
API - Category - add ProducesResponseType
KrzysztofPajakf77b57475e1f
diff --git a/src/API/Grand.Api/Controllers/OData/CategoryController.cs b/src/API/Grand.Api/Controllers/OData/CategoryController.csindex deb9de51a..64f8426b4 100644--- a/src/API/Grand.Api/Controllers/OData/CategoryController.cs+++ b/src/API/Grand.Api/Controllers/OData/CategoryController.cs@@ -10,6 +10,7 @@ using Microsoft.AspNetCore.OData.Formatter;using Microsoft.AspNetCore.OData.Query;using Swashbuckle.AspNetCore.Annotations;using System.Linq;+using System.Net;using System.Threading.Tasks;namespace Grand.Api.Controllers.OData@@ -28,6 +29,9 @@ namespace Grand.Api.Controllers.OData[SwaggerOperation(summary: "Get entity from Category by key", OperationId = "GetCategoryById")][HttpGet("{key}")]+ [ProducesResponseType((int)HttpStatusCode.Forbidden)]+ [ProducesResponseType((int)HttpStatusCode.OK)]+ [ProducesResponseType((int)HttpStatusCode.NotFound)]public async Task<IActionResult> Get(string key){if (!await _permissionService.Authorize(PermissionSystemName.Categories))@@ -43,6 +47,8 @@ namespace Grand.Api.Controllers.OData[SwaggerOperation(summary: "Get entities from Category", OperationId = "GetCategories")][HttpGet][EnableQuery(HandleNullPropagation = HandleNullPropagationOption.False)]+ [ProducesResponseType((int)HttpStatusCode.Forbidden)]+ [ProducesResponseType((int)HttpStatusCode.OK)]public async Task<IActionResult> Get(){if (!await _permissionService.Authorize(PermissionSystemName.Categories))@@ -53,6 +59,9 @@ namespace Grand.Api.Controllers.OData[SwaggerOperation(summary: "Add new entity to Category", OperationId = "InsertCategory")][HttpPost]+ [ProducesResponseType((int)HttpStatusCode.Forbidden)]+ [ProducesResponseType((int)HttpStatusCode.OK)]+ [ProducesResponseType((int)HttpStatusCode.BadRequest)]public async Task<IActionResult> Post([FromBody] CategoryDto model){if (!await _permissionService.Authorize(PermissionSystemName.Categories))@@ -68,6 +77,10 @@ namespace Grand.Api.Controllers.OData[SwaggerOperation(summary: "Update entity in Category", OperationId = "UpdateCategory")][HttpPut]+ [ProducesResponseType((int)HttpStatusCode.Forbidden)]+ [ProducesResponseType((int)HttpStatusCode.OK)]+ [ProducesResponseType((int)HttpStatusCode.BadRequest)]+ [ProducesResponseType((int)HttpStatusCode.NotFound)]public async Task<IActionResult> Put([FromBody] CategoryDto model){if (!await _permissionService.Authorize(PermissionSystemName.Categories))@@ -88,6 +101,10 @@ namespace Grand.Api.Controllers.OData}[SwaggerOperation(summary: "Update entity in Category (delta)", OperationId = "UpdateCategoryPatch")][HttpPatch]+ [ProducesResponseType((int)HttpStatusCode.Forbidden)]+ [ProducesResponseType((int)HttpStatusCode.OK)]+ [ProducesResponseType((int)HttpStatusCode.BadRequest)]+ [ProducesResponseType((int)HttpStatusCode.NotFound)]public async Task<IActionResult> Patch([FromODataUri] string key, [FromBody] JsonPatchDocument<CategoryDto> model){if (!await _permissionService.Authorize(PermissionSystemName.Categories))@@ -110,6 +127,9 @@ namespace Grand.Api.Controllers.OData}[SwaggerOperation(summary: "Delete entity from Category", OperationId = "DeleteCategory")][HttpDelete]+ [ProducesResponseType((int)HttpStatusCode.Forbidden)]+ [ProducesResponseType((int)HttpStatusCode.OK)]+ [ProducesResponseType((int)HttpStatusCode.NotFound)]public async Task<IActionResult> Delete(string key){if (!await _permissionService.Authorize(PermissionSystemName.Categories))