feat: add repository pattern, service layer architecture, and scheduler management

- Implement repository pattern for data access layer
- Add comprehensive service layer for business logic
- Create scheduler management system with health monitoring
- Add bounded buffer utility for memory management
- Enhance security audit logging with retention policies
This commit is contained in:
2025-07-12 07:00:37 +02:00
parent e1abedb148
commit 041a1cc3ef
54 changed files with 5755 additions and 878 deletions

View File

@ -1,5 +1,5 @@
// SessionImport to Session processor
import { ProcessingStage, SentimentCategory } from "@prisma/client";
import { ProcessingStage } from "@prisma/client";
import cron from "node-cron";
import { withRetry } from "./database-retry";
import { getSchedulerConfig } from "./env";
@ -77,34 +77,6 @@ function parseEuropeanDate(dateStr: string): Date {
return date;
}
/**
* Helper function to parse sentiment from raw string (fallback only)
*/
function _parseFallbackSentiment(
sentimentRaw: string | null
): SentimentCategory | null {
if (!sentimentRaw) return null;
const sentimentStr = sentimentRaw.toLowerCase();
if (sentimentStr.includes("positive")) {
return SentimentCategory.POSITIVE;
}
if (sentimentStr.includes("negative")) {
return SentimentCategory.NEGATIVE;
}
return SentimentCategory.NEUTRAL;
}
/**
* Helper function to parse boolean from raw string (fallback only)
*/
function _parseFallbackBoolean(rawValue: string | null): boolean | null {
if (!rawValue) return null;
return ["true", "1", "yes", "escalated", "forwarded"].includes(
rawValue.toLowerCase()
);
}
/**
* Parse transcript content into Message records
*/