fix: corregir flujo completo de servicio y geocodificación
- Service.fromJson: lat/lng con Decimal de Prisma llegaban como string y
el cast 'as num?' lanzaba TypeError silencioso → lista de servicios vacía.
Mismo patrón que average_score, fix: double.tryParse(?.toString())
- service_status: agregar enumToStringService que mapea el enum de Flutter
al string que espera el DTO del backend ('pending','accepted', etc.).
changeServiceStatus enviaba el índice entero → @IsEnum rechazaba → el
profesional no podía aceptar ni rechazar solicitudes
- maps_service: agregar MapsService.reverseGeocode que usa el Geocoder del
Maps JS SDK ya cargado, sin requerir la Geocoding API habilitada por separado
- dashboard_view: _reverseGeocode usa el JS Geocoder en vez del endpoint HTTP
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
8296b5a3ea
commit
735d8c2ba0
@@ -65,8 +65,9 @@ class Service {
|
||||
userScored: doc['user_scored'] as bool? ?? false,
|
||||
address: doc['address'] as String? ?? '',
|
||||
aditionalAddress: (doc['additional_address'] ?? doc['aditional_address']) as String? ?? '',
|
||||
latitude: (doc['latitude'] as num?)?.toDouble() ?? 0.0,
|
||||
longitude: (doc['longitude'] as num?)?.toDouble() ?? 0.0,
|
||||
// Prisma Decimal fields serialize as JSON strings — same pattern as average_score
|
||||
latitude: double.tryParse(doc['latitude']?.toString() ?? '') ?? 0.0,
|
||||
longitude: double.tryParse(doc['longitude']?.toString() ?? '') ?? 0.0,
|
||||
day: (doc['day']?.toString() ?? '').split('T').first,
|
||||
createdAt: doc['created_at']?.toString() ?? '',
|
||||
description: doc['description'] as String? ?? '',
|
||||
|
||||
@@ -10,10 +10,20 @@ enum ServiceStatus {
|
||||
selfBooked // 6
|
||||
}
|
||||
|
||||
int enumToIntService(ServiceStatus state) {
|
||||
return state.index;
|
||||
}
|
||||
// Maps Flutter enum → backend string (matches ServiceStatus enum in the backend DTO)
|
||||
const _serviceStatusStrings = {
|
||||
ServiceStatus.pending: 'pending',
|
||||
ServiceStatus.acepted: 'accepted',
|
||||
ServiceStatus.denied: 'denied',
|
||||
ServiceStatus.active: 'active',
|
||||
ServiceStatus.cancelled: 'cancelled',
|
||||
ServiceStatus.completed: 'completed',
|
||||
ServiceStatus.selfBooked:'self_booked',
|
||||
};
|
||||
|
||||
ServiceStatus intToEnumService(int value) {
|
||||
return ServiceStatus.values[value];
|
||||
}
|
||||
String enumToStringService(ServiceStatus state) =>
|
||||
_serviceStatusStrings[state] ?? 'pending';
|
||||
|
||||
int enumToIntService(ServiceStatus state) => state.index;
|
||||
|
||||
ServiceStatus intToEnumService(int value) => ServiceStatus.values[value];
|
||||
|
||||
Reference in New Issue
Block a user