fix: align Flutter endpoints and model parsing with actual NestJS backend
- Auth: phone login → POST /auth/phone (direct, no OTP); link phone → POST /auth/verify-phone; add email → POST /auth/link-email
- Services: replace query-param paths with dedicated role endpoints (/services/me, /services/professional/requests, /services/professional, etc.)
- Services: PATCH /services/:id → PATCH /services/:id/status
- Calendar: → GET /services/professional/calendar
- Professionals: /users/professionals → /professionals (handles {data:[...]} response)
- Professional info: /professional-info/:id → /professionals/:id; PATCH → /professionals/me
- Comments: /comments?... → /comments/user/:id and /comments/professional/:id
- Chat: /chats → /chat; start chat → POST /chat/start/:professionalId; poll GET /chat/:chatId/messages; send → POST /chat/:chatId/message
- Cities: /cities → GET /locations/countries (parse nested countries→regions→cities)
- Profesional.fromDocument: null-safe fields; convert schedules array→Schedules, specializations array→name/picture lists, payment_methods object/array
- Usuario.fromDocument: null-safe professional_state and id
- UsuarioProfesional.fromDocument: handle backend format (users nested, professional at top level)
- ScheduleEntity.parseTime: handle ISO8601 time strings from backend
- MessageEntity.fromDocument: accept sender_id (backend) or owner_id (legacy)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
60216fd0e3
commit
0ecca498ad
@@ -20,7 +20,7 @@ class ServicesProvider extends ChangeNotifier {
|
||||
|
||||
Future<void> changeServiceStatus(String serviceId, ServiceStatus newStatus) async {
|
||||
try {
|
||||
await _api.patch('/services/$serviceId', {'status': enumToIntService(newStatus)});
|
||||
await _api.patch('/services/$serviceId/status', {'status': enumToIntService(newStatus)});
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
print('Error al actualizar el estado: $e');
|
||||
@@ -29,7 +29,7 @@ class ServicesProvider extends ChangeNotifier {
|
||||
|
||||
Future<void> changeUserScored(String serviceId) async {
|
||||
try {
|
||||
await _api.patch('/services/$serviceId', {'user_scored': true});
|
||||
await _api.patch('/services/$serviceId/status', {'user_scored': true});
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
print('Error al actualizar user_scored: $e');
|
||||
@@ -38,7 +38,7 @@ class ServicesProvider extends ChangeNotifier {
|
||||
|
||||
Future<void> changeProfessionalScored(String serviceId) async {
|
||||
try {
|
||||
await _api.patch('/services/$serviceId', {'professional_scored': true});
|
||||
await _api.patch('/services/$serviceId/status', {'professional_scored': true});
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
print('Error al actualizar professional_scored: $e');
|
||||
@@ -84,15 +84,15 @@ class ServicesProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
getServicesForUser(String userId) async => _loadServices('/services?user_id=$userId&status=0,1,3', forUser: true);
|
||||
getServicesForUser(String userId) async => _loadServices('/services/me', forUser: true);
|
||||
|
||||
getServicesRequestsForProfessional(String userId) async => _loadServices('/services?professional_id=$userId&status=0', forUser: false);
|
||||
getServicesRequestsForProfessional(String userId) async => _loadServices('/services/professional/requests', forUser: false);
|
||||
|
||||
getServicesForProfessional(String userId) async => _loadServices('/services?professional_id=$userId&status=1,3', forUser: false);
|
||||
getServicesForProfessional(String userId) async => _loadServices('/services/professional', forUser: false);
|
||||
|
||||
getServicesHistoryForUser(String userId) async => _loadServices('/services?user_id=$userId&status=2,4,5', forUser: true);
|
||||
getServicesHistoryForUser(String userId) async => _loadServices('/services/me/history', forUser: true);
|
||||
|
||||
getServicesHistoryForProfessional(String userId) async => _loadServices('/services?professional_id=$userId&status=2,4,5', forUser: false);
|
||||
getServicesHistoryForProfessional(String userId) async => _loadServices('/services/professional/history', forUser: false);
|
||||
|
||||
Future<void> _loadServices(String path, {required bool forUser}) async {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user