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"
}

View File

@@ -1,55 +1,13 @@
{
"feature_id": "F-099",
"feature_id": "F-103",
"stage": "close",
"agent": "leader",
"action": "Close F-099 SMTP password reset",
"action": "Close F-103",
"state": "running",
"next_agent": "security",
"waiting_for": "security gate",
"updated_at": "2026-08-21T05:29:07Z",
"updated_at": "2026-08-21T05:55:17Z",
"timeline": [
{
"ts": "2026-08-20T20:12:16Z",
"agent": "leader",
"stage": "close",
"state": "done",
"message": "F-096 cerrado: ajustes IA y generación de SEO configurados"
},
{
"ts": "2026-08-20T20:27:15Z",
"agent": "leader",
"stage": "close",
"state": "done",
"message": "F-096 cerrado: servicios levantados y configuración IA disponible"
},
{
"ts": "2026-08-20T20:31:11Z",
"agent": "implementer",
"stage": "build",
"state": "running",
"message": "Fix empty-body proxy requests and verify settings/SEO API"
},
{
"ts": "2026-08-20T20:32:20Z",
"agent": "reviewer",
"stage": "review_gate",
"state": "running",
"message": "Review empty-body proxy fix and authenticated API behavior"
},
{
"ts": "2026-08-20T20:32:27Z",
"agent": "security",
"stage": "security_gate",
"state": "running",
"message": "Check proxy body handling and error exposure"
},
{
"ts": "2026-08-20T20:32:37Z",
"agent": "qa",
"stage": "qa_gate",
"state": "running",
"message": "Run typechecks, tests, verify, and production health checks"
},
{
"ts": "2026-08-20T20:33:00Z",
"agent": "leader",
@@ -147,6 +105,48 @@
"stage": "close",
"state": "running",
"message": "Close F-099 SMTP password reset"
},
{
"ts": "2026-08-21T05:29:34Z",
"agent": "implementer",
"stage": "build",
"state": "running",
"message": "Batch of user-reported fixes"
},
{
"ts": "2026-08-21T05:55:17Z",
"agent": "implementer",
"stage": "build",
"state": "running",
"message": "Implemented editor/orders/categories/logs fixes"
},
{
"ts": "2026-08-21T05:55:17Z",
"agent": "reviewer",
"stage": "review_gate",
"state": "running",
"message": "Review F-103 changes"
},
{
"ts": "2026-08-21T05:55:17Z",
"agent": "security",
"stage": "security_gate",
"state": "running",
"message": "Check category AI endpoint auth and sanitization"
},
{
"ts": "2026-08-21T05:55:17Z",
"agent": "qa",
"stage": "qa_gate",
"state": "running",
"message": "Run typechecks, tests, builds, smoke checks"
},
{
"ts": "2026-08-21T05:55:17Z",
"agent": "leader",
"stage": "close",
"state": "running",
"message": "Close F-103"
}
]
}