mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-28 00:43:57 +00:00
schedule-update-delete-backend
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 17/06/2019
|
||||
* Time: 10:18 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Orders;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\ScheduleObject;
|
||||
use App\Classes\Modules\Orders\Services\UpdateOrderSchedule;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateOrderScheduleLogic
|
||||
{
|
||||
/** @var UpdateOrderSchedule */
|
||||
private $updateOrderSchedule;
|
||||
|
||||
/**
|
||||
* UpdateOrderScheduleLogic constructor.
|
||||
* @param UpdateOrderSchedule $updateOrderSchedule
|
||||
*/
|
||||
public function __construct(UpdateOrderSchedule $updateOrderSchedule)
|
||||
{
|
||||
$this->updateOrderSchedule = $updateOrderSchedule;
|
||||
}
|
||||
|
||||
public function execute(String $scheduleId, Request $request){
|
||||
|
||||
try{
|
||||
$scheduleObject = new ScheduleObject($request->input('ETA'), $request->input('ETD'),
|
||||
$request->input('type'), $request->input('issue_remark'));
|
||||
|
||||
return $this->updateOrderSchedule->execute($scheduleId,$scheduleObject);
|
||||
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to update schedule because {$exception->getMessage()}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user