Add POI feature and imporve the overall backend implementation

This commit is contained in:
Urtzi Alfaro
2025-11-12 15:34:10 +01:00
parent e8096cd979
commit 5783c7ed05
173 changed files with 16862 additions and 9078 deletions

View File

@@ -17,7 +17,7 @@ The **Auth Service** is the security foundation of Bakery-IA, providing robust J
### User Management
- **User Profiles** - Complete user information management
- **User Onboarding** - Multi-step onboarding progress tracking
- **User Onboarding** - Multi-step onboarding progress tracking with 15 steps including POI detection
- **Profile Updates** - Self-service profile editing
- **Account Deletion** - GDPR-compliant account removal
- **Login Attempts Tracking** - Brute force protection
@@ -100,9 +100,11 @@ The **Auth Service** is the security foundation of Bakery-IA, providing robust J
- `DELETE /api/v1/auth/account` - Delete account (GDPR)
### User Onboarding
- `GET /api/v1/auth/onboarding/progress` - Get onboarding status
- `PUT /api/v1/auth/onboarding/step/{step}` - Complete onboarding step
- `POST /api/v1/auth/onboarding/complete` - Mark onboarding complete
- `GET /api/v1/auth/me/onboarding/progress` - Get onboarding status
- `PUT /api/v1/auth/me/onboarding/step` - Update/complete onboarding step
- `POST /api/v1/auth/me/onboarding/complete` - Mark onboarding complete
- `GET /api/v1/auth/me/onboarding/next-step` - Get next incomplete step
- `GET /api/v1/auth/me/onboarding/can-access/{step_name}` - Check if step is accessible
### GDPR Compliance
- `GET /api/v1/auth/gdpr/consents` - Get user consents
@@ -185,16 +187,36 @@ CREATE TABLE user_onboarding_progress (
CREATE TABLE user_onboarding_summary (
id UUID PRIMARY KEY,
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
total_steps INTEGER NOT NULL,
completed_steps INTEGER DEFAULT 0,
is_complete BOOLEAN DEFAULT FALSE,
completed_at TIMESTAMP,
current_step VARCHAR(50) NOT NULL DEFAULT 'user_registered',
next_step VARCHAR(50),
completion_percentage VARCHAR(50) DEFAULT '0.0',
fully_completed BOOLEAN DEFAULT FALSE,
steps_completed_count VARCHAR(50) DEFAULT '0', -- Format: "3/15"
last_activity_at TIMESTAMP DEFAULT NOW(),
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW(),
UNIQUE(user_id)
);
```
**Onboarding Steps (15 total):**
1. `user_registered` - User account created (auto-completed)
2. `bakery-type-selection` - Choose bakery type
3. `setup` - Basic bakery setup and tenant creation
4. `poi-detection` - **POI Detection (Location Context)** - Automatic detection of nearby Points of Interest
5. `upload-sales-data` - File upload, validation, AI classification
6. `inventory-review` - Review AI-detected products
7. `initial-stock-entry` - Capture initial stock levels
8. `product-categorization` - Advanced categorization (optional)
9. `suppliers-setup` - Suppliers configuration
10. `recipes-setup` - Production recipes (optional)
11. `production-processes` - Finishing processes (optional)
12. `quality-setup` - Quality standards (optional)
13. `team-setup` - Team members (optional)
14. `ml-training` - AI model training (requires POI detection)
15. `setup-review` - Review all configuration
16. `completion` - Onboarding completed
**login_attempts**
```sql
CREATE TABLE login_attempts (