fix(api): filter events by profileId for export route

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-05-21 20:52:26 +02:00
parent af7146f555
commit ce184b157f
3 changed files with 4 additions and 6 deletions

View File

@@ -506,7 +506,7 @@ export async function getEventList({
}
if (profileId) {
sb.where.deviceId = `(device_id IN (SELECT device_id as did FROM ${TABLE_NAMES.events} WHERE device_id != '' AND profile_id = ${escape(profileId)} group by did) OR profile_id = ${escape(profileId)})`;
sb.where.deviceId = `(device_id IN (SELECT device_id as did FROM ${TABLE_NAMES.events} WHERE project_id = ${escape(projectId)} AND device_id != '' AND profile_id = ${escape(profileId)} group by did) OR profile_id = ${escape(profileId)})`;
}
if (startDate && endDate) {
@@ -527,10 +527,6 @@ export async function getEventList({
};
}
// if (cursor) {
// sb.where.cursor = `created_at <= '${formatClickhouseDate(cursor)}'`;
// }
sb.orderBy.created_at =
'toDate(created_at) DESC, created_at DESC, profile_id DESC, name DESC';