Refactor Slack notification logic and clean up response format in example route.

This commit is contained in:
Jeppe Bundgaard
2026-01-21 14:51:20 +01:00
parent d9b9958242
commit a04acd84b2
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -473,14 +473,14 @@ class departments_o extends db
// Check if there's a custom webhook for the department
$slack = new slack();
if (empty($this->slack_webhook->value()) || true) {
if (empty($this->slack_webhook->value())) {
// If no webhook is set for the department, use the default Slack notification
$slack->send_message($tmp, "Weekly results for {$department->name->value()}");
return;
}
// Send message to the department's Slack webhook
//$slack->send_department_booking_notification($this->id, $tmp);
$slack->send_department_booking_notification($this->id, $tmp);
}
/**
+2 -2
View File
@@ -15,7 +15,7 @@ class exampleRoute
{
$this->get('/example', function () {
global $response;
// This is very quite hack-y but it works for now
// This is very hack-y, but it works for now
// Check if it's monday
if ((int)date('N') === 1) {
// Check if the time is between 06:00 and 17:00
@@ -43,7 +43,7 @@ class exampleRoute
}
}
}
$response->success(['message' => 'Hello World!', 'time' => date('Y-m-d H:i:s'), 'date' => (int)date('N')]);
$response->success(['message' => 'Hello World!']);
});
$this->get('/debug', function () {