ll123Scurity:6 \Fix HMAC handshake, generate API keys in Google Login, and relax JWT issuer
This commit is contained in:
@@ -55,6 +55,25 @@ class NotificationController extends Controller
|
||||
|
||||
return response()->json(['status' => 'success']);
|
||||
}
|
||||
|
||||
/** POST /v2/notifications/update (For V1 Compatibility) */
|
||||
public function updateNotification(Request $request): JsonResponse
|
||||
{
|
||||
$id = $request->input('id');
|
||||
if (!$id) {
|
||||
return response()->json(['status' => 'failure', 'message' => 'Missing notification ID']);
|
||||
}
|
||||
|
||||
$isShown = $request->input('isShown', 'true');
|
||||
$userType = $request->attributes->get('_jwt_user_type');
|
||||
$table = $userType === 'driver' ? 'notificationCaptain' : 'notifications';
|
||||
|
||||
DB::connection('primary')->table($table)
|
||||
->where('id', $id)
|
||||
->update(['isShown' => $isShown]);
|
||||
|
||||
return response()->json(['status' => 'success']);
|
||||
}
|
||||
/** POST /v2/notifications/token */
|
||||
public function updateToken(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
@@ -148,6 +148,7 @@ Route::prefix('v2')->middleware(['hmac.auth', 'jwt.auth'])->group(function () {
|
||||
|
||||
// ── Notifications ──
|
||||
Route::get('/notifications', [NotificationController::class, 'index']);
|
||||
Route::post('/notifications/update', [NotificationController::class, 'updateNotification']);
|
||||
Route::get('/notifications/token', [NotificationController::class, 'getToken']);
|
||||
Route::put('/notifications/{id}/read', [NotificationController::class, 'markRead']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user