Files
accounted/app/api/bookkeeping/no-doc-required/route.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

28 lines
1.1 KiB
TypeScript

import { NextResponse } from 'next/server'
import { withRouteContext } from '@/lib/api/with-route-context'
import { fetchAllRows } from '@/lib/supabase/fetch-all'
/**
* Returns the set of journal_entry IDs in the active company that the user has
* flagged as "no underlag required". The client uses this set to:
* - exclude exempted entries from the "Saknade underlag" filter
* - show a muted "no doc needed" indicator instead of the warning triangle
*/
export const GET = withRouteContext('journal_entry.no_doc_required.list', async (_request, ctx) => {
const { supabase, companyId } = ctx
// Stable unique order for .range() paging — bulk exemption after a large
// migration can push this table past the 1000-row page size.
const rows = await fetchAllRows<{ journal_entry_id: string; reason: string | null }>(
({ from, to }) =>
supabase
.from('journal_entry_no_doc_required')
.select('journal_entry_id, reason')
.eq('company_id', companyId)
.order('journal_entry_id', { ascending: true })
.range(from, to)
)
return NextResponse.json({ data: rows })
})