feat: migrate Firebase → NestJS REST API backend
Replace all Firebase SDK (Auth, Firestore, Storage) with HTTP calls to backend.prosapp.co/api/v1: - New ApiService singleton (JWT token, GET/POST/PATCH/DELETE/upload) - auth_provider: Firebase Auth → /auth/login, /auth/register, /auth/phone/* - services_provider + calendar_services_provider → /services endpoints - professional_provider + professionals_provider → /professional-info, /users/professionals - profile_form_provider + professional_form_provider → /users/me, /storage/upload - cities/professions/settings providers → /cities, /professions, /settings - firebase_chat_repository → polling via /chats endpoints (3s interval) - firebase_score_repository → polling via /comments endpoints (10s interval) - professional_detail_provider → /users/:id + /professional-info/:id - dashboard_view: Firestore.add → POST /services - chat_view + rating_view: FirebaseAuth.uid → AuthProvider.user.id - Models: Timestamp → String for createdAt fields - google_fonts upgraded to ^8.1.0 (Dart 3.12 compat) - Remove firebase_core, firebase_auth, cloud_firestore, firebase_storage from pubspec Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
15175c1b91
commit
60216fd0e3
@@ -1,32 +1,24 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:prosapp_web_app/models/location_preferences.dart';
|
||||
import 'package:prosapp_web_app/models/payment_method_entity.dart';
|
||||
import 'package:prosapp_web_app/models/profesional.dart';
|
||||
import 'package:prosapp_web_app/models/schedules.dart';
|
||||
import 'package:prosapp_web_app/services/api_service.dart';
|
||||
|
||||
class ProfessionalProvider extends ChangeNotifier {
|
||||
Profesional? profesional;
|
||||
bool _isProModeActive = false;
|
||||
final _api = ApiService.instance;
|
||||
|
||||
final FirebaseAuth _firebaseAuth = FirebaseAuth.instance;
|
||||
|
||||
bool get isProModeActive {
|
||||
return _isProModeActive;
|
||||
}
|
||||
bool get isProModeActive => _isProModeActive;
|
||||
|
||||
Future<Profesional> getProfessional(String uid) async {
|
||||
try {
|
||||
final professional = await FirebaseFirestore.instance
|
||||
.collection('professional_info')
|
||||
.doc(uid)
|
||||
.get();
|
||||
|
||||
profesional = Profesional.fromDocument(professional.data()!);
|
||||
final data = await _api.get('/professional-info/$uid');
|
||||
profesional = Profesional.fromDocument(data as Map<String, dynamic>);
|
||||
} catch (e) {
|
||||
profesional = Profesional(
|
||||
id: _firebaseAuth.currentUser!.uid,
|
||||
id: uid,
|
||||
identification: '',
|
||||
address: '',
|
||||
aditionalAddress: '',
|
||||
@@ -45,12 +37,11 @@ class ProfessionalProvider extends ChangeNotifier {
|
||||
paymentMethods: PaymentMethodEntity.empty,
|
||||
);
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
return profesional!;
|
||||
}
|
||||
|
||||
logout() {
|
||||
void logout() {
|
||||
_isProModeActive = false;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user