1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-04 13:48:56 +02:00

feat: now also sorting by id if in same transaction/date (#10290)

Also sort events by id, so they will be in correct order if done inside
transaction.
This commit is contained in:
Jaanus Sellin 2025-07-03 09:26:38 +03:00 committed by GitHub
parent 30fbc62f9b
commit 778fb2ee17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -381,7 +381,10 @@ export class EventStore implements IEventStore {
): Promise<IEvent[]> {
const query = this.buildSearchQuery(queryParams, params.query)
.select(options?.withIp ? [...EVENT_COLUMNS, 'ip'] : EVENT_COLUMNS)
.orderBy('created_at', params.order || 'desc')
.orderBy([
{ column: 'created_at', order: params.order || 'desc' },
{ column: 'id', order: params.order || 'desc' },
])
.limit(Number(params.limit) ?? 100)
.offset(Number(params.offset) ?? 0);