Commit Graph

213 Commits

Author SHA1 Message Date
e6cca4ec19 refactor: Migrate KRS API routes to admin blueprint
- Created blueprints/admin/routes_krs_api.py with 3 routes:
  - /admin/krs-api/audit (POST)
  - /admin/krs-api/audit/batch (POST)
  - /admin/krs-api/pdf/<company_id>
- Updated templates to use new URL paths
- Added endpoint aliases for backward compatibility
- Removed ~420 lines from app.py (8150 -> 7729)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:31:36 +01:00
236e929d10 refactor: Migrate IT Audit routes to it_audit blueprint
- Created blueprints/it_audit/ with 5 routes:
  - /it-audit/form (it_audit_form)
  - /it-audit/save (it_audit_save)
  - /api/it-audit/matches/<company_id>
  - /api/it-audit/history/<company_id>
  - /api/it-audit/export
- Added endpoint aliases for backward compatibility
- Removed ~600 lines from app.py (8750 -> 8150)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:25:28 +01:00
ab15cf3cba refactor: Migrate ZOPK public routes to public blueprint
- Created blueprints/public/routes_zopk.py with 3 public routes:
  - /zopk (zopk_index)
  - /zopk/projekty/<slug> (zopk_project_detail)
  - /zopk/aktualnosci (zopk_news_list)
- Added endpoint aliases for backward compatibility
- Removed ZOPK public routes from app.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:19:53 +01:00
bdae7f5309 fix: Add ZOPK endpoint aliases for backward compatibility
Templates use url_for('admin_zopk') but blueprint endpoints are
'admin.admin_zopk'. Added aliases in blueprints/__init__.py.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:12:46 +01:00
49830855a2 refactor: Migrate ZOPK and Users API routes to admin blueprint
Major refactoring to reduce app.py size by ~22%:
- Move all ZOPK routes (47 endpoints) to 4 blueprint files:
  - routes_zopk_dashboard.py - main dashboard
  - routes_zopk_news.py - news management, scraping, AI evaluation
  - routes_zopk_knowledge.py - knowledge base, embeddings, graph
  - routes_zopk_timeline.py - milestones management
- Move Users API routes to routes_users_api.py:
  - /admin/users-api/ai-parse - AI-powered user parsing
  - /admin/users-api/bulk-create - bulk user creation
- Move notify-release to routes.py

