Fix: tenantId via explizitem user-Fetch statt authStore.record

This commit is contained in:
rene 2026-05-17 13:53:11 +02:00
parent ea7a48a995
commit f8b82a3cff
3 changed files with 8 additions and 3 deletions

View file

@ -17,7 +17,10 @@
try { try {
const today = new Date(); const today = new Date();
today.setHours(0, 0, 0, 0); today.setHours(0, 0, 0, 0);
const tenantId = (pb.authStore.record as any)?.tenant;
// User-Record explizit laden damit tenant-Relation sicher gesetzt ist
const user = await pb.collection('users').getOne(pb.authStore.record!.id);
const tenantId = user.tenant;
const result = await pb.collection('check_logs').getList(1, 50, { const result = await pb.collection('check_logs').getList(1, 50, {
filter: `tenant = "${tenantId}" && created >= "${today.toISOString()}"`, filter: `tenant = "${tenantId}" && created >= "${today.toISOString()}"`,

View file

@ -20,7 +20,8 @@
async function loadPage(p: number) { async function loadPage(p: number) {
loading = true; loading = true;
try { try {
const tenantId = (pb.authStore.record as any)?.tenant; const user = await pb.collection('users').getOne(pb.authStore.record!.id);
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',

View file

@ -16,7 +16,8 @@
onMount(async () => { onMount(async () => {
try { try {
const tenantId = (pb.authStore.record as any)?.tenant; const user = await pb.collection('users').getOne(pb.authStore.record!.id);
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'