feat: add VoicePrint tRPC router with service, ML engine, and storage modules

- Create voiceprint router with 7 protected procedures:
  getEnrollments, createEnrollment, deleteEnrollment, analyzeAudio,
  getAnalyses, getAnalysisResult, getJobStatus
- Create voiceprint service with core business logic:
  enrollment CRUD, audio analysis pipeline, alert creation, batch jobs
- Create ML engine with placeholder implementations for
  audio preprocessing, synthetic detection, voice matching, embedding
- Create storage module for audio file persistence on disk
- Add valibot schemas for input validation
- Wire voiceprint router into root tRPC router
- Add comprehensive unit tests (33 tests, all passing)
This commit is contained in:
2026-05-25 16:28:43 -04:00
parent b2c3470a71
commit bec8cbf269
10 changed files with 1033 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import { object, string, minLength, optional, number, picklist } from "valibot";
export const CreateEnrollmentSchema = object({
name: string([minLength(1)]),
audioBase64: string([minLength(1)]),
});
export const DeleteEnrollmentSchema = object({
enrollmentId: string([minLength(1)]),
});
export const AnalyzeAudioSchema = object({
audioBase64: string([minLength(1)]),
enrollmentId: optional(string()),
});
export const AnalysisFilterSchema = object({
page: optional(number(), 1),
limit: optional(number(), 20),
verdict: optional(picklist(["NATURAL", "SYNTHETIC", "UNCERTAIN"])),
});
export const AnalysisResultSchema = object({
analysisId: string([minLength(1)]),
});
export const JobStatusSchema = object({
jobId: string([minLength(1)]),
});