forked from sanchezvem/pyrofetes-backend
Refactor all code
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using Ardalis.Specification;
|
||||
using PyroFetes.Models;
|
||||
|
||||
namespace PyroFetes.Specifications.DeliveryNotes;
|
||||
|
||||
public class GetAllDeliveryNoteSpec : Specification<DeliveryNote>
|
||||
{
|
||||
public GetAllDeliveryNoteSpec()
|
||||
{
|
||||
Query
|
||||
.Include(x => x.Deliverer)
|
||||
.Include(x => x.ProductDeliveries)!
|
||||
.ThenInclude(x => x.Product)
|
||||
.Where(x => true);
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,14 @@ using PyroFetes.Models;
|
||||
|
||||
namespace PyroFetes.Specifications.DeliveryNotes;
|
||||
|
||||
public sealed class GetDeliveryNoteByIdSpec : Specification<DeliveryNote>
|
||||
public sealed class GetDeliveryNoteByIdSpec : SingleResultSpecification<DeliveryNote>
|
||||
{
|
||||
public GetDeliveryNoteByIdSpec(int deliveryNoteId)
|
||||
{
|
||||
Query
|
||||
.Include(x => x.Deliverer)
|
||||
.Include(x => x.ProductDeliveries!)
|
||||
.ThenInclude(x => x.Product)
|
||||
.Where(x => x.Id == deliveryNoteId);
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,13 @@ using PyroFetes.Models;
|
||||
|
||||
namespace PyroFetes.Specifications.DeliveryNotes;
|
||||
|
||||
public class GetDeliveryNoteByIdWithProductsSpec : Specification<DeliveryNote>
|
||||
public class GetDeliveryNoteByIdWithProductsSpec : SingleResultSpecification<DeliveryNote>
|
||||
{
|
||||
public GetDeliveryNoteByIdWithProductsSpec(int deliveryNoteId)
|
||||
{
|
||||
Query
|
||||
.Where(d => d.Id == deliveryNoteId)
|
||||
.Include(d => d.ProductDeliveries!)
|
||||
.ThenInclude(dp => dp.Product);
|
||||
.Where(x => x.Id == deliveryNoteId)
|
||||
.Include(x => x.ProductDeliveries!)
|
||||
.ThenInclude(p => p.Product);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user