chore: apply ESLint auto-fix across entire backend
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s
Reformats code style (line breaks, indentation, type annotations) without changing logic. Also includes minor feature additions bundled in the same lint run (stats service, user-settings groups, agrarmonitor polling improvements). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -51,18 +51,22 @@ export class DocumentPipelineService {
|
||||
|
||||
// 2. QR-Code auf erster Seite scannen
|
||||
const firstPageBuffer = await fs.readFile(images[0]);
|
||||
const qrResults = await this.qrCodeService.extractFromImage(firstPageBuffer);
|
||||
const qrResults =
|
||||
await this.qrCodeService.extractFromImage(firstPageBuffer);
|
||||
|
||||
let barcodeData: Record<string, any> | null = null;
|
||||
if (qrResults.length > 0) {
|
||||
barcodeData = this.qrCodeService.parseBarcode(qrResults[0].data);
|
||||
if (barcodeData) {
|
||||
this.logger.log(`QR-Code erkannt und validiert: ${JSON.stringify(barcodeData)}`);
|
||||
this.logger.log(
|
||||
`QR-Code erkannt und validiert: ${JSON.stringify(barcodeData)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. OCR auf erster Seite
|
||||
const ocrMarkdown = await this.ocrService.extractTextAsMarkdown(firstPageBuffer);
|
||||
const ocrMarkdown =
|
||||
await this.ocrService.extractTextAsMarkdown(firstPageBuffer);
|
||||
|
||||
// 4. Task in DB erstellen
|
||||
const year = new Date().getFullYear();
|
||||
|
||||
@@ -9,7 +9,10 @@ export class OcrService {
|
||||
private readonly ollamaModel: string;
|
||||
|
||||
constructor(private readonly configService: ConfigService) {
|
||||
this.ollamaUrl = this.configService.get<string>('OLLAMA_URL', 'http://localhost:11434');
|
||||
this.ollamaUrl = this.configService.get<string>(
|
||||
'OLLAMA_URL',
|
||||
'http://localhost:11434',
|
||||
);
|
||||
this.ollamaModel = this.configService.get<string>('OLLAMA_MODEL', 'llava');
|
||||
}
|
||||
|
||||
@@ -39,7 +42,9 @@ Antworte nur mit dem extrahierten Markdown-Text, keine Erklärungen.`;
|
||||
);
|
||||
|
||||
const markdown = response.data.response?.trim() ?? '';
|
||||
this.logger.log(`OCR abgeschlossen: ${markdown.length} Zeichen extrahiert`);
|
||||
this.logger.log(
|
||||
`OCR abgeschlossen: ${markdown.length} Zeichen extrahiert`,
|
||||
);
|
||||
return markdown;
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Ollama OCR fehlgeschlagen: ${error.message}`);
|
||||
|
||||
@@ -60,18 +60,22 @@ export class PdfService {
|
||||
|
||||
const entries = await fs.readdir(tmpDir);
|
||||
const images = entries
|
||||
.filter(f => f.endsWith('.png'))
|
||||
.filter((f) => f.endsWith('.png'))
|
||||
.sort((a, b) => {
|
||||
const numA = parseInt(a.match(/\d+/)?.[0] ?? '0', 10);
|
||||
const numB = parseInt(b.match(/\d+/)?.[0] ?? '0', 10);
|
||||
return numA - numB;
|
||||
})
|
||||
.map(f => path.join(tmpDir, f));
|
||||
.map((f) => path.join(tmpDir, f));
|
||||
|
||||
if (images.length === 0) {
|
||||
this.logger.warn(`Ghostscript hat keine Seiten erstellt: ${pdfPath} — Verzeichnisinhalt: [${entries.join(', ')}]`);
|
||||
this.logger.warn(
|
||||
`Ghostscript hat keine Seiten erstellt: ${pdfPath} — Verzeichnisinhalt: [${entries.join(', ')}]`,
|
||||
);
|
||||
} else {
|
||||
this.logger.debug(`PDF konvertiert: ${images.length} Seite(n) in ${tmpDir}`);
|
||||
this.logger.debug(
|
||||
`PDF konvertiert: ${images.length} Seite(n) in ${tmpDir}`,
|
||||
);
|
||||
}
|
||||
|
||||
return images;
|
||||
@@ -114,7 +118,9 @@ export class PdfService {
|
||||
async cleanup(imagePaths: string[]): Promise<void> {
|
||||
const dirs = new Set<string>();
|
||||
for (const imgPath of imagePaths) {
|
||||
try { await fs.unlink(imgPath); } catch {}
|
||||
try {
|
||||
await fs.unlink(imgPath);
|
||||
} catch {}
|
||||
dirs.add(path.dirname(imgPath));
|
||||
}
|
||||
for (const dir of dirs) {
|
||||
|
||||
Reference in New Issue
Block a user