catalog-client: sortFields to orderFields
Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
@@ -344,7 +344,7 @@ describe('CatalogClient', () => {
|
||||
fields: ['a', 'b'],
|
||||
limit: 100,
|
||||
query: 'query',
|
||||
sortFields: [
|
||||
orderFields: [
|
||||
{ field: 'metadata.name', order: 'asc' },
|
||||
{ field: 'metadata.uid', order: 'desc' },
|
||||
],
|
||||
@@ -367,7 +367,7 @@ describe('CatalogClient', () => {
|
||||
fields: ['a', 'b'],
|
||||
limit: 100,
|
||||
query: 'query',
|
||||
sortFields: [{ field: 'metadata.name', order: 'asc' }],
|
||||
orderFields: [{ field: 'metadata.name', order: 'asc' }],
|
||||
cursor: 'cursor',
|
||||
});
|
||||
expect(mockedEndpoint.mock.calls[0][0].url.search).toBe(
|
||||
|
||||
@@ -214,14 +214,14 @@ export class CatalogClient implements CatalogApi {
|
||||
const params: string[] = [];
|
||||
|
||||
if (isQueryEntitiesInitialRequest(request)) {
|
||||
const { fields = [], filter, limit, sortFields, query } = request;
|
||||
const { fields = [], filter, limit, orderFields, query } = request;
|
||||
params.push(...this.getParams(filter));
|
||||
|
||||
if (limit !== undefined) {
|
||||
params.push(`limit=${limit}`);
|
||||
}
|
||||
if (sortFields !== undefined) {
|
||||
(Array.isArray(sortFields) ? sortFields : [sortFields]).forEach(
|
||||
if (orderFields !== undefined) {
|
||||
(Array.isArray(orderFields) ? orderFields : [orderFields]).forEach(
|
||||
({ field, order }) => params.push(`sortField=${field},${order}`),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ export type QueryEntitiesInitialRequest = {
|
||||
fields?: string[];
|
||||
limit?: number;
|
||||
filter?: EntityFilterQuery;
|
||||
sortFields?: EntityOrderQuery;
|
||||
orderFields?: EntityOrderQuery;
|
||||
query?: string;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user