more flex and filters
This commit is contained in:
@@ -21,10 +21,24 @@ public sealed class ContactsController : ControllerBase
|
||||
|
||||
public ContactsController(ContactsService service) => _service = service;
|
||||
|
||||
/// <summary>List contacts (paged).</summary>
|
||||
/// <summary>
|
||||
/// List contacts (paged, optionally filtered and sorted).
|
||||
/// </summary>
|
||||
/// <param name="filter">
|
||||
/// Optional iDoklad-style filter, e.g. <c>(IdentificationNumber~eq~12345678)</c> or
|
||||
/// <c>(CompanyName~ct~s.r.o.)</c>. Operators: eq, neq, gt, gte, lt, lte, ct, nct.
|
||||
/// </param>
|
||||
/// <param name="filtertype">How multiple conditions combine: <c>and</c> (default) or <c>or</c>.</param>
|
||||
/// <param name="sort">Optional sort, e.g. <c>CompanyName~asc</c>.</param>
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> List([FromQuery] int page = 1, [FromQuery] int pageSize = 20, CancellationToken ct = default)
|
||||
=> Ok(await _service.ListAsync(page, pageSize, ct));
|
||||
public async Task<IActionResult> List(
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int pageSize = 20,
|
||||
[FromQuery] string? filter = null,
|
||||
[FromQuery] string? filtertype = null,
|
||||
[FromQuery] string? sort = null,
|
||||
CancellationToken ct = default)
|
||||
=> Ok(await _service.ListAsync(page, pageSize, filter, filtertype, sort, ct));
|
||||
|
||||
/// <summary>Get a contact detail by id.</summary>
|
||||
[HttpGet("{id:int}")]
|
||||
|
||||
Reference in New Issue
Block a user