Orders work...
This commit is contained in:
@@ -12,7 +12,6 @@ public class CreateOrderCommand : IRequest<OrderDto>
|
||||
public int Quantity { get; set; }
|
||||
public Guid ProductId { get; set; }
|
||||
public Guid ProductVariantId { get; set; }
|
||||
public string? ComposingImageUrl { get; set; }
|
||||
public string[]? OriginalImageUrls { get; set; } = [];
|
||||
public string? CustomizationImageUrl { get; set; } = null!;
|
||||
public string? CustomizationDescription { get; set; } = null!;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class GetProductById(
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var product = await unitOfWork.ProductRepository
|
||||
.GetByIdAsync(request.ProductId, cancellationToken);
|
||||
.GetByIdWithCategoryAsync(request.ProductId, cancellationToken);
|
||||
|
||||
if (product == null)
|
||||
return null;
|
||||
|
||||
@@ -25,13 +25,6 @@ public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand>
|
||||
.NotEmpty()
|
||||
.WithMessage("Address ID is required.");
|
||||
|
||||
RuleFor(x => x.ComposingImageUrl)
|
||||
.MaximumLength(2048)
|
||||
.WithMessage("Composing image URL must not exceed 2048 characters.")
|
||||
.Must(BeValidUrl)
|
||||
.When(x => !string.IsNullOrEmpty(x.ComposingImageUrl))
|
||||
.WithMessage("Composing image URL must be a valid URL.");
|
||||
|
||||
RuleFor(x => x.CustomizationImageUrl)
|
||||
.MaximumLength(2048)
|
||||
.WithMessage("Customization image URL must not exceed 2048 characters.")
|
||||
|
||||
@@ -10,11 +10,12 @@ namespace Imprink.WebApi.Controllers;
|
||||
[Route("/api/products/variants")]
|
||||
public class ProductVariantsController(IMediator mediator) : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
[HttpGet("{id:guid}")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<IEnumerable<ProductVariantDto>>> GetProductVariants(
|
||||
[FromQuery] GetProductVariantsQuery query)
|
||||
Guid id)
|
||||
{
|
||||
var query = new GetProductVariantsQuery { ProductId = id };
|
||||
return Ok(await mediator.Send(query));
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ProductsController(IMediator mediator) : ControllerBase
|
||||
|
||||
[HttpGet("{id:guid}")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<PagedResultDto<ProductDto>>> GetProductById(
|
||||
public async Task<ActionResult<ProductDto>> GetProductById(
|
||||
Guid id,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user