Files
accounted/scripts/debug-bl-list-consents.ts
T
Mattsson 43925bc2d3 fix(import): SIE bulk-delete on service client + provider/reporting/b… (#724)
* fix(import): SIE bulk-delete on service client + provider/reporting/banking fixes

Rebuilt branch onto main as a single commit.

- import: run SIE bulk-delete RPCs on the service client to escape the 8s
  statement_timeout; undo_sie_import now takes an explicit actor (p_user_id)
  so its owner/admin gate works when auth.uid() is NULL on the service
  client (migration 20260624120000) + pg-real regression test
- providers: distinguish missing Fortnox license from expired connection;
  provider_consent_tokens PK regression test
- reports: include unmapped BAS expense groups in the income statement
- enable-banking: reconnect closed/expired bank sessions in place
- bookkeeping: surface linked invoices as underlag on the verifikat view
- scripts: track BL cleanup/diagnostic tooling; data files (*.csv) are
  git-ignored and consentId is now a required arg with no silent default

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(import): add Cache-Control header to journal entry references response

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 23:40:26 +02:00

31 lines
961 B
TypeScript

import { createClient } from '@supabase/supabase-js'
async function main() {
const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.SUPABASE_SERVICE_ROLE_KEY!,
)
const { data: consents, error } = await supabase
.from('provider_consents')
.select('id, provider, company_name, status, created_at')
.eq('provider', 'bjornlunden')
.order('created_at', { ascending: false })
.limit(5)
if (error) throw error
console.log(JSON.stringify(consents, null, 2))
for (const c of consents ?? []) {
const { data: tokens } = await supabase
.from('provider_consent_tokens')
.select('consent_id, provider_company_id, token_expires_at')
.eq('consent_id', c.id)
.limit(1)
console.log(`consent ${c.id}: tokens=${tokens?.length ? 'yes' : 'NO'} userKey=${tokens?.[0]?.provider_company_id?.slice(0, 8) ?? '-'}…`)
}
}
main().catch((e) => {
console.error(e)
process.exit(1)
})