Skip to content

Commit be6e40a

Browse files
committed
chore: add dvtp example Flow A - Toestemming geven [no ci]
1 parent 73504df commit be6e40a

6 files changed

Lines changed: 66 additions & 50 deletions

File tree

packages/backend/src/db/mappers.ts

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,45 +51,42 @@ export function mapDocument(r: DocumentRow): Document {
5151
};
5252
}
5353

54-
export function mapRopaRecord(
55-
row: RopaRecordRow,
56-
fields: RopaPersonalDataField[]
57-
): RopaRecord {
54+
export function mapRopaRecord(row: RopaRecordRow, fields: RopaPersonalDataField[]): RopaRecord {
5855
return {
59-
id: row.id,
60-
bpmnProcessId: row.bpmn_process_id,
61-
processLevel: row.process_level as RopaRecord['processLevel'],
62-
title: row.title,
63-
controllerName: row.controller_name,
64-
controllerContact: row.controller_contact,
65-
dpoContact: row.dpo_contact ?? undefined,
66-
purpose: row.purpose,
67-
legalBasisUri: row.legal_basis_uri,
68-
legalBasisLabel: row.legal_basis_label,
69-
gdprArticle: row.gdpr_article,
70-
dataSubjects: row.data_subjects,
71-
recipients: row.recipients,
56+
id: row.id,
57+
bpmnProcessId: row.bpmn_process_id,
58+
processLevel: row.process_level as RopaRecord['processLevel'],
59+
title: row.title,
60+
controllerName: row.controller_name,
61+
controllerContact: row.controller_contact,
62+
dpoContact: row.dpo_contact ?? undefined,
63+
purpose: row.purpose,
64+
legalBasisUri: row.legal_basis_uri,
65+
legalBasisLabel: row.legal_basis_label,
66+
gdprArticle: row.gdpr_article,
67+
dataSubjects: row.data_subjects,
68+
recipients: row.recipients,
7269
thirdCountryTransfers: row.third_country_transfers,
73-
thirdCountryDetails: row.third_country_details ?? undefined,
74-
retentionPeriod: row.retention_period,
75-
securityMeasures: row.security_measures,
76-
status: row.status as RopaRecord['status'],
77-
schemaVersion: row.schema_version,
78-
personalDataFields: fields,
79-
createdAt: row.created_at.toISOString(),
80-
updatedAt: row.updated_at.toISOString(),
70+
thirdCountryDetails: row.third_country_details ?? undefined,
71+
retentionPeriod: row.retention_period,
72+
securityMeasures: row.security_measures,
73+
status: row.status as RopaRecord['status'],
74+
schemaVersion: row.schema_version,
75+
personalDataFields: fields,
76+
createdAt: row.created_at.toISOString(),
77+
updatedAt: row.updated_at.toISOString(),
8178
};
8279
}
8380

8481
export function mapRopaField(row: RopaFieldRow): RopaPersonalDataField {
8582
return {
86-
id: row.id,
87-
ropaRecordId: row.ropa_record_id,
88-
formId: row.form_id,
89-
fieldKey: row.field_key,
90-
fieldLabel: row.field_label,
91-
dataCategory: row.data_category,
83+
id: row.id,
84+
ropaRecordId: row.ropa_record_id,
85+
formId: row.form_id,
86+
fieldKey: row.field_key,
87+
fieldLabel: row.field_label,
88+
dataCategory: row.data_category,
9289
specialCategory: row.special_category,
93-
sortOrder: row.sort_order,
90+
sortOrder: row.sort_order,
9491
};
95-
}
92+
}

packages/backend/src/db/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ export type RopaFieldRow = {
7272
data_category: string;
7373
special_category: boolean;
7474
sort_order: number;
75-
};
75+
};

packages/backend/src/routes/assets.public.routes.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ const router = Router();
1111
router.use(cors({ origin: '*', methods: ['GET', 'OPTIONS'] }));
1212

