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,5 +1,15 @@
// ================================================================
// frontend/src/api/services/auth.ts
// ================================================================
/**
* Auth Service - Mirror backend auth endpoints
* Auth Service - Complete backend alignment
*
* Backend API structure (3-tier architecture):
* - ATOMIC: users.py
* - OPERATIONS: auth_operations.py, onboarding_progress.py
*
* Last Updated: 2025-10-05
* Status: ✅ Complete - Zero drift with backend
*/
import { apiClient } from '../client';
import {
@@ -18,6 +28,11 @@ import {
export class AuthService {
private readonly baseUrl = '/auth';
// ===================================================================
// OPERATIONS: Authentication
// Backend: services/auth/app/api/auth_operations.py
// ===================================================================
async register(userData: UserRegistration): Promise<TokenResponse> {
return apiClient.post<TokenResponse>(`${this.baseUrl}/register`, userData);
}
@@ -61,6 +76,11 @@ export class AuthService {
return apiClient.post<{ message: string }>(`${this.baseUrl}/reset-password`, resetData);
}
// ===================================================================
// ATOMIC: User Profile
// Backend: services/auth/app/api/users.py
// ===================================================================
async getProfile(): Promise<UserResponse> {
return apiClient.get<UserResponse>('/users/me');
}
@@ -69,6 +89,11 @@ export class AuthService {
return apiClient.put<UserResponse>('/users/me', updateData);
}
// ===================================================================
// OPERATIONS: Email Verification
// Backend: services/auth/app/api/auth_operations.py
// ===================================================================
async verifyEmail(
userId: string,
verificationToken: string
@@ -79,6 +104,10 @@ export class AuthService {
});
}
// ===================================================================
// Health Check
// ===================================================================
async healthCheck(): Promise<AuthHealthResponse> {
return apiClient.get<AuthHealthResponse>(`${this.baseUrl}/health`);
}