mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-03 05:52:11 -04:00
GET /api/nests/query filters name, customer, material, made by, comments and status (stored and display names) with an escaped LIKE parameter, orders newest saved first with an id tie-break, and returns one page of at most 500 records plus the total match count, read in one database hold. Unknown, repeated or out-of-range parameters return 400. RemoteNestRepository.QueryAsync validates the same bounds before sending, rejects oversized pages, and reports a 404 from an older server as a server that needs updating. GET /api/nests stays the full enumeration used by backup, restore checks and the container smoke.
38 lines
1.8 KiB
C#
38 lines
1.8 KiB
C#
namespace OpenNest.Data;
|
|
|
|
/// <summary>
|
|
/// Storage backend for saved nests. <see cref="RemoteNestRepository"/> talks to the
|
|
/// central nest server; File mode in the desktop app keeps using SaveFileDialog and
|
|
/// does not go through this interface.
|
|
/// </summary>
|
|
public interface INestRepository
|
|
{
|
|
/// <summary>
|
|
/// All stored nests, newest saved first. This is the full-enumeration contract for
|
|
/// backup and verification; browsing uses <see cref="QueryAsync"/>.
|
|
/// </summary>
|
|
Task<IReadOnlyList<NestRecord>> ListAsync(CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>One bounded page of nests matching the query, filtered and ordered by the server.</summary>
|
|
Task<NestPage> QueryAsync(NestQuery query, CancellationToken cancellationToken = default);
|
|
|
|
Task<NestRecord?> GetMetadataAsync(Guid id, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>Downloaded .nest archive bytes, or null when the id does not exist.</summary>
|
|
Task<byte[]?> GetFileAsync(Guid id, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>Stores a new nest; returns the server-assigned record.</summary>
|
|
Task<NestRecord> UploadAsync(
|
|
byte[] nestFile, NestRecord record, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>Replaces the archive and metadata of an existing id, keeping the id.</summary>
|
|
Task<NestRecord> UpdateFileAsync(
|
|
Guid id, byte[] nestFile, NestRecord record, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>Replaces metadata only (status, made-by, comments...), leaving the archive.</summary>
|
|
Task<NestRecord> UpdateMetadataAsync(
|
|
Guid id, NestRecord record, CancellationToken cancellationToken = default);
|
|
|
|
Task DeleteAsync(Guid id, CancellationToken cancellationToken = default);
|
|
}
|