mirror of
https://github.com/bitwarden/server
synced 2026-02-21 20:03:40 +00:00
[PM-29660] allowing null for continuationToken (#6753)
* allowing null for continuationToken * Normalizing empty string to null on pagedlistresponsemodel
This commit is contained in:
@@ -59,7 +59,7 @@ public class EventsController : Controller
|
||||
{
|
||||
if (!_currentContext.OrganizationId.HasValue)
|
||||
{
|
||||
return new JsonResult(new PagedListResponseModel<EventResponseModel>([], ""));
|
||||
return new JsonResult(new PagedListResponseModel<EventResponseModel>([], null));
|
||||
}
|
||||
|
||||
var organizationId = _currentContext.OrganizationId.Value;
|
||||
@@ -98,7 +98,7 @@ public class EventsController : Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
return new JsonResult(new PagedListResponseModel<EventResponseModel>([], ""));
|
||||
return new JsonResult(new PagedListResponseModel<EventResponseModel>([], null));
|
||||
}
|
||||
}
|
||||
else if (request.ProjectId.HasValue)
|
||||
@@ -112,7 +112,7 @@ public class EventsController : Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
return new JsonResult(new PagedListResponseModel<EventResponseModel>([], ""));
|
||||
return new JsonResult(new PagedListResponseModel<EventResponseModel>([], null));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -123,7 +123,7 @@ public class EventsController : Controller
|
||||
}
|
||||
|
||||
var eventResponses = result.Data.Select(e => new EventResponseModel(e));
|
||||
var response = new PagedListResponseModel<EventResponseModel>(eventResponses, result.ContinuationToken ?? "");
|
||||
var response = new PagedListResponseModel<EventResponseModel>(eventResponses, result.ContinuationToken ?? null);
|
||||
|
||||
_logger.LogAggregateData(_featureService, organizationId, response, request);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
namespace Bit.Api.Models.Public.Response;
|
||||
|
||||
public class PagedListResponseModel<T>(IEnumerable<T> data, string continuationToken) : ListResponseModel<T>(data)
|
||||
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;
|
||||
public string? ContinuationToken { get; set; } = string.IsNullOrEmpty(continuationToken) ? null : continuationToken;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user