refactor(admin): split vvt-baseline-catalog into domain barrel
Extracted 630-LOC monolith into 6 domain files (all <200 LOC) plus a 29-line barrel re-exporting everything for zero breaking-change impact. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
63
admin-compliance/lib/sdk/vvt-baseline-catalog/helpers.ts
Normal file
63
admin-compliance/lib/sdk/vvt-baseline-catalog/helpers.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* VVT Baseline-Katalog — Helpers & Catalog Assembly
|
||||
*/
|
||||
|
||||
import type { BusinessFunction } from '../vvt-types'
|
||||
import type { BaselineTemplate } from './types'
|
||||
import { HR_VVT_TEMPLATES, FINANCE_VVT_TEMPLATES } from './hr-finance'
|
||||
import { SALES_CRM_VVT_TEMPLATES } from './sales-crm'
|
||||
import { MARKETING_VVT_TEMPLATES } from './marketing'
|
||||
import { SUPPORT_VVT_TEMPLATES, IT_OPERATIONS_VVT_TEMPLATES } from './support-it'
|
||||
import { OTHER_VVT_TEMPLATES } from './other'
|
||||
|
||||
export const VVT_BASELINE_CATALOG: BaselineTemplate[] = [
|
||||
...HR_VVT_TEMPLATES,
|
||||
...FINANCE_VVT_TEMPLATES,
|
||||
...SALES_CRM_VVT_TEMPLATES,
|
||||
...MARKETING_VVT_TEMPLATES,
|
||||
...SUPPORT_VVT_TEMPLATES,
|
||||
...IT_OPERATIONS_VVT_TEMPLATES,
|
||||
...OTHER_VVT_TEMPLATES,
|
||||
]
|
||||
|
||||
export function templateToActivity(
|
||||
template: BaselineTemplate,
|
||||
vvtId: string,
|
||||
): Omit<import('../vvt-types').VVTActivity, 'id'> & { id: string } {
|
||||
const now = new Date().toISOString()
|
||||
return {
|
||||
id: crypto.randomUUID(),
|
||||
vvtId,
|
||||
name: template.name,
|
||||
description: template.description,
|
||||
purposes: template.purposes,
|
||||
legalBases: template.legalBases,
|
||||
dataSubjectCategories: template.dataSubjectCategories,
|
||||
personalDataCategories: template.personalDataCategories,
|
||||
recipientCategories: template.recipientCategories,
|
||||
thirdCountryTransfers: [],
|
||||
retentionPeriod: template.retentionPeriod,
|
||||
tomDescription: template.tomDescription,
|
||||
businessFunction: template.businessFunction,
|
||||
systems: template.typicalSystems.map((s, i) => ({ systemId: `sys-${i}`, name: s })),
|
||||
deploymentModel: 'cloud',
|
||||
dataSources: [{ type: 'DATA_SUBJECT', description: 'Direkt von der betroffenen Person' }],
|
||||
dataFlows: [],
|
||||
protectionLevel: template.protectionLevel,
|
||||
dpiaRequired: template.dpiaRequired,
|
||||
structuredToms: template.structuredToms,
|
||||
status: 'DRAFT',
|
||||
responsible: '',
|
||||
owner: '',
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
}
|
||||
}
|
||||
|
||||
export function getTemplatesByFunction(fn: BusinessFunction): BaselineTemplate[] {
|
||||
return VVT_BASELINE_CATALOG.filter(t => t.businessFunction === fn)
|
||||
}
|
||||
|
||||
export function getTemplateById(templateId: string): BaselineTemplate | undefined {
|
||||
return VVT_BASELINE_CATALOG.find(t => t.templateId === templateId)
|
||||
}
|
||||
Reference in New Issue
Block a user