filter alarm

This commit is contained in:
sayliraut
2025-03-26 19:53:56 +05:30
parent 2103fc6368
commit a55e24e28a
3 changed files with 69 additions and 0 deletions

View File

@@ -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);
}
}
}