feat: API de reportes, fix distancia espacial y protección OneSignal

- GET/POST /api/contracts/reports y /api/postulations/reports
- GET/POST /api/contracts/reports/{id}/comments con verificación de autoría
- Fix distancia withinDistanceTo: 0.5 grados → 5000 metros (SRID 4326)
- Fix FK Report::finishedcontracts() → contract_id
- Wrap todas las llamadas OneSignal en try/catch para evitar crashes
- Chat UI de comentarios: burbujas por rol, botón veredicto fijo, estilos
- Botón veredicto movido de reports/index a reports/comments
- Ruta POST veredict y restructura reports/{id}/comments en web

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 21:04:14 -06:00
parent 185da1edbb
commit 38da1b56ce
12 changed files with 521 additions and 359 deletions

View File

@@ -17,15 +17,17 @@ class PushNotificationService
*/
public function sendToUser(int $userId, string $message, string $heading = 'JobHero', array $data = [])
{
return OneSignal::sendNotificationToExternalUser(
$message,
(string) $userId,
null,
$data ?: null,
null,
null,
$heading
);
try {
return OneSignal::sendNotificationToExternalUser(
$message,
(string) $userId,
null,
$data ?: null,
null,
null,
$heading
);
} catch (\Exception $e) {}
}
/**
@@ -58,15 +60,17 @@ class PushNotificationService
*/
public function sendScheduledToUser(int $userId, string $message, string $sendAt, string $heading = 'JobHero', array $data = [])
{
return OneSignal::sendNotificationToExternalUser(
$message,
(string) $userId,
null,
$data ?: null,
null,
$sendAt,
$heading
);
try {
return OneSignal::sendNotificationToExternalUser(
$message,
(string) $userId,
null,
$data ?: null,
null,
$sendAt,
$heading
);
} catch (\Exception $e) {}
}
/**
@@ -80,7 +84,7 @@ class PushNotificationService
*/
public function sendToRole(int $roleId, string $message, string $heading = 'JobHero', array $data = [])
{
return OneSignal::sendNotificationUsingTags(
try { return OneSignal::sendNotificationUsingTags(
$message,
[
['field' => 'tag', 'key' => 'iChamba_Role', 'relation' => '=', 'value' => (string) $roleId]
@@ -107,7 +111,7 @@ class PushNotificationService
null,
null,
$data
);
); } catch (\Exception $e) {}
}
/**