2026-04-28 18:55:14 -05:00
|
|
|
using Data.SeaHavenIndustries;
|
|
|
|
|
|
|
|
|
|
namespace SeaHaven.DataServices.Interfaces
|
|
|
|
|
{
|
|
|
|
|
public interface IVendorDataService
|
|
|
|
|
{
|
|
|
|
|
Task<Vendor?> GetByIdAsync(int id);
|
|
|
|
|
Task<Vendor?> GetByIdWithDetailsAsync(int id);
|
2026-07-24 17:35:34 -03:00
|
|
|
|
|
|
|
|
// Batched lookup: one query for the distinct requested ids, preserving input order
|
|
|
|
|
// and skipping any ids that are not present (no rows returned for missing ids).
|
|
|
|
|
Task<IReadOnlyList<Vendor>> GetByIdsOrderedAsync(IReadOnlyCollection<int> ids, CancellationToken cancellationToken);
|
2026-04-28 18:55:14 -05:00
|
|
|
Task<IEnumerable<Vendor>> GetAllAsync();
|
2026-07-24 17:35:34 -03:00
|
|
|
Task<IReadOnlyList<Vendor>> GetActiveVendorsAsync(CancellationToken cancellationToken);
|
|
|
|
|
Task<IReadOnlyList<Vendor>> GetVendorsForFacetsAsync(bool? isActive, CancellationToken cancellationToken);
|
2026-07-23 12:55:47 -03:00
|
|
|
Task<(IEnumerable<Vendor> Items, int TotalCount)> GetPagedAsync(
|
|
|
|
|
int page,
|
|
|
|
|
int pageSize,
|
|
|
|
|
string? search = null,
|
|
|
|
|
bool? isActive = true,
|
|
|
|
|
IReadOnlyCollection<string>? companies = null,
|
|
|
|
|
IReadOnlyCollection<string>? trades = null,
|
|
|
|
|
IReadOnlyCollection<string>? locations = null,
|
|
|
|
|
IReadOnlyCollection<string>? jobBuckets = null);
|
2026-04-28 18:55:14 -05:00
|
|
|
Task<Vendor> AddAsync(Vendor vendor);
|
|
|
|
|
Task UpdateAsync(Vendor vendor);
|
|
|
|
|
Task DeleteAsync(int id);
|
|
|
|
|
Task<bool> ExistsAsync(int id);
|
2026-07-24 17:35:34 -03:00
|
|
|
Task<VendorAccessToken?> GetActiveTokenForVendorAsync(int vendorId, CancellationToken cancellationToken);
|
|
|
|
|
Task<VendorAccessToken?> GetTokenWithVendorAsync(string token, CancellationToken cancellationToken);
|
|
|
|
|
Task<VendorAccessToken> AddTokenAsync(VendorAccessToken token, CancellationToken cancellationToken);
|
|
|
|
|
Task<IReadOnlyList<VendorAccessToken>> GetRevocableTokensAsync(int vendorId, CancellationToken cancellationToken);
|
|
|
|
|
Task SaveChangesAsync(CancellationToken cancellationToken);
|
2026-04-28 18:55:14 -05:00
|
|
|
Task<int> CountAsync();
|
2026-07-23 17:02:40 -03:00
|
|
|
|
|
|
|
|
Task<VendorCompany?> GetCompanyByIdAsync(int id);
|
|
|
|
|
Task<VendorCompany?> GetCompanyByNormalizedNameAsync(string normalizedName);
|
|
|
|
|
Task<VendorCompany> AddCompanyAsync(VendorCompany company);
|
2026-07-23 19:17:14 -03:00
|
|
|
Task UpdateCompanyAsync(VendorCompany company);
|
|
|
|
|
Task<List<LinkedWorkOrderInfo>> GetLinkedWorkOrdersAsync(int vendorId);
|
2026-07-23 17:02:40 -03:00
|
|
|
Task<bool> IsVendorAssignedToWorkOrderAsync(int vendorId, int workOrderId);
|
|
|
|
|
Task UpdateWithAuditLogsAsync(Vendor vendor, IReadOnlyCollection<VendorAuditLog> auditLogs);
|
2026-04-28 18:55:14 -05:00
|
|
|
}
|
|
|
|
|
}
|