Commit Graph

410 Commits

Author SHA1 Message Date
Urtzi Alfaro
3a7d57ef90 Add subcription feature 9 2026-01-16 20:25:45 +01:00
Urtzi Alfaro
fa7b62bd6c Add subcription feature 8 2026-01-16 16:09:32 +01:00
Urtzi Alfaro
4bafceed0d Add subcription feature 6 2026-01-16 15:19:34 +01:00
Urtzi Alfaro
6b43116efd Add subcription feature 5 2026-01-16 09:55:54 +01:00
Urtzi Alfaro
483a9f64cd Add subcription feature 4 2026-01-15 22:06:36 +01:00
Urtzi Alfaro
b674708a4c Add subcription feature 3 2026-01-15 20:45:49 +01:00
Urtzi Alfaro
a4c3b7da3f Add subcription feature 2 2026-01-14 13:15:48 +01:00
Urtzi Alfaro
6ddf608d37 Add subcription feature 2026-01-13 22:22:38 +01:00
Urtzi Alfaro
b931a5c45e Add improvements 2 2026-01-12 22:15:11 +01:00
Urtzi Alfaro
230bbe6a19 Add improvements 2026-01-12 14:24:14 +01:00
Urtzi Alfaro
6037faaf8c Fix user delete 2026-01-11 21:51:13 +01:00
Urtzi Alfaro
55bb1c6451 Refactor subcription layer 2026-01-11 21:40:04 +01:00
Urtzi Alfaro
54163843ec Fix some issues 2026-01-11 19:38:54 +01:00
Urtzi Alfaro
ce4f3aff8c Add equipment fail feature 2026-01-11 17:03:46 +01:00
Urtzi Alfaro
5533198cab Imporve UI and token 2026-01-11 07:50:34 +01:00
Urtzi Alfaro
bf1db7cb9e New token arch 2026-01-10 21:45:37 +01:00
Urtzi Alfaro
cc53037552 Fix auth service login failure by correcting logging calls 2026-01-10 21:43:31 +01:00
Urtzi Alfaro
c05538cafb Imporve monitoring 5 2026-01-09 23:14:12 +01:00
Urtzi Alfaro
22dab143ba Imporve monitoring 4 2026-01-09 14:48:44 +01:00
Urtzi Alfaro
8ca5d9c100 Imporve monitoring 2 2026-01-09 07:26:11 +01:00
Urtzi Alfaro
4af860c010 Imporve monitoring 2026-01-09 06:57:18 +01:00
Urtzi Alfaro
e8fda39e50 Improve metrics 2026-01-08 20:48:24 +01:00
Urtzi Alfaro
29d19087f1 Update monitoring packages to latest versions
- Updated all OpenTelemetry packages to latest versions:
  - opentelemetry-api: 1.27.0 → 1.39.1
  - opentelemetry-sdk: 1.27.0 → 1.39.1
  - opentelemetry-exporter-otlp-proto-grpc: 1.27.0 → 1.39.1
  - opentelemetry-exporter-otlp-proto-http: 1.27.0 → 1.39.1
  - opentelemetry-instrumentation-fastapi: 0.48b0 → 0.60b1
  - opentelemetry-instrumentation-httpx: 0.48b0 → 0.60b1
  - opentelemetry-instrumentation-redis: 0.48b0 → 0.60b1
  - opentelemetry-instrumentation-sqlalchemy: 0.48b0 → 0.60b1

- Removed prometheus-client==0.23.1 from all services
- Unified all services to use the same monitoring package versions

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-01-08 19:25:52 +01:00
Urtzi Alfaro
dfb7e4b237 Add signoz 2026-01-08 12:58:00 +01:00
Urtzi Alfaro
6b14f330e6 Fix demo supplier 2026-01-04 21:58:15 +01:00
Urtzi Alfaro
429e724a2c Improve onboarding flow 2026-01-04 21:37:44 +01:00
Urtzi Alfaro
0a1951051f fix demo session 2 2026-01-02 12:18:46 +01:00
Urtzi Alfaro
cf0176673c fix demo session 1 2026-01-02 11:12:50 +01:00
Urtzi Alfaro
507031deaf fix issues 2026-01-01 21:09:25 +01:00
Urtzi Alfaro
9aee368580 fix demo issues 2026-01-01 19:56:07 +01:00
Urtzi Alfaro
93c9475239 fix UI 1 2026-01-01 19:01:33 +01:00
Urtzi Alfaro
c07df124fb Improve UI 2025-12-30 14:40:20 +01:00
Urtzi Alfaro
02f0c91a15 Fix UI issues 2025-12-29 19:33:35 +01:00
Urtzi Alfaro
adef7971a0 Fix suppliers 2025-12-29 14:48:24 +01:00
Urtzi Alfaro
2e7e1f5557 Add frontend alerts imporvements 2025-12-29 08:11:29 +01:00
Urtzi Alfaro
54662dde79 Add frontend loading imporvements 2025-12-27 21:30:42 +01:00
Urtzi Alfaro
532b057f59 fix demo load 2025-12-25 20:20:16 +01:00
Urtzi Alfaro
b95b86ee2c Add traslations 2025-12-25 18:35:37 +01:00
Urtzi Alfaro
bfa5ff0637 Imporve onboarding UI 2025-12-19 13:10:24 +01:00
Urtzi Alfaro
71ee2976a2 Update readmes and imporve UI 2025-12-19 09:28:36 +01:00
Urtzi Alfaro
acb3a40844 Add traslations 2025-12-18 20:12:32 +01:00
Urtzi Alfaro
f10a2b92ea Improve onboarding 2025-12-18 13:26:32 +01:00
Urtzi Alfaro
f8591639a7 Imporve enterprise 2025-12-17 20:50:22 +01:00
Urtzi Alfaro
b715a14848 Fix Demo enterprise list 2025-12-17 16:28:58 +01:00
Urtzi Alfaro
8e68c909de Add enhanced logging for demo session tenant queries
Added detailed logging to help diagnose empty tenant list issues:
- Log demo_session_id, demo_account_type, and tenant_count
- Log actual tenant IDs returned
- Log when demo user detected but no session ID

