2.5 KiB
2.5 KiB
v16 — Public API processing in Product Management
What changes
POST /api/v1/products/process(withitems[]orraw_product_ids[]),POST /api/v1/process, and API-key feed sample processing (POST /api/v1/feeds/{id}/sync-process-sample) now create jobs withorigin = 'api'.- Both API routes use the same company-scoped raw/processed product tables as the web dashboard. They do not create separate/invisible API-only results.
- Once each API item succeeds, the worker persists its generated title, description, attributes, SEO metadata and localized content in
processed_products. Its status iscompletedso it appears under Product Management → Processed without another manual approval step. - A small
APIlabel distinguishes the processing origin. If the product belongs to an input feed, the original feed remains displayed. - Web dashboard and feed-triggered processing keep their existing Needs review workflow.
- Processing the same EAN again updates its single existing product record. API-only partial processing (for example SEO metadata) preserves unrelated previously generated content instead of blanking it.
- The product detail drawer reads the full saved product and localized content, so API-enriched results can be inspected and edited normally.
- The dashboard API is company-scoped: clients cannot view other companies' products.
Deploy
- Apply database migration
051_api_processed_catalog_visibility.sql(npm run migrate). - Deploy the updated API, worker and web frontend together (the usual
rbcommand also runs migrations). - Start a public API process job, poll until
COMPLETED, then open Product Management → Processed and refresh; the latest product appears with its generated fields. Use the same EAN to test reprocessing.
No new API request fields are needed. Existing results already marked needs_review are not mass-approved retroactively: older processing jobs did not record a reliable origin. They remain available under Needs review, and subsequent API processing makes them appear under Processed. This avoids accidentally accepting content that a company expected to review.
Verification
go test ./internal/processing -run TestAPIProcessedProductVisibleInCatalog -count=1
Run from apps/api on a Go 1.25 host with a migrated test PostgreSQL database in DATABASE_URL. The integration test exercises company isolation, API/dashboard job origins, completed/review list filters, detail fields, and an SEO-only reprocess.