feat(poc): expandir POC con datos multilingues, admin pre-creado y guia completa

- poc/seed.sql: 17 noticias (ES/EN/FR) con traducciones y 25 entidades NER
- poc/poc.sh: corregir VITE_API_URL (faltaba sufijo /api), crear admin con bcrypt
- docs/POC_GUIDE.md: guia paso a paso para que el compañero explore la demo
- README.md: añadir credenciales admin y enlace a la guia POC

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
SITO 2026-03-30 22:42:12 +02:00
parent b3bf3d7a7f
commit 10f0555c46
4 changed files with 553 additions and 73 deletions

View file

@ -251,7 +251,32 @@ sudo -u postgres psql -q -d "${POC_DB_NAME}" \
NEWS_COUNT=$(sudo -u postgres psql -tq -d "${POC_DB_NAME}" \
-c "SELECT COUNT(*) FROM noticias;" 2>/dev/null | tr -d ' \n' || echo "?")
info "BD lista: ${NEWS_COUNT} noticias de prueba"
info "BD lista: ${NEWS_COUNT} noticias de prueba (ES/EN/FR con traducciones y entidades)"
# Crear usuario admin pre-configurado
step "Creando usuario admin para la demo..."
ADMIN_USER="admin"
ADMIN_PASS="admin123"
ADMIN_CREATED=false
if python3 -c "import bcrypt" 2>/dev/null; then
ADMIN_HASH=$(python3 -c "
import bcrypt
hashed = bcrypt.hashpw(b'admin123', bcrypt.gensalt(rounds=10))
print(hashed.decode())
")
sudo -u postgres psql -q -d "${POC_DB_NAME}" -c \
"INSERT INTO users (username, email, password_hash, is_admin, role)
VALUES ('${ADMIN_USER}', 'admin@coconews.local', '${ADMIN_HASH}', TRUE, 'admin')
ON CONFLICT (username) DO NOTHING;" 2>/dev/null && ADMIN_CREATED=true || true
fi
if [[ "$ADMIN_CREATED" == "true" ]]; then
info "Admin listo: ${ADMIN_USER} / ${ADMIN_PASS}"
else
warn "python3-bcrypt no disponible — regístrate en la UI (primer usuario será admin)"
warn "Instala bcrypt: pip3 install bcrypt y vuelve a ejecutar --clean"
fi
# =============================================================================
# 4. REDIS (instancia temporal en puerto alternativo)
@ -369,7 +394,7 @@ if [[ ! -d node_modules ]]; then
fi
step " Compilando frontend..."
VITE_API_URL="http://127.0.0.1:${POC_API_PORT}" \
VITE_API_URL="http://127.0.0.1:${POC_API_PORT}/api" \
npm run build -- --outDir "$TMP_DIR/frontend-dist" \
>"$LOG_DIR/build-frontend.log" 2>&1 || {
echo -e " ${RED}Error de compilación del frontend:${NC}"
@ -414,11 +439,16 @@ echo -e " ${BOLD}Endpoints útiles:${NC}"
echo -e " API stats: http://127.0.0.1:${POC_API_PORT}/api/stats"
echo -e " API noticias: http://127.0.0.1:${POC_API_PORT}/api/news"
echo ""
echo -e " ${BOLD}Primer login:${NC}"
echo -e " ${BOLD}Login admin:${NC}"
if [[ "$ADMIN_CREATED" == "true" ]]; then
echo -e " Usuario: ${BOLD}${ADMIN_USER}${NC}"
echo -e " Contraseña: ${BOLD}${ADMIN_PASS}${NC}"
else
echo -e " Regístrate en la UI → el primer usuario es admin automáticamente"
fi
echo ""
echo -e " ${BOLD}Datos cargados:${NC} ${NEWS_COUNT} noticias de prueba en español"
echo -e " ${YELLOW}Sin workers ML:${NC} no hay traducción ni entidades (normal en POC)"
echo -e " ${BOLD}Datos cargados:${NC} ${NEWS_COUNT} noticias (ES/EN/FR), traducciones y entidades NER"
echo -e " ${YELLOW}Sin workers ML:${NC} sin ingesta en tiempo real (normal en POC)"
echo ""
echo -e " ${BOLD}Si algo falla:${NC}"
echo -e " Logs: $LOG_DIR/"