mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
[pm-337] Remove the continuation token from the ListResponseModel. (#5192)
This commit is contained in:
parent
fe983aff7f
commit
060e9e60bf
@ -36,7 +36,7 @@ public class EventsController : Controller
|
|||||||
/// If no filters are provided, it will return the last 30 days of event for the organization.
|
/// If no filters are provided, it will return the last 30 days of event for the organization.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[ProducesResponseType(typeof(ListResponseModel<EventResponseModel>), (int)HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(PagedListResponseModel<EventResponseModel>), (int)HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> List([FromQuery] EventFilterRequestModel request)
|
public async Task<IActionResult> List([FromQuery] EventFilterRequestModel request)
|
||||||
{
|
{
|
||||||
var dateRange = request.ToDateRange();
|
var dateRange = request.ToDateRange();
|
||||||
@ -65,7 +65,7 @@ public class EventsController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
var eventResponses = result.Data.Select(e => new EventResponseModel(e));
|
var eventResponses = result.Data.Select(e => new EventResponseModel(e));
|
||||||
var response = new ListResponseModel<EventResponseModel>(eventResponses, result.ContinuationToken);
|
var response = new PagedListResponseModel<EventResponseModel>(eventResponses, result.ContinuationToken);
|
||||||
return new JsonResult(response);
|
return new JsonResult(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,9 @@ namespace Bit.Api.Models.Public.Response;
|
|||||||
|
|
||||||
public class ListResponseModel<T> : IResponseModel where T : IResponseModel
|
public class ListResponseModel<T> : IResponseModel where T : IResponseModel
|
||||||
{
|
{
|
||||||
public ListResponseModel(IEnumerable<T> data, string continuationToken = null)
|
public ListResponseModel(IEnumerable<T> data)
|
||||||
{
|
{
|
||||||
Data = data;
|
Data = data;
|
||||||
ContinuationToken = continuationToken;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -21,8 +20,4 @@ public class ListResponseModel<T> : IResponseModel where T : IResponseModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
public IEnumerable<T> Data { get; set; }
|
public IEnumerable<T> Data { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// A cursor for use in pagination.
|
|
||||||
/// </summary>
|
|
||||||
public string ContinuationToken { get; set; }
|
|
||||||
}
|
}
|
||||||
|
10
src/Api/Models/Public/Response/PagedListResponseModel.cs
Normal file
10
src/Api/Models/Public/Response/PagedListResponseModel.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Bit.Api.Models.Public.Response;
|
||||||
|
|
||||||
|
public class PagedListResponseModel<T>(IEnumerable<T> data, string continuationToken) : ListResponseModel<T>(data)
|
||||||
|
where T : IResponseModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A cursor for use in pagination.
|
||||||
|
/// </summary>
|
||||||
|
public string ContinuationToken { get; set; } = continuationToken;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user