Å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.
28 lines
1.1 KiB
TypeScript
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 })
|
|
})
|