feat(F-103): completed feature

This commit is contained in:
chattie
2026-08-21 07:55:18 +02:00
parent 5177a851aa
commit c07776822d
40 changed files with 886 additions and 156 deletions

View File

@@ -0,0 +1,28 @@
# F-103 — Implementer notes
## Scope
Batch of user-reported fixes: product editor layout, AI feedback, orders list,
category AI content + emoji/colors, log viewer sizing.
## Changes
- Backend:
- `migrations/034_category_description_colors.js`: categories gain description, bg_color, text_color.
- `src/shared/ai-content.ts`: shared generateWithModel + aiTextToHtml (plain text -> <p>/<ul>, sanitizes HTML) + settings loaders.
- catalog generate-seo: AI description now requested/stored as formatted HTML (aiTextToHtml), SEO fields tag-stripped.
- categories: description/bgColor/textColor in domain/repo/routes/serializer; new admin-only POST /categories/:id/generate-seo (fills empty description/seoTitle/seoDescription via configurable prompts).
- store-settings: ai_category_description_prompt / ai_category_seo_title_prompt / ai_category_seo_description_prompt keys.
- orders: GET /orders returns {items,total} with status/q/limit/offset; PgOrderRepository.search with parameterized SQL + LEFT JOIN identity_users for email search.
- Admin:
- ProductEditor: slug first + disabled/auto, Nombre + ⭐ destacado on one row, Marca/Canal/Caducidad 3-col, AI-generation banner + button feedback.
- Categories page: emoji picker grid, card color presets + bg/text color pickers with preview, description hint, AI generation with spinner feedback.
- Settings IA tab: 3 new category prompt fields.
- ServerLogViewer: max 200 lines; logs page fixed to viewport height with internal scrollbar.
- api-client: orders list normalizes array|object; categoriesApi.generateSeo; StoreSettings fields; Category bgColor/textColor.
- Frontend/storefront:
- formatRichText helper + .rich-text CSS; applied to all product description renders.
- Categories pages/cards use bgColor/textColor inline styles with fallback to legacy tailwind color.
- Category detail shows description; storefront product page uses formatted HTML; meta strips tags.
## Verification
- Backend typecheck/tests/build green; admin/frontend/storefront builds green.
- Migration 034 applied; services restarted healthy; orders search verified (total=1, state/q filters).

View File

@@ -0,0 +1,8 @@
{
"feature_id": "F-103",
"agent": "leader",
"verdict": "APPROVED",
"summary": "F-103 fixes product editor layout, orders listing, category AI content/colors, and log viewer sizing.",
"evidence": ["reviewer.json APPROVED", "security.json APPROVED", "qa.json APPROVED", "verify.sh green", "production services healthy"],
"timestamp": "2026-08-21T05:56:30Z"
}

View File

@@ -0,0 +1,14 @@
{
"feature_id": "F-103",
"agent": "qa",
"verdict": "APPROVED",
"summary": "All typechecks and builds pass; migration 034 applied; services healthy; orders search returns the existing order.",
"evidence": [
"Backend npm run typecheck and npm test pass (133 passed, 56 skipped)",
"Backend npm run build exit 0; admin, frontend, storefront builds green",
"Migration 034_category_description_colors applied",
"GET /health ok; GET /orders unauth=401; repo.search returns total=1 and filters by state/q",
"scripts/verify.sh green"
],
"timestamp": "2026-08-21T05:56:00Z"
}

View File

@@ -0,0 +1,14 @@
{
"feature_id": "F-103",
"agent": "reviewer",
"verdict": "APPROVED",
"summary": "Product editor reordered with auto/disabled slug and AI feedback; orders list fixed via paginated search endpoint; categories gain description, AI generation, emoji and bg/text color pickers; log viewer capped to viewport with 200-line cap.",
"evidence": [
"GET /orders now returns {items,total} with status/q/limit/offset filters (was plain array, breaking admin list)",
"ordersApi normalizes array|object responses",
"Category domain/repo/routes serialize description, bgColor, textColor; POST /categories/:id/generate-seo added",
"aiTextToHtml converts AI plain text to <p>/<ul> HTML and sanitizes existing HTML",
"ServerLogViewer caps at 200 lines and logs page uses fixed viewport height with internal scroll"
],
"timestamp": "2026-08-21T05:55:00Z"
}

View File

@@ -0,0 +1,13 @@
{
"feature_id": "F-103",
"agent": "security",
"verdict": "APPROVED",
"summary": "New AI and category endpoints require admin role; inputs bounded; generated HTML sanitized before storage/render; no new secret exposure.",
"evidence": [
"POST /categories/:id/generate-seo gated by authenticate + requireRole(admin)",
"bgColor/textColor limited to 20 chars, description to 4000",
"aiTextToHtml strips script/style/iframe/on* handlers and javascript: URLs; storefront formatRichText mirrors it",
"Orders search uses parameterized SQL with LEFT JOIN identity_users"
],
"timestamp": "2026-08-21T05:55:30Z"
}