Refactor Slack notification logic and clean up response format in example route.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user