feat(application): Product commands, DTOs, IProductRepository, validators (PRD-002)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using SIGCM2.Application.Common;
|
||||
using SIGCM2.Domain.Entities;
|
||||
|
||||
namespace SIGCM2.Application.Abstractions.Persistence;
|
||||
|
||||
/// <summary>
|
||||
/// Write-side repository for Product.
|
||||
/// All reads needed by write handlers are included here.
|
||||
/// </summary>
|
||||
public interface IProductRepository
|
||||
{
|
||||
/// <summary>Inserts a new Product and returns the DB-assigned Id.</summary>
|
||||
Task<int> AddAsync(Product product, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Returns the Product with the given Id, or null if not found.</summary>
|
||||
Task<Product?> GetByIdAsync(int id, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Returns a paged result of Products matching the query.</summary>
|
||||
Task<PagedResult<Product>> GetPagedAsync(ProductsQuery query, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Persists all changes to an existing Product row.</summary>
|
||||
Task UpdateAsync(Product product, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if an active Product with the same Nombre exists for the given MedioId+ProductTypeId combination.
|
||||
/// Pass excludeId to skip the self-comparison during rename (update scenario).
|
||||
/// </summary>
|
||||
Task<bool> ExistsByNombreAsync(string nombre, int medioId, int productTypeId, int? excludeId = null, CancellationToken ct = default);
|
||||
}
|
||||
Reference in New Issue
Block a user