Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pm-337] Remove the continuation token from the ListResponseModel. #5192

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Api/AdminConsole/Public/Controllers/EventsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/// If no filters are provided, it will return the last 30 days of event for the organization.
/// </remarks>
[HttpGet]
[ProducesResponseType(typeof(ListResponseModel<EventResponseModel>), (int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(PagedListResponseModel<EventResponseModel>), (int)HttpStatusCode.OK)]
public async Task<IActionResult> List([FromQuery] EventFilterRequestModel request)
{
var dateRange = request.ToDateRange();
Expand Down Expand Up @@ -65,7 +65,7 @@
}

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);

Check warning on line 68 in src/Api/AdminConsole/Public/Controllers/EventsController.cs

View check run for this annotation

Codecov / codecov/patch

src/Api/AdminConsole/Public/Controllers/EventsController.cs#L68

Added line #L68 was not covered by tests
return new JsonResult(response);
}
}
7 changes: 1 addition & 6 deletions src/Api/Models/Public/Response/ListResponseModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ namespace Bit.Api.Models.Public.Response;

public class ListResponseModel<T> : IResponseModel where T : IResponseModel
{
public ListResponseModel(IEnumerable<T> data, string continuationToken = null)
public ListResponseModel(IEnumerable<T> data)
{
Data = data;
ContinuationToken = continuationToken;
}

/// <summary>
Expand All @@ -21,8 +20,4 @@ public ListResponseModel(IEnumerable<T> data, string continuationToken = null)
/// </summary>
[Required]
public IEnumerable<T> Data { get; set; }
/// <summary>
/// A cursor for use in pagination.
/// </summary>
public string ContinuationToken { get; set; }
}
10 changes: 10 additions & 0 deletions src/Api/Models/Public/Response/PagedListResponseModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Bit.Api.Models.Public.Response;

public class PagedListResponseModel<T>(IEnumerable<T> data, string continuationToken) : ListResponseModel<T>(data)

Check warning on line 3 in src/Api/Models/Public/Response/PagedListResponseModel.cs

View check run for this annotation

Codecov / codecov/patch

src/Api/Models/Public/Response/PagedListResponseModel.cs#L3

Added line #L3 was not covered by tests
where T : IResponseModel
{
/// <summary>
/// A cursor for use in pagination.
/// </summary>
public string ContinuationToken { get; set; } = continuationToken;

Check warning on line 9 in src/Api/Models/Public/Response/PagedListResponseModel.cs

View check run for this annotation

Codecov / codecov/patch

src/Api/Models/Public/Response/PagedListResponseModel.cs#L9

Added line #L9 was not covered by tests
}
Loading