Replace ~170 manual `if not current_user.is_admin` checks with:
- @role_required(SystemRole.ADMIN) for user management, security, ZOPK
- @role_required(SystemRole.OFFICE_MANAGER) for content management
- current_user.can_access_admin_panel() for admin UI access
- current_user.can_moderate_forum() for forum moderation
- current_user.can_edit_company(id) for company permissions
Add @office_manager_required decorator shortcut.
Add SQL migration to sync existing users' role field.
Role hierarchy: UNAFFILIATED(10) < MEMBER(20) < EMPLOYEE(30) < MANAGER(40) < OFFICE_MANAGER(50) < ADMIN(100)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When admin proposes changes from KRS/CEIDG registry, the application
now goes to 'pending_user_approval' status. User must review and
accept/reject proposed changes before final approval.
Changes:
- New status: pending_user_approval
- New fields: proposed_changes, proposed_changes_at, proposed_changes_by_id
- Admin endpoint: POST /admin/membership/<id>/propose-changes
- User endpoints: GET/POST /membership/review-changes/<id>/accept|reject
- New template: templates/membership/review_changes.html
- Migration: 043_membership_proposed_changes.sql
Workflow: submitted → under_review → pending_user_approval → under_review → approved
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement full online membership application workflow:
- 3-step wizard form with KRS/CEIDG auto-fill
- Admin panel for application review (approve/reject/request changes)
- Company data update requests for existing members
- Dashboard CTA for users without company
- API endpoints for NIP lookup and draft management
New files:
- database/migrations/042_membership_applications.sql
- blueprints/membership/ (routes, templates)
- blueprints/admin/routes_membership.py
- blueprints/api/routes_membership.py
- templates/membership/ and templates/admin/membership*.html
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove confusing "Zweryfikowano 2x | Jakość: 100%" badge
- Create AiEnrichmentProposal model for pending AI suggestions
- Modify AI enrichment to create proposals instead of direct saves
- Add approve/reject API endpoints for proposals
- Update frontend to show approval buttons after AI analysis
- Proposals expire after 30 days if not reviewed
The workflow now requires owner/admin approval before AI-generated
data is applied to company profiles. This prevents unwanted data
from being automatically added.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add krs_raw_data, krs_fetched_at, krs_registration_date,
krs_representation, krs_activities columns to Company model
- Save complete KRS API response for full data access
- Display in company profile:
- Board members (zarząd) with functions and avatars
- Shareholders (wspólnicy) with share amounts
- Representation method (sposób reprezentacji)
- Business activities (PKD codes)
- Registration date with years active
- KRS address with region info
- OPP (public benefit) status
- Metadata (stan_z_dnia, data_odpisu)
- Add migration 037_krs_extended_data.sql
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add new Company fields: ceidg_id, ceidg_status, pkd_codes (JSONB),
correspondence address, owner_citizenships, ceidg_raw_data
- Add enrich_companies_from_ceidg() to fetch full CEIDG details
- Add fetch_full_ceidg_details() for detailed API calls
- Add update_company_from_ceidg() to save all CEIDG fields
- Add --enrich and --apply flags for batch enrichment
- Add migration 036_ceidg_extended_data.sql
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements 6-tier role hierarchy:
- ADMIN (100): Full system access
- OFFICE_MANAGER (50): Admin panel without user management
- MANAGER (40): Full company control + user management
- EMPLOYEE (30): Edit company data (with delegated permissions)
- MEMBER (20): Full content access (forum, contacts, chat)
- UNAFFILIATED (10): Public profiles only
Features:
- SystemRole and CompanyRole enums in database.py
- UserCompanyPermissions model for delegation
- New decorators: @role_required(), @company_permission()
- Auto-detection of MANAGER role from KRS data
- Backward compatible with is_admin flag
Migration: 035_add_role_system.sql
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ClassifiedInterest model for tracking user interest in listings
- Add ClassifiedQuestion model for public Q&A on listings
- Add context_type/context_id to PrivateMessage for B2B linking
- Add interest toggle button and interests list modal
- Add Q&A section with ask/answer/hide functionality
- Update messages to show B2B context badge
- Create migration 034_classified_interactions.sql
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ForumTopicRead, ForumReplyRead, ClassifiedRead models
- Add SQL migration for new tables
- Record reads when user views forum topic (topic + all visible replies)
- Record reads when user views B2B classified
- Display "Seen by" avatars in forum topic and B2B detail pages
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Dodanie kolumny categories (ARRAY) do tabeli announcements
- Nowe metody: categories_labels, has_category()
- Migracja 029: dodanie kolumny i mapowanie danych
- Zachowanie kompatybilności wstecznej z polem category
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 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>
Użytkownicy mogą teraz wskazać preferowane kanały komunikacji:
- Email, telefon, wiadomości w portalu (toggle)
- Dodatkowa notatka (np. najlepsze godziny kontaktu)
Migracja: 031_add_contact_preferences.sql
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Dodanie parent_id do tabeli categories
- Model Category z relacją parent/subcategories
- 4 główne grupy: Usługi, Budownictwo, Handel, Produkcja
- Skrypt assign_category_parents.py do przypisania podkategorii
- Migracja 030_add_category_hierarchy.sql
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Nowa tabela user_blocks do przechowywania blokad
- Model UserBlock w database.py
- Sprawdzanie blokad przed wysłaniem wiadomości (messages_send, messages_reply)
- UI zarządzania blokadami w /settings/blocks
- Nawigacja między ustawieniami (prywatność, blokady, 2FA)
- Blokada działa w obie strony
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Nowe pola: privacy_show_phone, privacy_show_email w tabeli users
- Nowy route /settings/privacy z UI do zarządzania prywatnością
- Link "Ustawienia" w menu użytkownika
- Toggle switches do włączania/wyłączania widoczności danych
- Migracja SQL: 028_add_user_privacy_settings.sql
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Nowy model ExternalContact z pełnymi danymi kontaktowymi, social media, related_links (JSONB)
- Migracja SQL 020_external_contacts.sql z full-text search
- Routes: /kontakty (lista), /kontakty/dodaj, /kontakty/<id>, /kontakty/<id>/edytuj
- Szablony: lista z filtrami, karta szczegółów, formularz CRUD
- Nawigacja: link "Kontakty zewnętrzne" w dropdown Społeczność
- Poprawka: aktualizacja liczby firm z 80 na 111
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Nowa tabela announcement_reads do śledzenia kto przeczytał
- Avatary użytkowników z inicjałami (tooltip z nazwiskiem)
- Statystyki: liczba i procent użytkowników którzy przeczytali
- Progress bar wizualizujący zasięg ogłoszenia
- Automatyczny zapis odczytu przy otwarciu ogłoszenia
Autor: Maciej Pienczyn
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Dodano skrypt cron do automatycznej ekstrakcji wiedzy (scripts/cron_extract_knowledge.py)
- Dodano panel deduplikacji faktów (/admin/zopk/knowledge/fact-duplicates)
- Dodano API i funkcje auto-weryfikacji encji i faktów
- Dodano panel Timeline ZOPK (/admin/zopk/timeline) z CRUD
- Rozszerzono dashboard bazy wiedzy o statystyki weryfikacji i przyciski auto-weryfikacji
- Dodano migrację 016_zopk_milestones.sql dla tabeli kamieni milowych
- Naprawiono duplikat modelu ZOPKMilestone w database.py
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Priorytet 1 - Panel admina bazy wiedzy ZOPK:
- /admin/zopk/knowledge - dashboard ze statystykami
- /admin/zopk/knowledge/chunks - lista chunks z filtrowaniem
- /admin/zopk/knowledge/facts - lista faktów z typami
- /admin/zopk/knowledge/entities - lista encji z mentions
- CRUD operacje: weryfikacja, usuwanie
Priorytet 2 - Poprawa jakości odpowiedzi NordaGPT:
- Linki markdown do źródeł w kontekście ZOPK
- Ulepszone formatowanie (bold, listy, nagłówki)
- Sekcja "Źródła" na końcu odpowiedzi
- Instrukcje w system prompt dla lepszej prezentacji
Priorytet 3 - Timeline ZOPK:
- Model ZOPKMilestone w database.py
- Migracja 016_zopk_milestones.sql z sample data
- Sekcja "Roadmapa ZOPK" na stronie /zopk
- Pionowa oś czasu z markerami lat
- Statusy: completed, in_progress, planned, delayed
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- New admin panel /admin/krs-audit for KRS data extraction
- Full PDF parser extracting: company data, capital, shares, PKD codes,
management board, shareholders, procurators, financial reports
- API endpoints for single/batch audits and PDF download
- Company profile shows "Odpis PDF" button and last audit date
- Database migration for krs_audits, company_pkd, company_financial_reports
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ai_relevance_score column (1-5) to zopk_news table
- Update AI prompt to return score with detailed criteria:
* 1 star = very weak (loose connection to region/industry)
* 2 stars = weak (general industry news)
* 3 stars = medium (relates to ZOPK industry but not directly)
* 4 stars = strong (directly about ZOPK investments/companies)
* 5 stars = perfect (main topic is ZOPK, Kongsberg, offshore Baltic)
- Display star ratings in admin dashboard with color-coded badges
- Score >= 3 marks news as relevant, < 3 as not relevant
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ai_relevant, ai_evaluation_reason, ai_evaluated_at columns to zopk_news
- Add evaluate_news_relevance() and evaluate_pending_news() functions
- Add /admin/zopk/news/evaluate-ai endpoint
- Add AI filter tiles (Pasuje wg AI, Nie pasuje wg AI)
- Add "Oceń przez AI" button with progress feedback
- Show AI evaluation badge on news items
- Add new sources: Norda FM, Twoja Telewizja Morska, Nadmorski24.pl, Facebook (Samsonowicz)
AI evaluates news against ZOPK topics: offshore wind, nuclear plant,
Kongsberg investment, data centers, hydrogen labs, key people.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ZOPKNewsService with multiple RSS sources (12 feeds)
- Implement cross-verification logic (3+ sources = auto_approved)
- Add title hash normalization for fuzzy deduplication
- Include government sources: MON, Ministerstwo Rozwoju
- Include Google News searches for key topics and people
- Add confidence scoring (1-5 based on source count)
- Update SQL migration with cross-verification columns
Sources: Brave API, trojmiasto.pl, Dziennik Bałtycki, Google News,
gov.pl/obrona-narodowa, gov.pl/rozwoj-technologia
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add database models for ZOPK projects, stakeholders, news, resources
- Add migration with initial data (5 projects, 7 stakeholders)
- Implement admin dashboard with news moderation workflow
- Add Brave Search API integration for automated news discovery
- Create public knowledge base pages (index, project detail, news list)
- Add navigation links in main menu and admin bar
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add category selection (feature_request, bug, question, announcement)
- Add status tracking (new, in_progress, resolved, rejected) with admin controls
- Add file attachments support (JPG, PNG, GIF up to 5MB)
- Multi-file upload (up to 10 files per reply) with drag & drop and paste
- New FileUploadService with EXIF stripping for privacy
- Admin panel with status statistics and change modal
- Grid display for multiple attachments
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Executed it_audit_migration.sql against DEV PostgreSQL (localhost:5433)
- Created it_audits and it_collaboration_matches tables
- Created 12 indexes for performance optimization
- Created 4 views: v_company_it_overview, v_it_audit_history,
v_it_collaboration_overview, v_it_technology_stats
- Added missing document_management column to match SQLAlchemy model
- Applied grants for nordabiz_app user
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add database migration script to add google_opening_hours (JSONB) and
google_photos_count (INTEGER) columns to company_website_analysis table.
These columns are needed for storing GBP data from Google Places API:
- google_opening_hours: stores weekday_text, open_now, and periods data
- google_photos_count: stores count of photos from Google Business profile
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create gbp_audits table with all required fields:
- completeness_score (0-100)
- fields_status and recommendations (JSONB)
- Individual field flags (has_name, has_phone, etc.)
- Photo and review metrics
- Google Place integration fields
- Audit metadata (source, version, errors)
- Add indexes for company_id, audit_date, and score
- Add update trigger for updated_at timestamp
- Create views: v_company_gbp_overview, v_gbp_audit_history
- Include GRANT statements for nordabiz_app user
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>