fixes
This commit is contained in:
1 parent
6586722652
commit
1e7c7bbfbb
65 files changed
+1345
-640
No files matched your search
@@ -0,0 +1,26 @@
|
||||
# v16 — Public API processing in Product Management
|
||||
|
||||
## What changes
|
||||
|
||||
- `POST /api/v1/products/process` (with `items[]` or `raw_product_ids[]`), `POST /api/v1/process`, and API-key feed sample processing (`POST /api/v1/feeds/{id}/sync-process-sample`) now create jobs with `origin = '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 is `completed` so it appears under **Product Management → Processed** without another manual approval step.
|
||||
- A small `API` label 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
|
||||
|
||||
1. Apply database migration `051_api_processed_catalog_visibility.sql` (`npm run migrate`).
|
||||
2. Deploy the updated API, worker and web frontend together (the usual `rb` command also runs migrations).
|
||||
3. 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.
|
||||
Reference in new issue
Block a user