Fix: Include ProductVariant in all order queries
Root cause: Order queries were missing .ThenInclude(oi => oi.ProductVariant) which caused ProductVariantName to be null in order DTOs even though ProductVariantId was stored correctly. Fixed queries: - GetAllOrdersAsync (admin panel order list) - GetOrdersByIdentityAsync (TeleBot order lookup) - GetOrdersByCustomerIdAsync (customer order history) - UpdateOrderStatusAsync (order status updates) Now both TeleBot and admin panel will show which product variation was selected in order details and order lists.
This commit is contained in:
parent
5ab2c51aa8
commit
330116e315
@ -31,6 +31,8 @@ public class OrderService : IOrderService
|
|||||||
.ThenInclude(oi => oi.Product)
|
.ThenInclude(oi => oi.Product)
|
||||||
.Include(o => o.Items)
|
.Include(o => o.Items)
|
||||||
.ThenInclude(oi => oi.ProductMultiBuy)
|
.ThenInclude(oi => oi.ProductMultiBuy)
|
||||||
|
.Include(o => o.Items)
|
||||||
|
.ThenInclude(oi => oi.ProductVariant)
|
||||||
.Include(o => o.Payments)
|
.Include(o => o.Payments)
|
||||||
.OrderByDescending(o => o.CreatedAt)
|
.OrderByDescending(o => o.CreatedAt)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
@ -46,6 +48,8 @@ public class OrderService : IOrderService
|
|||||||
.ThenInclude(oi => oi.Product)
|
.ThenInclude(oi => oi.Product)
|
||||||
.Include(o => o.Items)
|
.Include(o => o.Items)
|
||||||
.ThenInclude(oi => oi.ProductMultiBuy)
|
.ThenInclude(oi => oi.ProductMultiBuy)
|
||||||
|
.Include(o => o.Items)
|
||||||
|
.ThenInclude(oi => oi.ProductVariant)
|
||||||
.Include(o => o.Payments)
|
.Include(o => o.Payments)
|
||||||
.Where(o => o.IdentityReference == identityReference)
|
.Where(o => o.IdentityReference == identityReference)
|
||||||
.OrderByDescending(o => o.CreatedAt)
|
.OrderByDescending(o => o.CreatedAt)
|
||||||
@ -62,6 +66,8 @@ public class OrderService : IOrderService
|
|||||||
.ThenInclude(oi => oi.Product)
|
.ThenInclude(oi => oi.Product)
|
||||||
.Include(o => o.Items)
|
.Include(o => o.Items)
|
||||||
.ThenInclude(oi => oi.ProductMultiBuy)
|
.ThenInclude(oi => oi.ProductMultiBuy)
|
||||||
|
.Include(o => o.Items)
|
||||||
|
.ThenInclude(oi => oi.ProductVariant)
|
||||||
.Include(o => o.Payments)
|
.Include(o => o.Payments)
|
||||||
.Where(o => o.CustomerId == customerId)
|
.Where(o => o.CustomerId == customerId)
|
||||||
.OrderByDescending(o => o.CreatedAt)
|
.OrderByDescending(o => o.CreatedAt)
|
||||||
@ -232,6 +238,8 @@ public class OrderService : IOrderService
|
|||||||
.Include(o => o.Customer)
|
.Include(o => o.Customer)
|
||||||
.Include(o => o.Items)
|
.Include(o => o.Items)
|
||||||
.ThenInclude(oi => oi.Product)
|
.ThenInclude(oi => oi.Product)
|
||||||
|
.Include(o => o.Items)
|
||||||
|
.ThenInclude(oi => oi.ProductVariant)
|
||||||
.Include(o => o.Payments)
|
.Include(o => o.Payments)
|
||||||
.FirstOrDefaultAsync(o => o.Id == id);
|
.FirstOrDefaultAsync(o => o.Id == id);
|
||||||
if (order == null) return false;
|
if (order == null) return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user