Merge pull request #368 from SychevIgor/swagger
swagger response types and code
This commit is contained in:
commit
ebcabe2bbb
@ -6,6 +6,7 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
|||||||
using Microsoft.eShopOnContainers.Services.Basket.API.Model;
|
using Microsoft.eShopOnContainers.Services.Basket.API.Model;
|
||||||
using Microsoft.eShopOnContainers.Services.Basket.API.Services;
|
using Microsoft.eShopOnContainers.Services.Basket.API.Services;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
|
namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
|
||||||
@ -18,7 +19,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
|
|||||||
private readonly IIdentityService _identitySvc;
|
private readonly IIdentityService _identitySvc;
|
||||||
private readonly IEventBus _eventBus;
|
private readonly IEventBus _eventBus;
|
||||||
|
|
||||||
public BasketController(IBasketRepository repository,
|
public BasketController(IBasketRepository repository,
|
||||||
IIdentityService identityService,
|
IIdentityService identityService,
|
||||||
IEventBus eventBus)
|
IEventBus eventBus)
|
||||||
{
|
{
|
||||||
@ -26,8 +27,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
|
|||||||
_identitySvc = identityService;
|
_identitySvc = identityService;
|
||||||
_eventBus = eventBus;
|
_eventBus = eventBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET /id
|
// GET /id
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
|
[ProducesResponseType(typeof(CustomerBasket), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> Get(string id)
|
public async Task<IActionResult> Get(string id)
|
||||||
{
|
{
|
||||||
var basket = await _repository.GetBasketAsync(id);
|
var basket = await _repository.GetBasketAsync(id);
|
||||||
@ -37,6 +40,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
|
|||||||
|
|
||||||
// POST /value
|
// POST /value
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[ProducesResponseType(typeof(CustomerBasket), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> Post([FromBody]CustomerBasket value)
|
public async Task<IActionResult> Post([FromBody]CustomerBasket value)
|
||||||
{
|
{
|
||||||
var basket = await _repository.UpdateBasketAsync(value);
|
var basket = await _repository.UpdateBasketAsync(value);
|
||||||
@ -46,6 +50,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers
|
|||||||
|
|
||||||
[Route("checkout")]
|
[Route("checkout")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.Accepted)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
public async Task<IActionResult> Checkout([FromBody]BasketCheckout basketCheckout, [FromHeader(Name = "x-requestid")] string requestId)
|
public async Task<IActionResult> Checkout([FromBody]BasketCheckout basketCheckout, [FromHeader(Name = "x-requestid")] string requestId)
|
||||||
{
|
{
|
||||||
var userId = _identitySvc.GetUserIdentity();
|
var userId = _identitySvc.GetUserIdentity();
|
||||||
|
@ -9,6 +9,7 @@ using Microsoft.Extensions.Options;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
||||||
@ -32,6 +33,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
// GET api/v1/[controller]/items[?pageSize=3&pageIndex=10]
|
// GET api/v1/[controller]/items[?pageSize=3&pageIndex=10]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("[action]")]
|
[Route("[action]")]
|
||||||
|
[ProducesResponseType(typeof(PaginatedItemsViewModel<CatalogItem>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> Items([FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0)
|
public async Task<IActionResult> Items([FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0)
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -54,6 +56,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("items/{id:int}")]
|
[Route("items/{id:int}")]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||||
|
[ProducesResponseType(typeof(CatalogItem),(int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetItemById(int id)
|
public async Task<IActionResult> GetItemById(int id)
|
||||||
{
|
{
|
||||||
if (id <= 0)
|
if (id <= 0)
|
||||||
@ -73,6 +77,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
// GET api/v1/[controller]/items/withname/samplename[?pageSize=3&pageIndex=10]
|
// GET api/v1/[controller]/items/withname/samplename[?pageSize=3&pageIndex=10]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("[action]/withname/{name:minlength(1)}")]
|
[Route("[action]/withname/{name:minlength(1)}")]
|
||||||
|
[ProducesResponseType(typeof(PaginatedItemsViewModel<CatalogItem>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> Items(string name, [FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0)
|
public async Task<IActionResult> Items(string name, [FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -97,6 +102,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
// GET api/v1/[controller]/items/type/1/brand/null[?pageSize=3&pageIndex=10]
|
// GET api/v1/[controller]/items/type/1/brand/null[?pageSize=3&pageIndex=10]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("[action]/type/{catalogTypeId}/brand/{catalogBrandId}")]
|
[Route("[action]/type/{catalogTypeId}/brand/{catalogBrandId}")]
|
||||||
|
[ProducesResponseType(typeof(PaginatedItemsViewModel<CatalogItem>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> Items(int? catalogTypeId, int? catalogBrandId, [FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0)
|
public async Task<IActionResult> Items(int? catalogTypeId, int? catalogBrandId, [FromQuery]int pageSize = 10, [FromQuery]int pageIndex = 0)
|
||||||
{
|
{
|
||||||
var root = (IQueryable<CatalogItem>)_catalogContext.CatalogItems;
|
var root = (IQueryable<CatalogItem>)_catalogContext.CatalogItems;
|
||||||
@ -130,6 +136,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
// GET api/v1/[controller]/CatalogTypes
|
// GET api/v1/[controller]/CatalogTypes
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("[action]")]
|
[Route("[action]")]
|
||||||
|
[ProducesResponseType(typeof(List<CatalogItem>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> CatalogTypes()
|
public async Task<IActionResult> CatalogTypes()
|
||||||
{
|
{
|
||||||
var items = await _catalogContext.CatalogTypes
|
var items = await _catalogContext.CatalogTypes
|
||||||
@ -141,6 +148,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
// GET api/v1/[controller]/CatalogBrands
|
// GET api/v1/[controller]/CatalogBrands
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("[action]")]
|
[Route("[action]")]
|
||||||
|
[ProducesResponseType(typeof(List<CatalogItem>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> CatalogBrands()
|
public async Task<IActionResult> CatalogBrands()
|
||||||
{
|
{
|
||||||
var items = await _catalogContext.CatalogBrands
|
var items = await _catalogContext.CatalogBrands
|
||||||
@ -152,6 +160,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
//PUT api/v1/[controller]/items
|
//PUT api/v1/[controller]/items
|
||||||
[Route("items")]
|
[Route("items")]
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> UpdateProduct([FromBody]CatalogItem productToUpdate)
|
public async Task<IActionResult> UpdateProduct([FromBody]CatalogItem productToUpdate)
|
||||||
{
|
{
|
||||||
var catalogItem = await _catalogContext.CatalogItems
|
var catalogItem = await _catalogContext.CatalogItems
|
||||||
@ -192,6 +202,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
//POST api/v1/[controller]/items
|
//POST api/v1/[controller]/items
|
||||||
[Route("items")]
|
[Route("items")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> CreateProduct([FromBody]CatalogItem product)
|
public async Task<IActionResult> CreateProduct([FromBody]CatalogItem product)
|
||||||
{
|
{
|
||||||
var item = new CatalogItem
|
var item = new CatalogItem
|
||||||
@ -213,6 +224,7 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
//DELETE api/v1/[controller]/id
|
//DELETE api/v1/[controller]/id
|
||||||
[Route("{id}")]
|
[Route("{id}")]
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||||
public async Task<IActionResult> DeleteProduct(int id)
|
public async Task<IActionResult> DeleteProduct(int id)
|
||||||
{
|
{
|
||||||
var product = _catalogContext.CatalogItems.SingleOrDefault(x => x.Id == id);
|
var product = _catalogContext.CatalogItems.SingleOrDefault(x => x.Id == id);
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
|
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
|
||||||
@ -23,6 +24,8 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("api/v1/catalog/items/{catalogItemId:int}/pic")]
|
[Route("api/v1/catalog/items/{catalogItemId:int}/pic")]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
// GET: /<controller>/
|
// GET: /<controller>/
|
||||||
public async Task<IActionResult> GetImage(int catalogItemId)
|
public async Task<IActionResult> GetImage(int catalogItemId)
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services;
|
using Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Services;
|
||||||
|
using Microsoft.eShopOnContainers.Services.Locations.API.Model;
|
||||||
using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel;
|
using Microsoft.eShopOnContainers.Services.Locations.API.ViewModel;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Locations.API.Controllers
|
namespace Locations.API.Controllers
|
||||||
@ -23,6 +26,7 @@ namespace Locations.API.Controllers
|
|||||||
//GET api/v1/[controller]/user/1
|
//GET api/v1/[controller]/user/1
|
||||||
[Route("user/{userId:guid}")]
|
[Route("user/{userId:guid}")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[ProducesResponseType(typeof(UserLocation), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetUserLocation(Guid userId)
|
public async Task<IActionResult> GetUserLocation(Guid userId)
|
||||||
{
|
{
|
||||||
var userLocation = await _locationsService.GetUserLocation(userId.ToString());
|
var userLocation = await _locationsService.GetUserLocation(userId.ToString());
|
||||||
@ -32,6 +36,7 @@ namespace Locations.API.Controllers
|
|||||||
//GET api/v1/[controller]/
|
//GET api/v1/[controller]/
|
||||||
[Route("")]
|
[Route("")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
//[ProducesResponseType(typeof(List<Locations>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetAllLocations()
|
public async Task<IActionResult> GetAllLocations()
|
||||||
{
|
{
|
||||||
var locations = await _locationsService.GetAllLocation();
|
var locations = await _locationsService.GetAllLocation();
|
||||||
@ -41,6 +46,7 @@ namespace Locations.API.Controllers
|
|||||||
//GET api/v1/[controller]/1
|
//GET api/v1/[controller]/1
|
||||||
[Route("{locationId}")]
|
[Route("{locationId}")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
//[ProducesResponseType(typeof(List<Locations>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetLocation(int locationId)
|
public async Task<IActionResult> GetLocation(int locationId)
|
||||||
{
|
{
|
||||||
var location = await _locationsService.GetLocation(locationId);
|
var location = await _locationsService.GetLocation(locationId);
|
||||||
@ -50,6 +56,8 @@ namespace Locations.API.Controllers
|
|||||||
//POST api/v1/[controller]/
|
//POST api/v1/[controller]/
|
||||||
[Route("")]
|
[Route("")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
public async Task<IActionResult> CreateOrUpdateUserLocation([FromBody]LocationRequest newLocReq)
|
public async Task<IActionResult> CreateOrUpdateUserLocation([FromBody]LocationRequest newLocReq)
|
||||||
{
|
{
|
||||||
var userId = _identityService.GetUserIdentity();
|
var userId = _identityService.GetUserIdentity();
|
||||||
|
@ -16,6 +16,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
using Extensions.Options;
|
using Extensions.Options;
|
||||||
using Microsoft.eShopOnContainers.Services.Marketing.API.ViewModel;
|
using Microsoft.eShopOnContainers.Services.Marketing.API.ViewModel;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
[Route("api/v1/[controller]")]
|
[Route("api/v1/[controller]")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -38,6 +39,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[ProducesResponseType(typeof(List<CampaignDTO>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetAllCampaigns()
|
public async Task<IActionResult> GetAllCampaigns()
|
||||||
{
|
{
|
||||||
var campaignList = await _context.Campaigns
|
var campaignList = await _context.Campaigns
|
||||||
@ -54,6 +56,8 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id:int}")]
|
[HttpGet("{id:int}")]
|
||||||
|
[ProducesResponseType(typeof(CampaignDTO), (int)HttpStatusCode.OK)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||||
public async Task<IActionResult> GetCampaignById(int id)
|
public async Task<IActionResult> GetCampaignById(int id)
|
||||||
{
|
{
|
||||||
var campaign = await _context.Campaigns
|
var campaign = await _context.Campaigns
|
||||||
@ -70,6 +74,8 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> CreateCampaign([FromBody] CampaignDTO campaignDto)
|
public async Task<IActionResult> CreateCampaign([FromBody] CampaignDTO campaignDto)
|
||||||
{
|
{
|
||||||
if (campaignDto is null)
|
if (campaignDto is null)
|
||||||
@ -86,6 +92,9 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("{id:int}")]
|
[HttpPut("{id:int}")]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> UpdateCampaign(int id, [FromBody] CampaignDTO campaignDto)
|
public async Task<IActionResult> UpdateCampaign(int id, [FromBody] CampaignDTO campaignDto)
|
||||||
{
|
{
|
||||||
if (id < 1 || campaignDto is null)
|
if (id < 1 || campaignDto is null)
|
||||||
@ -111,6 +120,9 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpDelete("{id:int}")]
|
[HttpDelete("{id:int}")]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NoContent)]
|
||||||
public async Task<IActionResult> Delete(int id)
|
public async Task<IActionResult> Delete(int id)
|
||||||
{
|
{
|
||||||
if (id < 1)
|
if (id < 1)
|
||||||
@ -131,6 +143,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("user")]
|
[HttpGet("user")]
|
||||||
|
[ProducesResponseType(typeof(PaginatedItemsViewModel<CampaignDTO>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> GetCampaignsByUserId( int pageSize = 10, int pageIndex = 0)
|
public async Task<IActionResult> GetCampaignsByUserId( int pageSize = 10, int pageIndex = 0)
|
||||||
{
|
{
|
||||||
var userId = _identityService.GetUserIdentity();
|
var userId = _identityService.GetUserIdentity();
|
||||||
|
@ -7,6 +7,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
using Microsoft.eShopOnContainers.Services.Marketing.API.Model;
|
using Microsoft.eShopOnContainers.Services.Marketing.API.Model;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
@ -21,6 +22,9 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("api/v1/campaigns/{campaignId:int}/locations/{userLocationRuleId:int}")]
|
[Route("api/v1/campaigns/{campaignId:int}/locations/{userLocationRuleId:int}")]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||||
|
[ProducesResponseType(typeof(UserLocationRuleDTO),(int)HttpStatusCode.OK)]
|
||||||
public IActionResult GetLocationByCampaignAndLocationRuleId(int campaignId,
|
public IActionResult GetLocationByCampaignAndLocationRuleId(int campaignId,
|
||||||
int userLocationRuleId)
|
int userLocationRuleId)
|
||||||
{
|
{
|
||||||
@ -45,6 +49,9 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("api/v1/campaigns/{campaignId:int}/locations")]
|
[Route("api/v1/campaigns/{campaignId:int}/locations")]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||||
|
[ProducesResponseType(typeof(List<UserLocationRuleDTO>), (int)HttpStatusCode.OK)]
|
||||||
public IActionResult GetAllLocationsByCampaignId(int campaignId)
|
public IActionResult GetAllLocationsByCampaignId(int campaignId)
|
||||||
{
|
{
|
||||||
if (campaignId < 1)
|
if (campaignId < 1)
|
||||||
@ -69,6 +76,8 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("api/v1/campaigns/{campaignId:int}/locations")]
|
[Route("api/v1/campaigns/{campaignId:int}/locations")]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.Created)]
|
||||||
public async Task<IActionResult> CreateLocation(int campaignId,
|
public async Task<IActionResult> CreateLocation(int campaignId,
|
||||||
[FromBody] UserLocationRuleDTO locationRuleDto)
|
[FromBody] UserLocationRuleDTO locationRuleDto)
|
||||||
{
|
{
|
||||||
@ -89,6 +98,8 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers
|
|||||||
|
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
[Route("api/v1/campaigns/{campaignId:int}/locations/{userLocationRuleId:int}")]
|
[Route("api/v1/campaigns/{campaignId:int}/locations/{userLocationRuleId:int}")]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||||
public async Task<IActionResult> DeleteLocationById(int campaignId, int userLocationRuleId)
|
public async Task<IActionResult> DeleteLocationById(int campaignId, int userLocationRuleId)
|
||||||
{
|
{
|
||||||
if (campaignId < 1 || userLocationRuleId < 1)
|
if (campaignId < 1 || userLocationRuleId < 1)
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "api/values",
|
"launchUrl": "swagger",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"Marketing.API": {
|
"Marketing.API": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "api/values",
|
"launchUrl": "swagger",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
|
@ -7,6 +7,7 @@ using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
|
|||||||
using Ordering.API.Application.Commands;
|
using Ordering.API.Application.Commands;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
||||||
@ -29,6 +30,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
|||||||
|
|
||||||
[Route("cancel")]
|
[Route("cancel")]
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
public async Task<IActionResult> CancelOrder([FromBody]CancelOrderCommand command, [FromHeader(Name = "x-requestid")] string requestId)
|
public async Task<IActionResult> CancelOrder([FromBody]CancelOrderCommand command, [FromHeader(Name = "x-requestid")] string requestId)
|
||||||
{
|
{
|
||||||
bool commandResult = false;
|
bool commandResult = false;
|
||||||
@ -44,6 +47,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
|||||||
|
|
||||||
[Route("ship")]
|
[Route("ship")]
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
|
||||||
public async Task<IActionResult> ShipOrder([FromBody]ShipOrderCommand command, [FromHeader(Name = "x-requestid")] string requestId)
|
public async Task<IActionResult> ShipOrder([FromBody]ShipOrderCommand command, [FromHeader(Name = "x-requestid")] string requestId)
|
||||||
{
|
{
|
||||||
bool commandResult = false;
|
bool commandResult = false;
|
||||||
@ -59,6 +64,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
|||||||
|
|
||||||
[Route("{orderId:int}")]
|
[Route("{orderId:int}")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.OK)]
|
||||||
|
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||||
public async Task<IActionResult> GetOrder(int orderId)
|
public async Task<IActionResult> GetOrder(int orderId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
Loading…
x
Reference in New Issue
Block a user