fix(admin): resolve all 266 TypeScript errors, enable strict build

Eliminate the pre-existing TS errors that were masked by
next.config.js `typescript.ignoreBuildErrors: true`, then turn the flag
OFF so the compiler is a real safety net for future changes. `next build`
and `tsc --noEmit` now pass with 0 errors.

The errors were not cosmetic — several exposed real latent bugs hidden by
the flag, e.g. the drafting-engine ConstraintEnforcer read non-existent
fields (`t.rule.dsfaRequired`, `d.required`, `r.title`), so its DSFA hard
gate and risk-flag checks were silently no-ops; scopeDefaults read
snake_case CompanyProfile fields that never matched the camelCase type
(generator defaults never populated). Both fixed by aligning code to the
current types.

Highlights:
- Vitest globals: add vitest-globals.d.ts (config already had globals:true)
  so the test files type-check; exclude Playwright specs from vitest.
- Add a minimal ambient `pg` module declaration (no @types/pg installed).
- Fix Next 15 route handlers to await Promise params.
- Reconcile drifted types across loeschfristen, compliance-scope, document-
  generator, drafting-engine, vendor-compliance, agent and more.

Pre-existing (NOT caused here, proven by stashing the diff): 3 vitest
logic tests still fail — getNextStep (2) and buildDocumentScope priority (1).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-06-11 00:42:44 +02:00
parent bb9aacc3d3
commit a28db8f8f0
76 changed files with 280 additions and 190 deletions
@@ -152,7 +152,7 @@ const createMockState = (overrides: Partial<SDKState> = {}): SDKState => ({
allowParallelWork: true,
},
...overrides,
})
} as unknown as SDKState)
describe('exportToPDF', () => {
it('should return a Blob', async () => {
@@ -76,9 +76,9 @@ describe('parseRevenueRange', () => {
// =============================================================================
describe('buildAssessmentPayload', () => {
const baseProfile: CompanyProfile = {
const baseProfile = {
companyName: 'Test GmbH',
legalForm: 'GmbH',
legalForm: 'gmbh',
industry: ['IT', 'Software'],
employeeCount: '50-249',
annualRevenue: '10-50 Mio',
@@ -87,7 +87,7 @@ describe('buildAssessmentPayload', () => {
isDataController: true,
isDataProcessor: false,
offerings: ['software_saas'],
}
} as unknown as CompanyProfile
const baseAnswers: ScopeProfilingAnswer[] = [
{ questionId: 'data_art9', value: false, blockId: 'data' },
@@ -115,7 +115,7 @@ describe('buildAssessmentPayload', () => {
expect(payload.annual_revenue).toBe(30000000)
expect(payload.country).toBe('DE')
expect(payload.industry).toBe('IT, Software')
expect(payload.legal_form).toBe('GmbH')
expect(payload.legal_form).toBe('gmbh')
expect(payload.is_controller).toBe(true)
expect(payload.is_processor).toBe(false)
expect(payload.cross_border_transfer).toBe(true)
@@ -128,9 +128,9 @@ describe('buildAssessmentPayload', () => {
})
it('uses defaults for null/undefined profile fields', () => {
const emptyProfile: CompanyProfile = {
const emptyProfile = {
companyName: 'Minimal',
}
} as unknown as CompanyProfile
const payload = buildAssessmentPayload(emptyProfile, [], null)
expect(payload.employee_count).toBe(10) // parseEmployeeRange(undefined)
@@ -178,7 +178,7 @@ describe('buildAssessmentPayload', () => {
const decision: ScopeDecision = {
determinedLevel: 'L3',
triggeredHardTriggers: [
{ rule: { id: 'rule-1', name: 'Test Rule', description: '', targetLevel: 'L3', trigger: { field: '', op: 'eq', value: true } }, factValue: true },
{ ruleId: 'rule-1', rule: { id: 'rule-1', name: 'Test Rule', description: '', targetLevel: 'L3', trigger: { field: '', op: 'eq', value: true } }, factValue: true },
],
requiredDocuments: [
{ documentType: 'dsfa', reason: 'test', regulation: 'dsgvo' },