feat(PROJ-44): ocr_status/ocr_chars in MailDetail + v1 API
GET /api/mails/{id} liefert jetzt ocr_status + ocr_chars fuer das GUI-
Badge und den konditionalen Download-Button. Die externe v1-API
(/api/v1/mails/{id}) bekommt zusaetzlich ocr_status, damit CRM-
Integrationen entscheiden koennen, ob ein OCR-Text-Pull lohnt.
This commit is contained in:
@@ -244,6 +244,13 @@ func (s *Server) handleV1GetMail(w http.ResponseWriter, r *http.Request) {
|
||||
dateStr = pm.Date.UTC().Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// PROJ-44: expose ocr_status to external API consumers as well so CRM
|
||||
// integrations can decide whether to ask for ocr-text downloads.
|
||||
ocrStatus, _, _ := s.store.GetOCRMeta(r.Context(), id)
|
||||
if ocrStatus == "" {
|
||||
ocrStatus = "pending"
|
||||
}
|
||||
|
||||
writeJSON(w, http.StatusOK, map[string]interface{}{
|
||||
"id": id,
|
||||
"from": pm.From,
|
||||
@@ -254,6 +261,7 @@ func (s *Server) handleV1GetMail(w http.ResponseWriter, r *http.Request) {
|
||||
"size": len(raw),
|
||||
"body_plain": pm.TextBody,
|
||||
"attachments": attachments,
|
||||
"ocr_status": ocrStatus,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user