Å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.
29 lines
900 B
TypeScript
29 lines
900 B
TypeScript
import { NextResponse } from 'next/server'
|
|
import { ensureInitialized } from '@/lib/init'
|
|
import { withRouteContext } from '@/lib/api/with-route-context'
|
|
import { postDueInstallments } from '@/lib/bookkeeping/accruals/service'
|
|
|
|
ensureInitialized()
|
|
|
|
/**
|
|
* POST /api/bookkeeping/accruals/post-due
|
|
*
|
|
* Manual "Bokför förfallna periodiseringar" for the active company:
|
|
* complements the daily cron (same service, same CAS idempotency), so the
|
|
* user never has to wait for the nightly run after creating a schedule with
|
|
* elapsed months or after fixing a blocked installment.
|
|
*/
|
|
export const POST = withRouteContext(
|
|
'accruals.post_due',
|
|
async (_request, ctx) => {
|
|
const { user, supabase, companyId } = ctx
|
|
|
|
const result = await postDueInstallments(supabase, companyId!, {
|
|
userId: user.id,
|
|
})
|
|
|
|
return NextResponse.json({ data: result })
|
|
},
|
|
{ requireWrite: true },
|
|
)
|