Initial commit of Descrybe v2 without local scratch artifacts.

Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
2026-08-09 22:47:43 +02:00
commit 8580c996c3
1285 changed files with 325780 additions and 0 deletions
@@ -0,0 +1,43 @@
package processing
import (
"context"
"encoding/json"
"github.com/google/uuid"
)
// loadEnabledStandardFields returns enabled standard_fields for fill-missing.
func (p *Pipeline) loadEnabledStandardFields(ctx context.Context, companyID uuid.UUID) ([]StandardFieldDef, error) {
if p == nil || p.Pool == nil {
return nil, nil
}
rows, err := p.Pool.Query(ctx, `
SELECT key, COALESCE(default_value, ''), COALESCE(unit, ''), COALESCE(mapping_hints, '[]'::jsonb)
FROM standard_fields
WHERE company_id = $1 AND enabled = true
ORDER BY sort_order ASC, key ASC`, companyID)
if err != nil {
// Table / columns may be absent in older local DBs — treat as no defs.
return nil, nil
}
defer rows.Close()
out := make([]StandardFieldDef, 0)
for rows.Next() {
var key, defVal, unit string
var hintsRaw []byte
if err := rows.Scan(&key, &defVal, &unit, &hintsRaw); err != nil {
return nil, err
}
var hints any
_ = json.Unmarshal(hintsRaw, &hints)
out = append(out, StandardFieldDef{
Key: key,
DefaultValue: defVal,
Unit: unit,
MappingHints: parseHints(hints),
})
}
return out, rows.Err()
}