mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 08:23:12 +00:00
53 lines
2.4 KiB
C#
53 lines
2.4 KiB
C#
using Data.SeaHavenIndustries;
|
|
|
|
namespace SeaHaven.DataServices.Interfaces
|
|
{
|
|
public record SiteOptionRow(int Id, string? Code, string? City, string? State);
|
|
|
|
public interface ILocationDataService
|
|
{
|
|
Task<Locations?> GetByIdAsync(int id);
|
|
Task<Locations?> GetByIdWithDetailsAsync(int id);
|
|
Task<IEnumerable<Locations>> GetAllAsync();
|
|
Task<IEnumerable<Locations>> GetByAccountIdAsync(int accountId);
|
|
|
|
// Paged results returning DTOs
|
|
Task<(IEnumerable<Locations> Items, int TotalCount)> GetPagedAsync(int page, int pageSize, string? search = null);
|
|
|
|
// For addressbook endpoint - returns simplified DTO
|
|
Task<(IEnumerable<object> Items, int TotalCount)> GetAddressbookPagedAsync(int page, int pageSize, string? search = null);
|
|
|
|
Task<IReadOnlyList<SiteOptionRow>> GetSiteOptionsAsync(
|
|
string? search = null,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Exists is false when the row is missing. AccountId is null when the site has no account.
|
|
/// </summary>
|
|
Task<(bool Exists, int? AccountId)> GetAccountScopeAsync(
|
|
int locationId,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
Task<Locations> AddAsync(Locations location);
|
|
Task UpdateAsync(Locations location);
|
|
Task DeleteAsync(int id);
|
|
Task<bool> ExistsAsync(int id);
|
|
Task<int> CountAsync();
|
|
|
|
Task<(List<Locations> Items, int TotalCount)> GetListPagedAsync(int page, int pageSize, string? search, IReadOnlyCollection<string>? states, CancellationToken cancellationToken);
|
|
Task<Locations?> GetDetailByIdAsync(int id, CancellationToken cancellationToken);
|
|
Task<Locations?> GetByIdForUpdateAsync(int id, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// SH-138: single bounded read of active site contacts for a page of locations,
|
|
/// ordered by SiteContactOrder then Id. Deleted contacts are excluded.
|
|
/// </summary>
|
|
Task<IReadOnlyList<Contacts>> GetSiteContactsByLocationIdsAsync(
|
|
IReadOnlyCollection<int> locationIds,
|
|
CancellationToken cancellationToken);
|
|
|
|
Task<Locations> AddAsync(Locations location, CancellationToken cancellationToken);
|
|
Task UpdateAsync(Locations location, CancellationToken cancellationToken);
|
|
Task<bool> DeleteByIdAsync(int id, CancellationToken cancellationToken);
|
|
}
|
|
}
|