Skip to content

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.

API - CustomerGroup - add ProducesResponseType

KrzysztofPajak4c2d5941e49c
diff --git a/src/API/Grand.Api/Controllers/OData/CustomerGroupController.cs b/src/API/Grand.Api/Controllers/OData/CustomerGroupController.cs
index 020c69b8c..389ca26aa 100644
--- a/src/API/Grand.Api/Controllers/OData/CustomerGroupController.cs
+++ b/src/API/Grand.Api/Controllers/OData/CustomerGroupController.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
@@ -27,6 +28,9 @@ namespace Grand.Api.Controllers.OData
[SwaggerOperation(summary: "Get entity from CustomerGroup by key", OperationId = "GetCustomerGroupById")]
[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.Customers))
@@ -42,6 +46,8 @@ namespace Grand.Api.Controllers.OData
[SwaggerOperation(summary: "Get entities from CustomerGroup", OperationId = "GetCustomerGroups")]
[HttpGet]
[EnableQuery(HandleNullPropagation = HandleNullPropagationOption.False)]
+ [ProducesResponseType((int)HttpStatusCode.Forbidden)]
+ [ProducesResponseType((int)HttpStatusCode.OK)]
public async Task<IActionResult> Get()
{
if (!await _permissionService.Authorize(PermissionSystemName.Customers))
@@ -52,6 +58,9 @@ namespace Grand.Api.Controllers.OData
[SwaggerOperation(summary: "Add new entity to CustomerGroup", OperationId = "InsertCustomerGroup")]
[HttpPost]
+ [ProducesResponseType((int)HttpStatusCode.Forbidden)]
+ [ProducesResponseType((int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.BadRequest)]
public async Task<IActionResult> Post([FromBody] CustomerGroupDto model)
{
if (!await _permissionService.Authorize(PermissionSystemName.Customers))
@@ -67,6 +76,10 @@ namespace Grand.Api.Controllers.OData
[SwaggerOperation(summary: "Update entity in CustomerGroup", OperationId = "UpdateCustomerGroup")]
[HttpPut]
+ [ProducesResponseType((int)HttpStatusCode.Forbidden)]
+ [ProducesResponseType((int)HttpStatusCode.OK)]
+ [ProducesResponseType((int)HttpStatusCode.BadRequest)]
+ [ProducesResponseType((int)HttpStatusCode.NotFound)]
public async Task<IActionResult> Put([FromBody] CustomerGroupDto model)
{
if (!await _permissionService.Authorize(PermissionSystemName.Customers))
@@ -88,6 +101,10 @@ namespace Grand.Api.Controllers.OData
[SwaggerOperation(summary: "Partially update entity in CustomerGroup", OperationId = "PartiallyUpdateCustomerGroup")]
[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<CustomerGroupDto> model)
{
if (!await _permissionService.Authorize(PermissionSystemName.Customers))
@@ -112,6 +129,9 @@ namespace Grand.Api.Controllers.OData
[SwaggerOperation(summary: "Delete entity in CustomerGroup", OperationId = "DeleteCustomerGroup")]
[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.Customers))