fix: update order by for session and events

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-12-02 19:24:29 +01:00
parent 522ecc0040
commit ac9901c77b
2 changed files with 3 additions and 4 deletions

View File

@@ -628,8 +628,7 @@ export async function getEventList(options: GetEventListOptions) {
} }
} }
sb.orderBy.created_at = sb.orderBy.created_at = 'created_at DESC';
'toDate(created_at) DESC, created_at DESC, profile_id DESC, name DESC';
if (custom) { if (custom) {
custom(sb); custom(sb);

View File

@@ -203,9 +203,9 @@ export async function getSessionList({
const cId = sqlstring.escape(cursor.id); const cId = sqlstring.escape(cursor.id);
sb.where.cursor = `(created_at < toDateTime64(${cAt}, 3) OR (created_at = toDateTime64(${cAt}, 3) AND id < ${cId}))`; sb.where.cursor = `(created_at < toDateTime64(${cAt}, 3) OR (created_at = toDateTime64(${cAt}, 3) AND id < ${cId}))`;
sb.where.cursorWindow = `created_at >= toDateTime64(${cAt}, 3) - INTERVAL ${dateIntervalInDays} DAY`; sb.where.cursorWindow = `created_at >= toDateTime64(${cAt}, 3) - INTERVAL ${dateIntervalInDays} DAY`;
sb.orderBy.created_at = 'toDate(created_at) DESC, created_at DESC, id DESC'; sb.orderBy.created_at = 'created_at DESC';
} else { } else {
sb.orderBy.created_at = 'toDate(created_at) DESC, created_at DESC, id DESC'; sb.orderBy.created_at = 'created_at DESC';
sb.where.created_at = `created_at > now() - INTERVAL ${dateIntervalInDays} DAY`; sb.where.created_at = `created_at > now() - INTERVAL ${dateIntervalInDays} DAY`;
} }