using TakeoutSaaS.Domain.Deliveries.Entities; using TakeoutSaaS.Domain.Deliveries.Enums; namespace TakeoutSaaS.Domain.Deliveries.Repositories; /// /// 配送聚合仓储契约。 /// public interface IDeliveryRepository { /// /// 依据标识获取配送单。 /// /// 配送单 ID。 /// 租户 ID。 /// 取消标记。 /// 配送单实体或 null。 Task FindByIdAsync(long deliveryOrderId, long tenantId, CancellationToken cancellationToken = default); /// /// 依据订单标识获取配送单。 /// /// 订单 ID。 /// 租户 ID。 /// 取消标记。 /// 配送单实体或 null。 Task FindByOrderIdAsync(long orderId, long tenantId, CancellationToken cancellationToken = default); /// /// 获取配送事件轨迹。 /// /// 配送单 ID。 /// 租户 ID。 /// 取消标记。 /// 配送事件列表。 Task> GetEventsAsync(long deliveryOrderId, long tenantId, CancellationToken cancellationToken = default); /// /// 新增配送单。 /// /// 配送单实体。 /// 取消标记。 /// 异步任务。 Task AddDeliveryOrderAsync(DeliveryOrder deliveryOrder, CancellationToken cancellationToken = default); /// /// 新增配送事件。 /// /// 配送事件。 /// 取消标记。 /// 异步任务。 Task AddEventAsync(DeliveryEvent deliveryEvent, CancellationToken cancellationToken = default); /// /// 持久化变更。 /// /// 取消标记。 /// 异步任务。 Task SaveChangesAsync(CancellationToken cancellationToken = default); /// /// 按状态查询配送单。 /// /// 租户 ID。 /// 配送状态。 /// 订单 ID。 /// 取消标记。 /// 配送单列表。 Task> SearchAsync(long tenantId, DeliveryStatus? status, long? orderId, CancellationToken cancellationToken = default); /// /// 更新配送单。 /// /// 配送单实体。 /// 取消标记。 /// 异步任务。 Task UpdateDeliveryOrderAsync(DeliveryOrder deliveryOrder, CancellationToken cancellationToken = default); /// /// 删除配送单及事件。 /// /// 配送单 ID。 /// 租户 ID。 /// 取消标记。 /// 异步任务。 Task DeleteDeliveryOrderAsync(long deliveryOrderId, long tenantId, CancellationToken cancellationToken = default); }