1313
router.get('/', async (_req: Request, res: Response) => {
14-
try {
15-
const data = await listPublicBundles();
16-
res.json({ success: true, data });
17-
} catch (err) {
18-
logger.error('[assets.public] listPublicBundles failed', { error: getErrorMessage(err) });
19-
res.status(500).json({
20-
success: false,
21-
error: { code: 'LIST_FAILED', message: getErrorMessage(err) },
22-
});
23-
}
14+
try {
15+
const data = await listPublicBundles();
16+
res.json({ success: true, data });
17+
} catch (err) {
18+
logger.error('[assets.public] listPublicBundles failed', { error: getErrorMessage(err) });
19+
res.status(500).json({
20+
success: false,
21+
error: { code: 'LIST_FAILED', message: getErrorMessage(err) },
22+
});
23+
}
2424
});
2525

26-
export default router;
26+
export default router;

packages/backend/src/routes/assets.routes.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ router.delete('/bpmn/:id', async (req: Request, res: Response) => {
7373
router.patch('/bpmn/:id/deploy', async (req: Request, res: Response) => {
7474
if (!dbRequired(req, res)) return;
7575
try {
76-
const { deploymentId, operatonUrl, formIds = [], documentIds = [] } = req.body as {
76+
const {
77+
deploymentId,
78+
operatonUrl,
79+
formIds = [],
80+
documentIds = [],
81+
} = req.body as {
7782
deploymentId: string;
7883
operatonUrl?: string;
7984
formIds?: string[];
@@ -83,7 +88,12 @@ router.patch('/bpmn/:id/deploy', async (req: Request, res: Response) => {
8388
res.json({ success: true });
8489
} catch (err) {
8590
logger.error('[assets] markDeployed failed', { error: getErrorMessage(err) });
86-
res.status(500).json({ success: false, error: { code: 'DEPLOY_MARK_FAILED', message: getErrorMessage(err) } });
91+
res
92+
.status(500)
93+
.json({
94+
success: false,
95+
error: { code: 'DEPLOY_MARK_FAILED', message: getErrorMessage(err) },
96+
});
8797
}
8898
});
8999

packages/backend/src/services/assets.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ export async function listPublicBundles(): Promise<unknown[]> {
185185
operatonDeploymentId: r.operaton_deployment_id ?? undefined,
186186
deployedForms: (r as unknown as { forms: { id: string; name: string }[] }).forms,
187187
deployedDocuments: (r as unknown as { documents: { id: string; name: string }[] }).documents,
188-
subprocesses: (r as unknown as { subprocesses: { id: string; name: string; bpmnProcessId: string; status: string }[] }).subprocesses,
188+
subprocesses: (
189+
r as unknown as {
190+
subprocesses: { id: string; name: string; bpmnProcessId: string; status: string }[];
191+
}
192+
).subprocesses,
189193
updatedAt: r.updated_at,
190194
}));
191195
}

packages/backend/src/services/ropa.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export async function listRopa(): Promise<RopaRecord[]> {
2424

2525
export async function getRopaById(id: string): Promise<RopaRecord | null> {
2626
if (!pool) return null;
27-
const { rows } = await pool.query<RopaRecordRow>(`SELECT * FROM ropa_records WHERE id = $1`, [id]);
27+
const { rows } = await pool.query<RopaRecordRow>(`SELECT * FROM ropa_records WHERE id = $1`, [
28+
id,
29+
]);
2830
if (rows.length === 0) return null;
2931
const { rows: fieldRows } = await pool.query<RopaFieldRow>(
3032
`SELECT * FROM ropa_personal_data_fields WHERE ropa_record_id = $1 ORDER BY sort_order ASC`,
@@ -158,7 +160,10 @@ export async function listPublicRopa(organisation?: string): Promise<PublicRopaR
158160
[ids]
159161
);
160162
return recordRows.map((r) => {
161-
const full = mapRopaRecord(r, fieldRows.filter((f) => f.ropa_record_id === r.id).map(mapRopaField));
163+
const full = mapRopaRecord(
164+
r,
165+
fieldRows.filter((f) => f.ropa_record_id === r.id).map(mapRopaField)
166+
);
162167
// Strip internal fields before exposing publicly
163168
// eslint-disable-next-line @typescript-eslint/no-unused-vars
164169
const { schemaVersion, controllerContact, dpoContact, ...pub } = full;

0 commit comments

Comments
 (0)