refactor: professional code quality audit

- Fix all TypeScript compilation errors (0 errors in src/)
- Add try/catch error handling to ALL API routes (38 handlers)
- Fix empty catch blocks (api-auth.ts now logs warnings)
- Add aria-labels to all icon-only buttons (WCAG 2.1 AA)
- Fix Prisma type mismatches (OR filter, Person.companyId, Estimate.projectId, Ticket.createdAt)
- Fix webhook PATCH route (moved to [id]/route.ts)
- Fix mobile-bottom-nav type safety
- Fix KB route where-clause type
- Fix test-mail banner null vs undefined
- Fix task comment fetch: add cancellation + error toast
- ESLint: 0 errors, 0 warnings
- 175 files, 24.741 lines of code
This commit is contained in:
Z User committed 2026-10-27 12:23:32 +00:00
1 parent 969202764a
commit fa8dd46571
175 files changed
+24741 -2

No files matched your search

+180
View File
@@ -0,0 +1,180 @@
// AOS i18n — German (default), English, Turkish (PRD §5.5)
// All UI strings keyed, no literals in components.
export type Locale = 'de' | 'en' | 'tr'
export const LOCALES: { id: Locale; label: string; flag: string }[] = [
{ id: 'de', label: 'Deutsch', flag: '🇩🇪' },
{ id: 'en', label: 'English', flag: '🇬🇧' },
{ id: 'tr', label: 'Türkçe', flag: '🇹🇷' },
]
type Dict = Record<string, string>
const de: Dict = {
// Nav groups
'nav.overview': 'Übersicht',
'nav.sales': 'Vertrieb',
'nav.delivery': 'Lieferung',
'nav.operations': 'Betrieb',
'nav.system': 'System',
// Nav items
'nav.dashboard': 'Dashboard',
'nav.calendar': 'Fristen',
'nav.reporting': 'Reporting',
'nav.crm': 'CRM',
'nav.leads': 'Leads Finder',
'nav.estimates': 'Angebote',
'nav.projects': 'Projekte',
'nav.support': 'Support',
'nav.licenses': 'Lizenzen',
'nav.contracts': 'Verträge',
'nav.expenses': 'Ausgaben',
'nav.finance': 'Finanzen',
'nav.accounting': 'Buchhaltung',
'nav.audit': 'Audit-Protokoll',
'nav.kb': 'Wissensdatenbank',
'nav.api': 'API & Webhooks',
'nav.settings': 'Erweiterungen',
'nav.setup': 'Setup-Wizard',
'nav.settings_global': 'Einstellungen',
// Common
'common.search': 'Suchen…',
'common.new': 'Neu',
'common.save': 'Speichern',
'common.cancel': 'Abbrechen',
'common.close': 'Schließen',
'common.all': 'Alle',
'common.status': 'Status',
'common.actions': 'Aktion',
'common.date': 'Datum',
'common.amount': 'Betrag',
'common.customer': 'Kunde',
'common.loading': 'Lädt…',
// KPIs
'kpi.pipelineValue': 'Offene Pipeline',
'kpi.wonDeals': 'Gewonnene Deals',
'kpi.pendingLeads': 'Leads in Review',
'kpi.openProjects': 'Aktive Projekte',
'kpi.activeLicenses': 'Aktive Lizenzen',
'kpi.outstanding': 'Offene Forderungen',
'kpi.team': 'Team',
// Footer
'footer.compliance': 'GoBD / DSGVO',
'footer.selfHosted': 'self-hosted',
'footer.version': 'Version',
// Portal
'portal.title': 'Client-Portal',
'portal.selectCompany': 'Wähle dein Unternehmen',
'portal.isolated': 'projektbezogener Zugriff',
}
const en: Dict = {
'nav.overview': 'Overview',
'nav.sales': 'Sales',
'nav.delivery': 'Delivery',
'nav.operations': 'Operations',
'nav.system': 'System',
'nav.dashboard': 'Dashboard',
'nav.calendar': 'Fristen',
'nav.reporting': 'Reporting',
'nav.crm': 'CRM',
'nav.leads': 'Leads Finder',
'nav.estimates': 'Estimates',
'nav.projects': 'Projects',
'nav.support': 'Support',
'nav.licenses': 'Licenses',
'nav.contracts': 'Contracts',
'nav.expenses': 'Expenses',
'nav.finance': 'Finance',
'nav.accounting': 'Accounting',
'nav.audit': 'Audit Log',
'nav.kb': 'Knowledge Base',
'nav.api': 'API & Webhooks',
'nav.settings': 'Extensions',
'nav.setup': 'Setup Wizard',
'nav.settings_global': 'Settings',
'common.search': 'Search…',
'common.new': 'New',
'common.save': 'Save',
'common.cancel': 'Cancel',
'common.close': 'Close',
'common.all': 'All',
'common.status': 'Status',
'common.actions': 'Action',
'common.date': 'Date',
'common.amount': 'Amount',
'common.customer': 'Customer',
'common.loading': 'Loading…',
'kpi.pipelineValue': 'Open Pipeline',
'kpi.wonDeals': 'Won Deals',
'kpi.pendingLeads': 'Leads in Review',
'kpi.openProjects': 'Active Projects',
'kpi.activeLicenses': 'Active Licenses',
'kpi.outstanding': 'Outstanding',
'kpi.team': 'Team',
'footer.compliance': 'GoBD / GDPR',
'footer.selfHosted': 'self-hosted',
'footer.version': 'Version',
'portal.title': 'Client Portal',
'portal.selectCompany': 'Select your company',
'portal.isolated': 'project-scoped access',
}
const tr: Dict = {
'nav.overview': 'Genel Bakış',
'nav.sales': 'Satış',
'nav.delivery': 'Teslimat',
'nav.operations': 'Operasyon',
'nav.system': 'Sistem',
'nav.dashboard': 'Panel',
'nav.calendar': 'Son Tarihler',
'nav.reporting': 'Raporlama',
'nav.crm': 'CRM',
'nav.leads': 'Müşteri Adayı Bulucu',
'nav.estimates': 'Teklifler',
'nav.projects': 'Projeler',
'nav.support': 'Destek',
'nav.licenses': 'Lisanslar',
'nav.contracts': 'Sözleşmeler',
'nav.expenses': 'Giderler',
'nav.finance': 'Finans',
'nav.accounting': 'Muhasebe',
'nav.audit': 'Denetim Günlüğü',
'nav.kb': 'Bilgi Bankası',
'nav.api': 'API & Webhook',
'nav.settings': 'Eklentiler',
'nav.setup': 'Kurulum Sihirbazı',
'nav.settings_global': 'Ayarlar',
'common.search': 'Ara…',
'common.new': 'Yeni',
'common.save': 'Kaydet',
'common.cancel': 'İptal',
'common.close': 'Kapat',
'common.all': 'Tümü',
'common.status': 'Durum',
'common.actions': 'İşlem',
'common.date': 'Tarih',
'common.amount': 'Tutar',
'common.customer': 'Müşteri',
'common.loading': 'Yükleniyor…',
'kpi.pipelineValue': 'Açık Pipeline',
'kpi.wonDeals': 'Kazanılan Anlaşmalar',
'kpi.pendingLeads': 'İncelemede Adaylar',
'kpi.openProjects': 'Aktif Projeler',
'kpi.activeLicenses': 'Aktif Lisanslar',
'kpi.outstanding': 'Açık Alacaklar',
'kpi.team': 'Ekip',
'footer.compliance': 'GoBD / KVKK',
'footer.selfHosted': 'self-hosted',
'footer.version': 'Sürüm',
'portal.title': 'Müşteri Portalı',
'portal.selectCompany': 'Şirketinizi seçin',
'portal.isolated': 'proje kapsamlı erişim',
}
const DICTS: Record<Locale, Dict> = { de, en, tr }
export function translate(key: string, locale: Locale): string {
return DICTS[locale]?.[key] ?? DICTS.de[key] ?? key
}