Code sync from Shipping Portal, independent deployment of Vue Polling, Performance Improvement and tweaking for better user experience

This commit is contained in:
Dillon Ngo
2023-12-30 18:35:17 +08:00
parent 6da337b9dc
commit bf5ea2b2f2
26 changed files with 809 additions and 178 deletions
@@ -5,10 +5,11 @@ namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Jobs\ListTransactionsJob;
use App\Classes\Modules\Jobs\Services\CreatesJobResult;
use App\Classes\Modules\Jobs\DataTransferObjects\ListGenericJobObject;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class ListTransactionsJobLogic extends AbstractControllerLogic
{
@@ -22,6 +23,19 @@ class ListTransactionsJobLogic extends AbstractControllerLogic
];
}
/** @var CreatesJobResult */
private $createsJobResult;
/**
* ListTransactionsJobLogic constructor.
* @param CreatesJobResult $createsJobResult
*/
public function __construct(CreatesJobResult $createsJobResult)
{
$this->createsJobResult = $createsJobResult;
}
/**
* @param Request $request
* @return JsonResponse
@@ -30,10 +44,21 @@ class ListTransactionsJobLogic extends AbstractControllerLogic
{
$jobId = uniqid();
$user = Auth::user();
$userInfo = (object) [
'type' => $user->type,
];
$userInfoJson = json_encode($userInfo);
$requestSignature = md5($userInfoJson . $request->fullUrl());
$listGenericJobObject = new ListGenericJobObject(
$request->fullUrl(),
$request->all(),
$jobId
$requestSignature,
null,
$jobId,
$userInfo
);
ListTransactionsJob::dispatch($listGenericJobObject);
@@ -41,6 +66,8 @@ class ListTransactionsJobLogic extends AbstractControllerLogic
$result = [];
$result['job_id'] = $jobId;
$this->createsJobResult->execute($listGenericJobObject);
return $this->response(['data' => $result]);
}