Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db431e1682 | ||
|
|
ad2ea48592 | ||
|
|
0a9a459892 | ||
|
|
f5a69de0a0 | ||
|
|
fc4db32f20 | ||
|
|
a9aa0a675a | ||
|
|
a763e5e40e | ||
|
|
1ef5e52ed9 | ||
|
|
c06cf13add | ||
|
|
92c60e6616 | ||
|
|
21788c66a3 | ||
|
|
54ef7a6e5f | ||
|
|
6594e0aecd |
@@ -203,26 +203,6 @@ public sealed class OrderService(IDbContextFactory<MidrandBooksDbContext> contex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ValueTask<Result<OrderItem[]>> GetOrderItemsAsync(long orderId, CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
|
|
||||||
|
|
||||||
var orderItems = await context.OrderItems
|
|
||||||
.Where(o => o.OrderId == orderId)
|
|
||||||
.ToListAsync(cancellationToken);
|
|
||||||
|
|
||||||
return orderItems.Count > 0
|
|
||||||
? Result.Ok(orderItems.Select(i => i.ToModel()).ToArray())
|
|
||||||
: Result.Fail<OrderItem[]>($"Order items not found for order ID {orderId}");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return Result.Fail(new Error(ex.Message).CausedBy(ex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async ValueTask<Result<Order[]>> GetOrdersByCustomerAsync(long customerId, CancellationToken cancellationToken = default)
|
public async ValueTask<Result<Order[]>> GetOrdersByCustomerAsync(long customerId, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user