mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-06 18:12:11 +00:00
DeleteWorkOrderCascadeAsync deleted comments one at a time: each call re-fetched the row and committed separately (2N round trips, N commits). Add DeleteAllForWorkOrderAsync, which loads the set once and removes it in a single SaveChangesAsync. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
25 lines
1.2 KiB
C#
25 lines
1.2 KiB
C#
using Data.SeaHavenIndustries;
|
|
|
|
namespace SeaHaven.DataServices.Interfaces
|
|
{
|
|
public interface ICommentDataService
|
|
{
|
|
Task<Comments?> GetByIdAsync(int id);
|
|
Task<IEnumerable<Comments>> GetAllAsync();
|
|
/// <summary>
|
|
/// Comments linked to non-deleted, non-template work orders.
|
|
/// When <paramref name="accountId"/> is set, only that account's WOs; null = org-wide.
|
|
/// </summary>
|
|
Task<IEnumerable<Comments>> GetAllForAccountAsync(int? accountId);
|
|
Task<IEnumerable<Comments>> GetByWorkOrderIdAsync(int workOrderId);
|
|
Task<IEnumerable<Comments>> GetByDispatchIdAsync(int dispatchId);
|
|
Task<Comments> AddAsync(Comments comment);
|
|
Task UpdateAsync(Comments comment);
|
|
Task DeleteAsync(int id);
|
|
/// <summary>Deletes every comment on a work order in one statement (no per-row round trip).</summary>
|
|
Task DeleteAllForWorkOrderAsync(int workOrderId);
|
|
Task<bool> ExistsAsync(int id);
|
|
Task StageAsync(Comments comment, CancellationToken cancellationToken);
|
|
Task<IReadOnlyList<PortalCommentData>> GetVendorViewableForDispatchAsync(int dispatchId, CancellationToken cancellationToken);
|
|
}
|
|
}
|