fix tests
This commit is contained in:
@@ -59,7 +59,7 @@ class NotificationController extends BaseApiController
|
||||
}
|
||||
|
||||
$row = $this->showService->getForUser($guard, $notificationId);
|
||||
if (!$row) {
|
||||
if (! $row) {
|
||||
return response()->json(['ok' => false, 'message' => 'Notification not found.'], 404);
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ class NotificationController extends BaseApiController
|
||||
$result = $this->sendService->send($payload, $guard);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Notification send failed.', ['error' => $e->getMessage()]);
|
||||
|
||||
return response()->json(['ok' => false, 'message' => 'Failed to send notification.'], 500);
|
||||
}
|
||||
|
||||
@@ -114,7 +115,7 @@ class NotificationController extends BaseApiController
|
||||
public function destroy(int $notificationId): JsonResponse
|
||||
{
|
||||
$deleted = $this->managementService->delete($notificationId);
|
||||
if (!$deleted) {
|
||||
if (! $deleted) {
|
||||
return response()->json(['ok' => false, 'message' => 'Notification not found.'], 404);
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ class NotificationController extends BaseApiController
|
||||
public function restore(int $notificationId): JsonResponse
|
||||
{
|
||||
$restored = $this->managementService->restore($notificationId);
|
||||
if (!$restored) {
|
||||
if (! $restored) {
|
||||
return response()->json(['ok' => false, 'message' => 'Notification not found.'], 404);
|
||||
}
|
||||
|
||||
@@ -139,7 +140,7 @@ class NotificationController extends BaseApiController
|
||||
}
|
||||
|
||||
$ok = $this->readService->markRead($guard, $notificationId);
|
||||
if (!$ok) {
|
||||
if (! $ok) {
|
||||
return response()->json(['ok' => false, 'message' => 'Notification not found.'], 404);
|
||||
}
|
||||
|
||||
@@ -167,9 +168,6 @@ class NotificationController extends BaseApiController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|JsonResponse
|
||||
*/
|
||||
private function authenticatedUserIdOrUnauthorized(): int|JsonResponse
|
||||
{
|
||||
$userId = (int) (auth()->id() ?? 0);
|
||||
|
||||
Reference in New Issue
Block a user