This commit is contained in:
@@ -245,7 +245,7 @@ MISC FUTURE ITEMS NOT SURE ABOUT THAT CAME UP DURING CODING / TESTING
|
||||
|
||||
- Should server show uptime somewhere?
|
||||
- Log route: Add a route to download *all* log files as a single zip archive which will make life much easier for analysis
|
||||
|
||||
- how to set default values in api explorer example json for post routes (e.g. dataList defaults wouldn't work unless changed, auth wb nice if set to default manager account)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -11,11 +11,9 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
public const int DefaultLimit = 25;
|
||||
|
||||
[FromBody]
|
||||
[Range(0, int.MaxValue)]
|
||||
public int? Offset { get; set; }
|
||||
|
||||
[FromBody]
|
||||
[Range(1, MaxPageSize, ErrorMessage = "Limit must be greater than 0 and less than 1000.")]
|
||||
public int? Limit { get; set; }
|
||||
|
||||
// //Data filter id to use with this list query
|
||||
|
||||
@@ -55,6 +55,23 @@ namespace AyaNova.Api.Controllers
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
|
||||
if (listOptions.Limit == null || listOptions.Limit < 1)
|
||||
{
|
||||
listOptions.Limit = ListOptions.DefaultLimit;
|
||||
}
|
||||
if (listOptions.Offset == null)
|
||||
{
|
||||
listOptions.Offset = 0;
|
||||
}
|
||||
//this is to workaround a quirk in the api explorer with default values
|
||||
if(listOptions.SortJson=="string"){
|
||||
listOptions.SortJson=string.Empty;
|
||||
}
|
||||
if(listOptions.FilterJson=="string"){
|
||||
listOptions.FilterJson=string.Empty;
|
||||
}
|
||||
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user