feat: Datenmodell Sprachnotizen (T7 L2 Task 4)

VoiceCapture und VoiceCaptureAudio nach Spec §3 mit CHECKs
(audioBytes 1..2 MiB, durationSec 1..240, CONFIRMED genau mit
inspectionId, audioMime nur bei AUDIO), Recht voice-captures:use für
ADMIN, BEEKEEPER und STAFF, Sperrreihenfolge mit VoiceCapture am Ende,
Ausschluss aus dem Backup mit Begründung, Wächter gegen Suche und
Export.

Refs #27

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-10-16 09:20:04 +02:00
1 parent 257286fbef
commit af9df0afe4
10 files changed
+412

No files matched your search

+32
View File
@@ -1,3 +1,5 @@
import * as fs from 'node:fs';
import * as path from 'node:path';
import { INestApplication } from '@nestjs/common';
import * as bcrypt from 'bcryptjs';
import request from 'supertest';
@@ -95,3 +97,33 @@ describe('Search and filters (e2e)', () => {
expect(colonies.map((entry) => entry.id)).toEqual([dissolvedColonyId]);
});
});
describe('Voice capture content guard', () => {
// VoiceCapture holds personal data that is deleted after at most 7 days. It
// must never be reachable through search or any export/report builder.
const sourceRoots = ['search', 'export'].map((dir) =>
path.resolve(__dirname, '../src', dir),
);
function sourceFiles(dir: string): string[] {
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) return sourceFiles(full);
return entry.name.endsWith('.ts') ? [full] : [];
});
}
it('VoiceCapture appears in no search provider and no export', () => {
const files = sourceRoots.flatMap(sourceFiles);
expect(files.length).toBeGreaterThan(0);
for (const file of files) {
expect({
file: path.basename(file),
mentions: /voiceCapture|VoiceCapture/.test(
fs.readFileSync(file, 'utf8'),
),
}).toEqual({ file: path.basename(file), mentions: false });
}
});
});