All files / web/src/app/api/abacus/print/jobs route.ts

100% Statements 17/17
100% Branches 1/1
100% Functions 0/0
100% Lines 17/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 181x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x  
/**
 * GET /api/abacus/print/jobs (Abacus Studio #8.3; scoped to owned jobs in #16)
 *
 * Ownership-scoped job roster. The print-service token is shared across every
 * app paired to it, so a raw pass-through would surface other integrators' jobs
 * and other abaci users' jobs (and 404 on any of them the moment the panel
 * opened one). This route intersects the upstream list with the caller's
 * ownership rows — the same tenancy rule `jobs/[id]` already enforces per job.
 */
import { withAuth } from '@/lib/auth/withAuth'
import { getUserId } from '@/lib/viewer'
import { proxyRosterForOwner } from '@/lib/abacus/print/proxy'
 
export const GET = withAuth(async (request) => {
  const userId = await getUserId()
  return proxyRosterForOwner(request, userId)
})