REFACTOR ALL APIs

This commit is contained in:
Urtzi Alfaro
2025-10-06 15:27:01 +02:00
parent dc8221bd2f
commit 38fb98bc27
166 changed files with 18454 additions and 13605 deletions

View File

@@ -1,7 +1,16 @@
// ================================================================
// frontend/src/api/services/pos.ts
// ================================================================
/**
* POS Service
* Handles all POS configuration and management API calls
* Based on services/pos/app/api/pos_config.py backend implementation
* POS Service - Complete backend alignment
*
* Backend API structure (3-tier architecture):
* - ATOMIC: configurations.py, transactions.py
* - OPERATIONS: pos_operations.py
* - ANALYTICS: analytics.py
*
* Last Updated: 2025-10-05
* Status: ✅ Complete - Zero drift with backend
*/
import { apiClient } from '../client';
@@ -30,9 +39,10 @@ import type {
export class POSService {
private readonly basePath = '/pos';
// ============================================================================
// POS CONFIGURATIONS
// ============================================================================
// ===================================================================
// ATOMIC: POS Configuration CRUD
// Backend: services/pos/app/api/configurations.py
// ===================================================================
/**
* Get POS configurations for a tenant
@@ -99,9 +109,10 @@ export class POSService {
return apiClient.post<TestPOSConnectionResponse>(url);
}
// ============================================================================
// SUPPORTED SYSTEMS
// ============================================================================
// ===================================================================
// OPERATIONS: Supported Systems
// Backend: services/pos/app/api/pos_operations.py
// ===================================================================
/**
* Get list of supported POS systems
@@ -111,9 +122,10 @@ export class POSService {
return apiClient.get<GetSupportedPOSSystemsResponse>(url);
}
// ============================================================================
// TRANSACTIONS (Future Implementation)
// ============================================================================
// ===================================================================
// ATOMIC: Transactions
// Backend: services/pos/app/api/transactions.py
// ===================================================================
/**
* Get POS transactions for a tenant (Updated with backend structure)
@@ -247,9 +259,10 @@ export class POSService {
return apiClient.get(url);
}
// ============================================================================
// SYNC OPERATIONS (Future Implementation)
// ============================================================================
// ===================================================================
// OPERATIONS: Sync Operations
// Backend: services/pos/app/api/pos_operations.py
// ===================================================================
/**
* Trigger manual sync for a POS configuration
@@ -360,9 +373,10 @@ export class POSService {
return apiClient.get(url);
}
// ============================================================================
// WEBHOOKS
// ============================================================================
// ===================================================================
// OPERATIONS: Webhook Management
// Backend: services/pos/app/api/pos_operations.py
// ===================================================================
/**
* Get webhook logs
@@ -443,9 +457,9 @@ export class POSService {
return apiClient.post(url, payload);
}
// ============================================================================
// UTILITY METHODS
// ============================================================================
// ===================================================================
// Frontend Utility Methods
// ===================================================================
/**
* Format price for display