Files
prosappweb/lib/src/models/user_model.dart
T
Lizandro GuarnizoandClaude Sonnet 4.6 b95e0630de feat: migrate prosapp_web_app from Firebase to NestJS API
- Replace Firebase Auth with JWT stored in SharedPreferences
- Replace Firestore with REST API calls via new ApiService
- Replace Firebase Storage with POST /storage/upload
- Remove firebase_auth, firebase_core, cloud_firestore,
  firebase_storage, firebase_messaging, google_sign_in deps
- Add api_service.dart as central HTTP client

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 13:19:28 -05:00

54 lines
1.4 KiB
Dart

class UserModel {
final String id;
final String name;
final String city;
final String? profession;
final int proState;
final String? picture;
final String? banner;
final int? tarifa;
final String? phoneNumber;
final String? email;
final String? gender;
final String? birthday;
UserModel({
required this.id,
required this.name,
required this.city,
this.profession,
this.proState = 0,
this.picture,
this.banner,
this.tarifa,
this.phoneNumber,
this.email,
this.gender,
this.birthday,
});
factory UserModel.fromApi(Map<String, dynamic> json) {
final professional = json['professionals'] as Map<String, dynamic>?;
return UserModel(
id: json['id'] ?? '',
name: json['name'] ?? 'Sin nombre',
city: json['city'] ?? '',
profession: professional?['profession'],
proState: json['pro_state'] ?? 0,
picture: json['picture'],
banner: professional?['banner_picture'],
tarifa: professional?['rate'] != null
? double.tryParse(professional!['rate'].toString())?.toInt()
: null,
phoneNumber: json['phone'],
email: json['email'],
gender: json['gender'],
birthday: json['birthday'],
);
}
@override
String toString() =>
'UserModel(id: $id, name: $name, city: $city, profession: $profession, proState: $proState)';
}