This will help identify:
1. If demo_session_id is being passed correctly from gateway
2. If tenants exist in DB for the session
3. Timing issues (API called before session fully initialized)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 16:13:45 +01:00
Urtzi Alfaro
838d25394b CRITICAL: Add demo session isolation to prevent cross-session data leakage
This commit fixes a critical security issue where multiple concurrent demo
sessions would see each other's data due to sharing the same demo user IDs.

## The Problem:

When two enterprise demo sessions run simultaneously:
- Session A: user_id=Director, tenants=[parent_A, child_A1, child_A2]
- Session B: user_id=Director, tenants=[parent_B, child_B1, child_B2]

The endpoint /api/v1/tenants/user/{user_id}/tenants was querying by user_id
only, so Session A would see BOTH its own tenants AND Session B's tenants!

## The Solution:

Added demo_session_id filtering to get_user_tenants endpoint:
- For demo sessions, use get_virtual_tenants_for_session(demo_session_id)
- This filters tenants by the demo_session_id field (set during cloning)
- Each session now sees ONLY its own virtual tenants

## Implementation:

services/tenant/app/api/tenants.py (lines 180-194):
- Check if user is_demo
- Extract demo_session_id from current_user context (set by gateway)
- Call get_virtual_tenants_for_session() instead of get_user_tenants()
- This method filters by: demo_session_id + is_active + account_type

## Database Schema:

The tenants table has a demo_session_id column (indexed) that links
each virtual tenant to its specific demo session. This is set during
tenant cloning in internal_demo.py.

## Impact:

 Complete isolation between concurrent demo sessions
 Users only see their own session's data
 No performance impact (demo_session_id is indexed)
 Backward compatible (non-demo users unchanged)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 16:03:23 +01:00
Urtzi Alfaro
6a0e02ff95 Fix Demo enterprise: map 'demo-user' to actual owner ID
When the frontend requests tenants with user_id='demo-user' in demo mode,
the backend now correctly maps this to the actual demo owner ID from the
current_user context (set by the gateway middleware).

This fixes the issue where the tenant list API was returning empty results
even though it returned 200 OK, because it was looking for a user with
id='demo-user' which doesn't exist in the database.

The actual user IDs are:
- Professional: c1a2b3c4-d5e6-47a8-b9c0-d1e2f3a4b5c6 (María García López)
- Enterprise: d2e3f4a5-b6c7-48d9-e0f1-a2b3c4d5e6f7 (Director)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 15:58:28 +01:00
Urtzi Alfaro
d98558ed97 Refactor demo session architecture: consolidate metadata into fixture files
This commit refactors the demo session architecture to consolidate all demo
configuration data into the fixture files, removing redundant metadata files.

## Changes Made:

### 1. Data Consolidation
- **Removed**: `shared/demo/metadata/demo_users.json`
- **Removed**: `shared/demo/metadata/tenant_configs.json`
- **Updated**: Merged all user data into `02-auth.json` files
- **Updated**: Merged all tenant config data into `01-tenant.json` files

### 2. Enterprise Parent Tenant Updates
- Updated owner name to "Director" (matching auth fixtures)
- Added description field matching tenant_configs.json
- Added `base_tenant_id` to all child tenant entries
- Now includes all 5 child locations (Madrid, Barcelona, Valencia, Seville, Bilbao)

### 3. Professional Tenant Updates
- Added description field from tenant_configs.json
- Ensured consistency with auth fixtures

### 4. Code Updates
- **services/tenant/app/api/internal_demo.py**:
  - Fixed child tenant staff members to use enterprise parent users
  - Changed from professional staff IDs to enterprise staff IDs (Laura López, José Martínez, Francisco Moreno)

- **services/demo_session/app/core/config.py**:
  - Updated DEMO_ACCOUNTS configuration with all 5 child outlets
  - Updated enterprise tenant name and email to match fixtures
  - Added descriptions for all child locations

- **gateway/app/middleware/demo_middleware.py**:
  - Updated comments to reference fixture files as source of truth
  - Clarified that owner IDs come from 01-tenant.json files

- **frontend/src/stores/useTenantInitializer.ts**:
  - Updated tenant names and descriptions to match fixture files
  - Added comments linking to source fixture files

## Benefits:

1. **Single Source of Truth**: All demo data now lives in fixture files
2. **Consistency**: No more sync issues between metadata and fixtures
3. **Maintainability**: Easier to update demo data (one place per tenant type)
4. **Clarity**: Clear separation between template data (fixtures) and runtime config

## Enterprise Demo Fix:

The enterprise owner is now correctly added as a member of all child tenants, fixing
the issue where the tenant switcher didn't show parent/child tenants and the
establishments page didn't load tenants for the demo enterprise user.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-17 15:48:14 +01:00
Urtzi Alfaro
8bfe4f2dd7 Fix Demo enterprise 2025-12-17 13:03:52 +01:00
Urtzi Alfaro
0bbfa010bf Fix AI insights feature issues 2025-12-16 13:32:33 +01:00