fix: correct remaining route mismatches and Spanish status strings in prosappweb

- solicitudes: GET /services/professional/requests (not query params)
- my_services: GET /services/me with paginated response handling
- my_services_pro: GET /services/professional with paginated response handling
- professional: handle paginated GET /professionals response
- cita: PATCH /services/:id/status (not /services/:id); translate all Spanish
  status comparisons (pendiente/aprobado/iniciado/terminado) to backend English

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-18 12:16:00 -05:00
co-authored by Claude Sonnet 4.6
parent ce11aa813e
commit dc99169ef1
5 changed files with 26 additions and 16 deletions
+19 -10
View File
@@ -107,10 +107,19 @@ class _CitaScreenState extends State<CitaScreen> {
}
}
static const _toBackendStatus = {
'pendiente': 'pending',
'aprobado': 'accepted',
'denegado': 'cancelled',
'iniciado': 'active',
'terminado': 'completed',
};
Future<void> _updateStatus(String status) async {
try {
final backendStatus = _toBackendStatus[status] ?? status;
await ApiService.instance
.patch('/services/${widget.evento.id}', {'status': status});
.patch('/services/${widget.evento.id}/status', {'status': backendStatus});
} catch (e) {
print('Error updating service status: $e');
}
@@ -245,8 +254,8 @@ class _CitaScreenState extends State<CitaScreen> {
),
widget.evento.userId == widget.evento.professionalId
? const SizedBox()
: widget.evento.status == 'aprobado' ||
widget.evento.status == 'iniciado'
: widget.evento.status == 'accepted' ||
widget.evento.status == 'active'
? const Padding(
padding: EdgeInsets.symmetric(vertical: 20),
child: Text(
@@ -257,7 +266,7 @@ class _CitaScreenState extends State<CitaScreen> {
: const SizedBox(height: 10),
widget.evento.userId == widget.evento.professionalId
? const SizedBox()
: widget.evento.status == 'terminado'
: widget.evento.status == 'completed'
? pro == true
? widget.evento.professionalScored == true
? const SizedBox()
@@ -339,8 +348,8 @@ class _CitaScreenState extends State<CitaScreen> {
),
],
)
: widget.evento.status == 'aprobado' ||
widget.evento.status == 'iniciado'
: widget.evento.status == 'accepted' ||
widget.evento.status == 'active'
? Row(
children: [
const Expanded(child: SizedBox()),
@@ -370,7 +379,7 @@ class _CitaScreenState extends State<CitaScreen> {
const SizedBox(width: 20),
ElevatedButton(
onPressed: () async {
if (widget.evento.status != 'pendiente') {
if (widget.evento.status != 'pending') {
// Start or retrieve chat via API
try {
await ApiService.instance.post(
@@ -489,7 +498,7 @@ class _CitaScreenState extends State<CitaScreen> {
],
),
),
widget.evento.status == 'aprobado'
widget.evento.status == 'accepted'
? Padding(
padding: const EdgeInsets.only(bottom: 30),
child: Column(
@@ -559,7 +568,7 @@ class _CitaScreenState extends State<CitaScreen> {
),
)
: const SizedBox(),
widget.evento.status == 'pendiente'
widget.evento.status == 'pending'
? Padding(
padding: const EdgeInsets.only(bottom: 30),
child: Column(
@@ -618,7 +627,7 @@ class _CitaScreenState extends State<CitaScreen> {
),
)
: const SizedBox(),
widget.evento.status == 'iniciado' || ver == false
widget.evento.status == 'active' || ver == false
? Padding(
padding: const EdgeInsets.only(bottom: 30),
child: Column(