Fix: PocketBase Filter braucht single quotes und kein ISO-T-Format

This commit is contained in:
rene 2026-05-17 14:01:07 +02:00
parent a3281261ab
commit b5cac0e12c
3 changed files with 4 additions and 5 deletions

View file

@ -21,14 +21,13 @@
// User-Record explizit laden damit tenant-Relation sicher gesetzt ist // User-Record explizit laden damit tenant-Relation sicher gesetzt ist
const user = await pb.collection('users').getOne(pb.authStore.record!.id); const user = await pb.collection('users').getOne(pb.authStore.record!.id);
const tenantId = user.tenant; const tenantId = user.tenant;
console.log('[Dashboard] user:', user, 'tenantId:', tenantId); const dateStr = today.toISOString().replace('T', ' ');
const result = await pb.collection('check_logs').getList(1, 50, { const result = await pb.collection('check_logs').getList(1, 50, {
filter: `created >= "${today.toISOString()}"`, filter: `tenant = '${tenantId}' && created >= '${dateStr}'`,
expand: 'station', expand: 'station',
sort: '-created' sort: '-created'
}); });
console.log('[Dashboard] check_logs result:', result);
logs = result.items; logs = result.items;
stats.total = result.totalItems; stats.total = result.totalItems;

View file

@ -23,7 +23,7 @@
const user = await pb.collection('users').getOne(pb.authStore.record!.id); const user = await pb.collection('users').getOne(pb.authStore.record!.id);
const tenantId = user.tenant; const tenantId = user.tenant;
const result = await pb.collection('check_logs').getList(p, PER_PAGE, { const result = await pb.collection('check_logs').getList(p, PER_PAGE, {
filter: `tenant = "${tenantId}"`, filter: `tenant = '${tenantId}'`,
expand: 'station', expand: 'station',
sort: '-created' sort: '-created'
}); });

View file

@ -19,7 +19,7 @@
const user = await pb.collection('users').getOne(pb.authStore.record!.id); const user = await pb.collection('users').getOne(pb.authStore.record!.id);
const tenantId = user.tenant; const tenantId = user.tenant;
const result = await pb.collection('stations').getFullList({ const result = await pb.collection('stations').getFullList({
filter: `tenant = "${tenantId}" && active = true`, filter: `tenant = '${tenantId}' && active = true`,
sort: 'name' sort: 'name'
}); });
stations = result; stations = result;