1
0
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:
cd-bitwarden
2026-02-20 15:08:18 -05:00
committed by GitHub
parent 6a7b8f5a89
commit e6ce670404
2 changed files with 6 additions and 6 deletions

View File

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

View File

@@ -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;
}