فهرست منبع

fix: :bug: fix(correções backend) Foi ajustado o envio de notificação por push quando e cancelado a diaria

Foi ajustado o envio de notificação por push quando e cancelado a diaria

fase:dev | origin:escopo
kayo henrique 4 روز پیش
والد
کامیت
3cfcfacd28
1فایلهای تغییر یافته به همراه6 افزوده شده و 5 حذف شده
  1. 6 5
      app/Services/ScheduleService.php

+ 6 - 5
app/Services/ScheduleService.php

@@ -165,7 +165,7 @@ class ScheduleService
     }
 
     //
-
+    //
     public function updateStatus($id, string $status, bool $fromPackage = false)
     {
         try {
@@ -251,7 +251,7 @@ class ScheduleService
                     }
 
                     break;
-
+                //tem que chamar o status cancel por causa da regra de push
                 case 'cancelled':
                     $notificationService = app(NotificationService::class);
 
@@ -265,7 +265,7 @@ class ScheduleService
                                 'type'        => NotificationTypeEnum::SCHEDULE_PROVIDER_CLIENT_CANCELLED->value,
                                 'user_id'     => $schedule->provider->user_id,
                             ]);
-                            $this->sendProviderCancelledPush($schedule);
+                           $this->sendClientCancelledPush($schedule);
 
                             break;
 
@@ -278,7 +278,8 @@ class ScheduleService
                                 'type'        => NotificationTypeEnum::SCHEDULE_CLIENT_PROVIDER_CANCELLED->value,
                                 'user_id'     => $schedule->client->user_id,
                             ]);
-                            $this->sendClientCancelledPush($schedule);
+                            
+                             $this->sendProviderCancelledPush($schedule);
 
                             break;
 
@@ -564,12 +565,12 @@ class ScheduleService
             $cancelled_by = Auth::user()->type;
 
             $schedule->update([
-                'status'       => 'cancelled',
                 'cancel_text'  => $cancelText,
                 'cancelled_by' => $cancelled_by,
             ]);
 
             $this->cascadeCancelServicePackages($schedule, $cancelText, $cancelled_by);
+            $this->updateStatus($id, 'cancelled');
 
             $actor = Auth::user()?->type;