feat: add notifications system with bell badge, polling, Directus flows, and webhook integration

This commit is contained in:
2026-02-07 15:13:17 +01:00
parent f6ba0085f9
commit 10dd923739
8 changed files with 48 additions and 12 deletions

View File

@@ -109,10 +109,23 @@ if ($directusStatus >= 400) {
exit;
}
// Create notification for listing owner
$listingData = json_decode($directusResponse, true);
// Fetch listing to get owner
$getUrl = DIRECTUS_URL . '/items/listings/' . urlencode($listingId) . '?fields=user_created';
$gch = curl_init($getUrl);
curl_setopt_array($gch, [
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . DIRECTUS_TOKEN,
],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 5,
]);
$getResponse = curl_exec($gch);
curl_close($gch);
$listingData = json_decode($getResponse, true);
$userCreated = $listingData['data']['user_created'] ?? null;
// Create notification for listing owner
if ($userCreated) {
$notifPayload = json_encode([
'user_hash' => $userCreated,