ocr worker

This commit is contained in:
m
2026-07-12 14:35:30 +02:00
parent 911592758a
commit 67096c9482
6 changed files with 73 additions and 13 deletions
+4
View File
@@ -13,6 +13,7 @@ import (
type FileHandler struct {
files *service.FileService
urls *service.URLService
ocr *service.OCRService
}
func (h *FileHandler) Upload(c *gin.Context) {
@@ -35,6 +36,9 @@ func (h *FileHandler) Upload(c *gin.Context) {
api.Error(c, http.StatusInternalServerError, "UPLOAD_ERROR", err.Error())
return
}
h.ocr.Enqueue(result.ID, result.Path)
results = append(results, gin.H{
"id": result.ID,
"name": result.Name,
+3 -3
View File
@@ -5,14 +5,14 @@ import (
)
type Handler struct {
File *FileHandler
OCR *OCRHandler
File *FileHandler
OCR *OCRHandler
Health *HealthHandler
}
func New(fileSvc *service.FileService, ocrSvc *service.OCRService, urlSvc *service.URLService) *Handler {
return &Handler{
File: &FileHandler{files: fileSvc, urls: urlSvc},
File: &FileHandler{files: fileSvc, urls: urlSvc, ocr: ocrSvc},
OCR: &OCRHandler{ocr: ocrSvc, files: fileSvc},
Health: &HealthHandler{ocr: ocrSvc},
}