- 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)
30 lines
769 B
TypeScript
30 lines
769 B
TypeScript
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)]),
|
|
});
|