filter alarm
This commit is contained in:
@@ -62,4 +62,36 @@ class AlarmController extends Controller
|
||||
return jsonResponseWithErrorMessage($e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function filterAlarm(Request $request)
|
||||
{
|
||||
try {
|
||||
$alarmData = $request->only([
|
||||
// 'statusList',
|
||||
'severity',
|
||||
// 'type',
|
||||
// 'assigneeId',
|
||||
'pageSize',
|
||||
'page',
|
||||
// 'textSearch',
|
||||
// 'sortProperty',
|
||||
// 'sortOrder',
|
||||
'startTs',
|
||||
'endTs'
|
||||
]);
|
||||
|
||||
$apiResponse = $this->alarmService->filterAlarm($alarmData);
|
||||
|
||||
return jsonResponseWithSuccessMessage('Alarm data retrieved successfully', ['api_response' => $apiResponse]);
|
||||
} catch (Exception $e) {
|
||||
Log::error("Error: " . $e->getMessage());
|
||||
|
||||
$errorResponse = json_decode($e->getMessage(), true);
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
return jsonResponseWithErrorMessage($errorResponse['message'] ?? 'Something went wrong', 400, $errorResponse);
|
||||
}
|
||||
|
||||
return jsonResponseWithErrorMessage($e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user