Skip to content

Commit

Permalink
refactor: Update sort criteria in searchParams function (#1509)
Browse files Browse the repository at this point in the history
  • Loading branch information
ukrocks007 committed Jul 17, 2024
1 parent 134d6dc commit c24daff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/models/event/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,12 @@ export function searchParams(opts: Options): RequestParams.Search {
size: opts.size !== 0 ? opts.size : undefined,
body: {
query: searchQuery,
sort: [{ canonical_time: opts.sort }],
sort: [
{ canonical_time: opts.sort },
{
id: opts.sort,
},
],
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/test/models/event/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class QueryEventsTest {
],
},
},
sort: [{ canonical_time: "asc" }],
sort: [{ canonical_time: "asc" }, { id: "asc" }],
},
};
assert.deepEqual(output, answer);
Expand Down

0 comments on commit c24daff

Please sign in to comment.