app.py reduced from 11518 to 8916 lines (-22.6%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:05:36 +01:00
351c8fba75 refactor: Move admin_model_comparison routes to admin blueprint
- Created routes_model_comparison.py with model comparison functionality
- Updated base.html to use full blueprint name
- Added aliases for backward compatibility
- Commented old routes in app.py with _old_ prefix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 10:48:18 +01:00
532d666fa8 refactor: Move admin_ai_usage routes to admin blueprint
- Added admin_ai_usage and admin_ai_usage_user to routes_analytics.py
- Updated templates to use full blueprint names (admin.admin_ai_usage)
- Added aliases for backward compatibility
- Commented old routes in app.py with _old_ prefix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 10:43:28 +01:00
8909641ff3 refactor: Migrate analytics routes to blueprints
- Create new blueprints/admin/routes_analytics.py (~350 lines)
- Move admin_analytics and admin_analytics_export routes
- Update templates to use full blueprint names
- Add endpoint aliases for backward compatibility

Phase 6.2b - Analytics dashboard

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 10:36:23 +01:00
9b9ae40932 refactor: Add ai-learning-status and chat-stats API to blueprints
- Add api_ai_learning_status and api_chat_stats to routes_insights.py
- Update chat_analytics template to use new API path
- Add endpoint aliases for backward compatibility

Phase 6.2b - AI API routes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 10:31:29 +01:00
42f04e065f refactor: Migrate insights routes to blueprints
- Create new blueprints/admin/routes_insights.py
- Move 5 insights routes (dashboard + API endpoints)
- Update template to use new /admin/insights-api/* paths
- Add endpoint aliases for backward compatibility

Phase 6.2b - Insights routes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 10:27:35 +01:00
54c1878d66 refactor: Migrate announcements routes to blueprints
- Create new blueprints/admin/routes_announcements.py
- Move 6 announcements routes to blueprint
- Update templates to use full blueprint names
- Add endpoint aliases for backward compatibility

Phase 6.2d - Announcements routes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:41:49 +01:00
82162874b8 refactor: Migrate security routes to blueprints
- Create new blueprints/admin/routes_security.py
- Move 5 security routes: admin_security, acknowledge_security_alert,
  resolve_security_alert, unlock_account, api_geoip_stats
- Update templates to use full blueprint names
- Add endpoint aliases for backward compatibility

Phase 6.2d - Security routes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:39:12 +01:00
470e2a8bb7 refactor: Migrate admin_it_audit to blueprints
- Move IT audit dashboard route to blueprints/admin/routes_audits.py
- Add ITAudit, ITCollaborationMatch imports
- Update base.html template to use full blueprint name
- Add endpoint alias for backward compatibility

Phase 6.2f continued

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:25:31 +01:00
806f9e730e refactor: Migrate digital_maturity_dashboard and admin_krs_audit to blueprints
- Move routes from app.py to blueprints/admin/routes_audits.py
- Add endpoint aliases for backward compatibility
- Update base.html template to use full blueprint names
- Comment old routes in app.py with _old_ prefix

Phase 6.2f of blueprint migration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:19:56 +01:00
9dedab2929 refactor: Faza 6.2e - Social Media do blueprintu admin
Przeniesiono 2 trasy do blueprints/admin/routes_social.py:
- admin_social_media (analytics dashboard)
- admin_social_audit (audit dashboard)

Zaktualizowano szablony:
- base.html, dashboard.html, social_audit_dashboard.html

Dodano aliasy dla kompatybilności wstecznej.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 09:07:51 +01:00
61a32d9bfa refactor: Faza 6.2c - Status, Health, Debug do blueprintu admin
Przeniesiono 9 tras do blueprints/admin/routes_status.py:
- admin_status, api_admin_status
- admin_health, api_admin_health
- debug_panel
- api_get_logs, api_logs_stream, api_clear_logs, api_test_log

Zaktualizowano szablony na pełne nazwy blueprintów:
- base.html: admin.admin_status, admin.admin_health
- health_dashboard.html: admin.admin_status

Dodano aliasy dla kompatybilności wstecznej.
Stare trasy w app.py oznaczone jako _old_* (do usunięcia po weryfikacji).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:59:15 +01:00
52ffdafd00 refactor: Remove dead SEO/GBP audit code from app.py
Removed 280 lines of dead code after moving to blueprint.
app.py: 11,774 → 11,494 lines (-280)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:20:07 +01:00
1384c7f090 refactor: Add SEO & GBP audit routes to admin blueprint (Phase 6.2a)
- Created blueprints/admin/routes_audits.py (2 routes)
- admin_seo, admin_gbp_audit moved from app.py
- Aliases created for backward compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:16:22 +01:00
3e834c168c refactor: Remove dead admin code after Phase 6.1 verification
Removed 831 lines of dead code (_old_* functions):
- Recommendations: 3 functions
- Users: 8 functions
- Fees: 5 functions
- Calendar admin: 3 functions

app.py: 12,605 → 11,774 lines (-831)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:09:42 +01:00
44268c5425 refactor: Extract admin blueprint Part 1 (Phase 6)
Moved 19 admin routes to blueprints/admin/:
- Recommendations: 3 routes (list, approve, reject)
- Users: 8 routes (list, add, toggle-admin, toggle-verified, update, assign-company, delete, reset-password)
- Fees: 5 routes (list, generate, mark-paid, bulk-mark-paid, export)
- Calendar admin: 3 routes (list, new, delete)

Note: AI-parse routes (/api/admin/users/ai-parse, ai-create) remain in app.py.

Aliases created for backward compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:05:06 +01:00
55718ed211 refactor: Extract chat blueprint (Phase 5)
- Create blueprints/chat/ with 9 routes:
  - chat, chat_settings, chat_start, chat_send_message
  - chat_get_history, chat_list_conversations, chat_delete_conversation
  - chat_feedback, chat_analytics
- Register chat blueprint with backward-compatible aliases
- Remove dead code from app.py (-458 lines)
- app.py: 13,058 → 12,600 lines (-3.5%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:54:08 +01:00
0f482cc4aa refactor: Extract messages + notifications blueprint (Phase 4)
- Create blueprints/messages/ with 11 routes:
  - messages_inbox, messages_sent, messages_new, messages_send
  - messages_view, messages_reply, api_unread_count
  - api_notifications, api_notification_mark_read
  - api_notifications_mark_all_read, api_notifications_unread_count
- Register messages blueprint with backward-compatible aliases
- Remove dead code from app.py (-340 lines)
- app.py: 13,398 → 13,058 lines (-2.5%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:47:55 +01:00
ad2262388b refactor: Extract forum blueprint (Phase 3)
- Create blueprints/forum/ with 10 routes:
  - forum_index, forum_new_topic, forum_topic, forum_reply
  - admin_forum, admin_forum_pin, admin_forum_lock
  - admin_forum_delete_topic, admin_forum_delete_reply
  - admin_forum_change_status
- Register forum blueprint with backward-compatible aliases
- Remove dead code from app.py (-422 lines)
- app.py: 13,820 → 13,398 lines (-3.1%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:42:18 +01:00
cdd050a0ef refactor(phase2a): Cleanup dead code after blueprint migration
Removed 31 _old_ functions from app.py that were migrated to blueprints.

Stats:
- Lines removed: 1,757 (11.3% reduction)
- app.py: 15,577 → 13,820 lines

All endpoints tested and working:
- Public: /, /login, /register, /health, /release-notes
- Protected: /dashboard, /search, /kalendarz/, /chat
- Aliases: url_for('login') = url_for('auth.login')

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:29:31 +01:00
d5adf029aa refactor(phase2a): Extract auth + public blueprints with Alias Bridge
Phase 2a of modular monolith refactoring:

New blueprints:
- blueprints/auth/routes.py (1,040 lines, 20 routes)
  - login, logout, register, verify_2fa, settings_2fa
  - forgot_password, reset_password, verify_email
  - konto_dane, konto_prywatnosc, konto_bezpieczenstwo, konto_blokady
- blueprints/public/routes.py (862 lines, 11 routes)
  - index, company_detail, person_detail, search
  - dashboard, events, new_members, release_notes

Alias Bridge strategy:
- Both url_for('login') and url_for('auth.login') work
- Templates don't require changes (backward compatible)
- Original routes in app.py marked with _old_ prefix (dead code)

Next step: Cleanup dead code from app.py after production verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 07:28:18 +01:00
85cb5f14e0 docs: Release notes v1.21.0 - zmiany z 30 stycznia 2026
- Moje konto: nowa sekcja ustawień
- Forum/B2B: panel moderacji dla admina
- Reset hasła: auto-weryfikacja emaila
- UX: ikonka oka, ładne modale

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 20:36:24 +01:00
412745c875 feat: Add unified "Moje konto" (My Account) section
New user account management section with:
- /konto - Edit personal data (name, phone)
- /konto/prywatnosc - Privacy settings
- /konto/bezpieczenstwo - Security settings (2FA, password)
- /konto/blokady - User blocks management

Features:
- Consistent sidebar navigation across all pages
- Responsive layout (mobile-friendly)
- Polish UI with clear section names

Replaces scattered /settings/* routes with unified /konto/* structure.
Menu link updated from "Ustawienia" to "Moje konto".

Fixes user feedback issue #6: "Brak edycji profilu"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:52:00 +01:00
7c6379c815 fix: Auto-verify email on password reset
When user resets password, they've proven inbox access by clicking
the reset link. This change auto-verifies their email address,
eliminating the need to separately verify email after reset.

Fixes user feedback issue #2: "Reset hasła nie weryfikuje emaila"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:41:05 +01:00
3b55e14e67 fix: Poprawiona składnia rate limiter (semicolon zamiast przecinka)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:25:24 +01:00
c5b7930cef fix: Zwiększone limity rate limiting dla lepszego UX
Poprzednie limity (5/h) blokowały użytkowników po kilku próbach.
Nowe limity:
- Default: 1000/dzień, 200/h (było 200/dzień, 50/h)
- /register: 50/h + 200/dzień (było 5/h)
- /login: 60/min + 500/h (było 30/min)
- /forgot-password: 20/h (było 5/h)
- /reset-password: 30/h (było 10/h)
- /resend-verification: 15/h (było 5/h)

Feedback od: Łukasz Gilewicz, Arturo, Jarek BIS

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 19:22:54 +01:00
4c728778c6 fix: Naprawiono brak duration_seconds w sesjach użytkowników
Problem: get_or_create_analytics_session() aktualizowało last_activity_at
ale nie duration_seconds, co powodowało że czas sesji zawsze wynosił 0 min.

Rozwiązanie: Dodano obliczanie duration_seconds przy każdym page view.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:00:16 +01:00
0055857df4 feat: Rozbudowa systemu analityki użytkowników
Nowe funkcjonalności:
- GeoIP enrichment (kraj, miasto, region)
- UTM parameters tracking (source, medium, campaign, term, content)
- Bounce rate calculation
- Search queries logging
- Conversion tracking (register, login, contact_click, rsvp)
- Scroll depth tracking (25%, 50%, 75%, 100%)
- JS error tracking (window.onerror)
- Performance metrics (Web Vitals)
- CSV export (sessions, pageviews, searches, conversions)

Nowe tabele SQL:
- search_queries
- conversion_events
- js_errors
- popular_searches_daily
- hourly_activity

Dashboard rozszerzony o nowe sekcje i metryki.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:52:18 +01:00
d9f32b7235 docs: Dodanie powiadomień email do release notes v1.20.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 16:12:11 +01:00
7b0b41bac1 feat: Powiadomienie email o nowej rejestracji użytkownika
- Dodano send_registration_notification() analogicznie do send_error_notification()
- Mail wysyłany na ERROR_NOTIFY_EMAIL przy każdej nowej rejestracji
- Zawiera: imię, email, NIP, nazwa firmy, status członkostwa NORDA
- Link do panelu /admin/users

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:53:29 +01:00
e92b237fa4 docs: Reorganizacja release notes - sortowanie i wytłuszczanie
- Wszystkie release notes od v1.0.0 do v1.20.0 posortowane od najważniejszych
- Mega ważne funkcje wytłuszczone <strong>
- Dodano sekcję security w szablonie
- Stworzono przewodnik RELEASE_NOTES_GUIDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:36:11 +01:00
615665c4a1 docs: Dodanie PWA i dwóch modeli AI do release notes v1.20.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:30:17 +01:00
411fd0f0fb docs: Dodanie upgrade Gemini 3 do release notes v1.20.0
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:29:18 +01:00
aa026eecfc docs: Historia zmian v1.20.0 (29 stycznia 2026)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:27:53 +01:00
25702a808a fix: Użycie operatora @> dla PostgreSQL ARRAY contains
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:23:27 +01:00
624941114a fix: Poprawka składni SQLAlchemy dla ARRAY contains
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:21:27 +01:00
0db3cbc754 feat(announcements): Obsługa wielu kategorii dla ogłoszeń
- Zmiana formularza z select na checkboxy (wiele kategorii)
- Aktualizacja filtrowania: PostgreSQL ANY() dla tablicy categories
- Zachowanie kompatybilności wstecznej (pole category)
- Aktualizacja szablonów list.html i detail.html dla wielu badge'ów

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:19:51 +01:00
cebe52f303 refactor: Rebranding i aktualizacja modelu AI
- Zmiana nazwy: "Norda Biznes Hub" → "Norda Biznes Partner"
- Aktualizacja modelu AI: Gemini 2.0 Flash → Gemini 3 Flash
- Zachowano historyczne odniesienia w timeline i dokumentacji

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:08:39 +01:00
002a73863e fix(chat): Use correct AIAPICostLog model name for cost tracking
- Changed from AIApiCost to AIAPICostLog (actual model in database.py)
- Changed total_cost_usd to total_cost (actual field name)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:26:15 +01:00
1b2ba66ead feat(chat): Dwa klucze API - Free tier dla Flash, Paid dla Pro
- GOOGLE_GEMINI_API_KEY_FREE: klucz Free tier dla Flash (darmowy)
- GOOGLE_GEMINI_API_KEY: klucz Paid tier dla Pro (płatny)
- GeminiService automatycznie wybiera klucz na podstawie modelu
- Flash pricing ustawiony na $0.00 (Free tier)
- UI pokazuje Flash jako "Darmowy"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:19:59 +01:00
26db9a7cc9 feat(chat): Wybór modelu Flash/Pro zamiast Thinking Mode + koszt miesięczny
UI:
- Dropdown wyboru modelu: Flash (szybki, $0.05) vs Pro (analiza, $0.20)
- Wyświetlanie kosztu miesięcznego w headerze
- Badge odpowiedzi pokazuje: model, czas, koszt

Backend:
- Endpoint /api/chat/settings obsługuje model i monthly_cost
- NordaBizChatEngine przyjmuje parametr model
- Koszt zapisywany w tech_info odpowiedzi

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 11:04:29 +01:00
30729ef83e feat(ai): Thinking Mode dla NordaGPT
- Nowy SDK google-genai z obsługą thinking mode
- Przełącznik poziomu rozumowania w UI chatu (3 poziomy)
- Błyskawiczny (minimal) - szybkie odpowiedzi
- Szybki (low) - zrównoważony
- Głęboki (high) - maksymalna analiza
- Endpoint /api/chat/settings do zapisywania preferencji
- Dokumentacja dla NotebookLM (prezentacja)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 10:20:58 +01:00
2c13509cd1 feat(model-comparison): Pełny kontekst NordaGPT
Dodano:
- Audyty GBP (Google Business Profile) - oceny, recenzje
- Audyty SEO (PageSpeed) - wyniki dla stron WWW
- Baza wiedzy ZOPK - elektrownia jądrowa, offshore wind, infrastruktura
- Zasada prywatności - nie podawać ukrytych danych kontaktowych

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:18:51 +01:00
3aa302d399 fix(model-comparison): Dodanie brakującego importu ZOPKNews
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:16:12 +01:00
e589a13a71 fix(model-comparison): Pełny kontekst NordaGPT zamiast uproszczonego
- Wszystkie firmy z pełnymi danymi (nie tylko 50)
- Osoby w firmach (zarząd, wspólnicy, udziały)
- Tematy forum
- Wydarzenia
- Ogłoszenia B2B
- Rekomendacje
- Aktualności ZOPK
- Social media

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 09:12:07 +01:00
32b42ad8eb fix(admin): Fix Company attribute name description_short 2026-01-29 09:02:05 +01:00