diff --git a/coffeecard/CoffeeCard.WebApi/Controllers/v2/ProductsController.cs b/coffeecard/CoffeeCard.WebApi/Controllers/v2/ProductsController.cs index 5ec0e718..7bb4eafc 100644 --- a/coffeecard/CoffeeCard.WebApi/Controllers/v2/ProductsController.cs +++ b/coffeecard/CoffeeCard.WebApi/Controllers/v2/ProductsController.cs @@ -41,15 +41,17 @@ public ProductsController(IProductService productService, ClaimsUtilities claims /// /// The request containing the details of the product to be added and allowed user groups. /// The newly added product wrapped in a InitiateProductResponse object. - /// Product created + /// Product created /// Product name already exists [HttpPost] [AuthorizeRoles(UserGroup.Board)] - [ProducesResponseType(typeof(DetailedProductResponse), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(DetailedProductResponse), StatusCodes.Status201Created)] [ProducesResponseType(typeof(ApiError), StatusCodes.Status409Conflict)] public async Task> AddProduct([FromBody] AddProductRequest addProductRequest) { - return Ok(await _productService.AddProduct(addProductRequest)); + var product = await _productService.AddProduct(addProductRequest); + + return CreatedAtAction(nameof(GetProductById), new { id = product.Id, version = 2 }, product); } ///