Rebadge the rest of the files

This commit is contained in:
lumijiez
2025-06-03 18:24:40 +03:00
parent 1b6f69fcf9
commit 6a675ac111
77 changed files with 5931 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
using Imprink.Application.Products.Commands;
using Imprink.Application.Products.Dtos;
using Imprink.Application.Products.Queries;
using MediatR;
using Microsoft.AspNetCore.Mvc;
namespace Imprink.WebApi.Controllers;
[ApiController]
[Route("api/[controller]")]
public class ProductVariantsController(IMediator mediator) : ControllerBase
{
[HttpGet]
public async Task<ActionResult<IEnumerable<ProductVariantDto>>> GetProductVariants(
[FromQuery] Guid? productId = null,
[FromQuery] bool? isActive = null,
[FromQuery] bool inStockOnly = false)
{
var query = new GetProductVariantsQuery
{
ProductId = productId,
IsActive = isActive,
InStockOnly = inStockOnly
};
var result = await mediator.Send(query);
return Ok(result);
}
[HttpPost]
public async Task<ActionResult<ProductVariantDto>> CreateProductVariant([FromBody] CreateProductVariantCommand command)
{
var result = await mediator.Send(command);
return CreatedAtAction(nameof(CreateProductVariant), new { id = result.Id }, result);
}
[HttpDelete("{id:guid}")]
public async Task<ActionResult> DeleteProductVariant(Guid id)
{
var command = new DeleteProductVariantCommand { Id = id };
var result = await mediator.Send(command);
if (!result)
return NotFound();
return NoContent();
}
}