ocr worker
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user