catalog: accept null as field value

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2023-01-24 11:12:35 +01:00
parent 2977e34ed5
commit 58c78d3748
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -295,7 +295,7 @@ export type Cursor = {
/**
* The values of the fields of a specific item used for paginating the data.
*/
sortFieldValues: string[];
sortFieldValues: Array<string | null>;
/**
* A filter to be applied to the full list of entities.
*/
@@ -313,7 +313,7 @@ export type Cursor = {
* The catalog uses this field internally to understand if the beginning
* of the list has been reached when performing cursor based pagination.
*/
firstSortFieldValues?: string[];
firstSortFieldValues?: Array<string | null>;
/**
* The number of items that match the provided filters
*/
@@ -338,7 +338,7 @@ export class DefaultEntitiesCatalog implements EntitiesCatalog {
const limit = request?.limit ?? 20;
const cursor: Omit<Cursor, 'sortFieldValues'> & {
sortFieldValues?: string[];
sortFieldValues?: (string | null)[];
} = {
sortFields: [defaultSortField],
isPrevious: false,
@@ -689,5 +689,5 @@ function invertOrder(order: EntitySortField['order']) {
}
function sortFieldsFromRow(row: DbSearchRow) {
return [row.value!, row.entity_id];
return [row.value, row.entity_id];
}