mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
WIP - Order steps & remaining APIs
This commit is contained in:
+67
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\CreatesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Standards\Rules\CanCreateContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
use App\Http\Resources\PackingListResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateContainerPackingListLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created PackingList',
|
||||
'message' => 'You have successfully created a new PackingList'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanCreateContainerPackingList */
|
||||
private $canCreateContainerPackingList;
|
||||
|
||||
/** @var FetchesPackingList */
|
||||
private $fetchesPackingList;
|
||||
|
||||
/** @var CreatesPackingList */
|
||||
private $createsContainerPackingList;
|
||||
|
||||
public function __construct(CanCreateContainerPackingList $canCreateContainerPackingList, FetchesPackingList $fetchesPackingList, CreatesContainerPackingList $createsContainerPackingList)
|
||||
{
|
||||
$this->canCreateContainerPackingList = $canCreateContainerPackingList;
|
||||
$this->fetchesPackingList = $fetchesPackingList;
|
||||
$this->createsContainerPackingList = $createsContainerPackingList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$packingList = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]);
|
||||
|
||||
$object = new ContainerPackingListObject( $packingList->id , $request->input('container_reference'), $request->input('container_type'), $request->input('seal_reference'));
|
||||
|
||||
$this->canCreateContainerPackingList->passes($object);
|
||||
|
||||
$query = $this->createsContainerPackingList->execute($object);
|
||||
|
||||
return $this->resourceResponse(new PackingListResource($packingList));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\DeletesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\FetchesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Standards\Rules\CanDeleteContainerPackingList;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteContainerPackingListLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Deleted ContainerPackingList',
|
||||
'message' => 'You have successfully deleted a ContainerPackingList'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var CanDeleteContainerPackingList */
|
||||
private $canDeleteContainerPackingList;
|
||||
|
||||
/** @var DeletesContainerPackingList */
|
||||
private $deletesContainerPackingList;
|
||||
|
||||
/** @var FetchesContainerPackingList */
|
||||
private $fetchesContainerPackingList;
|
||||
|
||||
/**
|
||||
* DeleteContainerPackingListControllersLogic constructor.
|
||||
* @param CanDeleteContainerPackingList $canDeleteContainerPackingList
|
||||
* @param DeletesContainerPackingList $deletesContainerPackingList
|
||||
* @param FetchesContainerPackingList $fetchesContainerPackingList
|
||||
*/
|
||||
public function __construct(CanDeleteContainerPackingList $canDeleteContainerPackingList, DeletesContainerPackingList $deletesContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList)
|
||||
{
|
||||
$this->canDeleteContainerPackingList = $canDeleteContainerPackingList;
|
||||
$this->deletesContainerPackingList = $deletesContainerPackingList;
|
||||
$this->fetchesContainerPackingList = $fetchesContainerPackingList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->canDeleteContainerPackingList->passes();
|
||||
|
||||
$query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->deletesContainerPackingList->execute($query);
|
||||
|
||||
return $this->response([]);
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\FetchesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Standards\Rules\CanFetchContainerPackingList;
|
||||
use App\Http\Resources\ContainerPackingListResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchContainerPackingListLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved ContainerPackingList',
|
||||
'message' => 'You have successfully retrieved a ContainerPackingList'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanFetchContainerPackingList */
|
||||
private $canFetchContainerPackingList;
|
||||
|
||||
/** @var FetchesContainerPackingList */
|
||||
private $fetchesContainerPackingList;
|
||||
|
||||
/**
|
||||
* FetchContainerPackingListControllersLogic constructor.
|
||||
* @param CanFetchContainerPackingList $canFetchContainerPackingList
|
||||
* @param FetchesContainerPackingList $fetchesContainerPackingList
|
||||
*/
|
||||
public function __construct(CanFetchContainerPackingList $canFetchContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList)
|
||||
{
|
||||
$this->canFetchContainerPackingList = $canFetchContainerPackingList;
|
||||
$this->fetchesContainerPackingList = $fetchesContainerPackingList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->canFetchContainerPackingList->passes();
|
||||
|
||||
$query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
return $this->resourceResponse(new ContainerPackingListResource($query));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\FetchesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Standards\Rules\CanFetchContainerPackingList;
|
||||
use App\Http\Resources\ContainerPackingListResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchContainerContainerPackingList extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved ContainerPackingList',
|
||||
'message' => 'You have successfully retrieved a ContainerPackingList'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanFetchContainerPackingList */
|
||||
private $canFetchContainerPackingList;
|
||||
|
||||
/** @var FetchesContainerPackingList */
|
||||
private $fetchesContainerPackingList;
|
||||
|
||||
/**
|
||||
* FetchContainerPackingListControllersLogic constructor.
|
||||
* @param CanFetchContainerPackingList $canFetchContainerPackingList
|
||||
* @param FetchesContainerPackingList $fetchesContainerPackingList
|
||||
*/
|
||||
public function __construct(CanFetchContainerPackingList $canFetchContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList)
|
||||
{
|
||||
$this->canFetchContainerPackingList = $canFetchContainerPackingList;
|
||||
$this->fetchesContainerPackingList = $fetchesContainerPackingList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->canFetchContainerPackingList->passes();
|
||||
|
||||
$query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
return $this->resourceResponse(new ContainerPackingListResource($query));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\ListsContainerPackingLists;
|
||||
use App\Classes\Modules\ContainerPackingLists\Standards\Rules\CanListContainerPackingLists;
|
||||
use App\Http\Resources\ContainerPackingListResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListContainerPackingListsLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved ContainerPackingLists',
|
||||
'message' => 'You have successfully retrieved a list of ContainerPackingLists'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanListContainerPackingLists */
|
||||
private $canListContainerPackingLists;
|
||||
|
||||
/** @var ListsContainerPackingLists */
|
||||
private $listsContainerPackingLists;
|
||||
|
||||
/**
|
||||
* ListContainerPackingListsLogic constructor.
|
||||
* @param CanListContainerPackingLists $canListContainerPackingLists
|
||||
* @param ListsContainerPackingLists $listsContainerPackingLists
|
||||
*/
|
||||
public function __construct(CanListContainerPackingLists $canListContainerPackingLists, ListsContainerPackingLists $listsContainerPackingLists)
|
||||
{
|
||||
$this->canListContainerPackingLists = $canListContainerPackingLists;
|
||||
$this->listsContainerPackingLists = $listsContainerPackingLists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->canListContainerPackingLists->passes();
|
||||
|
||||
$query = $this->listsContainerPackingLists->execute($this->listsContainerPackingLists->deserializeFilters($request->input('filters')));
|
||||
|
||||
return $this->collectionResponse(ContainerPackingListResource::collection($query));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\UpdatesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\FetchesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\FetchesDistrict;
|
||||
use App\Classes\Modules\ContainerPackingLists\Standards\Rules\CanUpdateContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
use App\Http\Resources\ContainerPackingListResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateContainerPackingListLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated ContainerPackingList',
|
||||
'message' => 'You have successfully updated the ContainerPackingList'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateContainerPackingList */
|
||||
private $canUpdateContainerPackingList;
|
||||
|
||||
/** @var UpdatesContainerPackingList */
|
||||
private $updatesContainerPackingList;
|
||||
|
||||
/** @var FetchesContainerPackingList */
|
||||
private $fetchesContainerPackingList;
|
||||
|
||||
/** @var FetchesDistrict */
|
||||
private $fetchesDistrict;
|
||||
|
||||
/**
|
||||
* UpdateContainerPackingListLogic constructor.
|
||||
* @param CanUpdateContainerPackingList $canUpdateContainerPackingList
|
||||
* @param UpdatesContainerPackingList $updatesContainerPackingList
|
||||
* @param FetchesContainerPackingList $fetchesContainerPackingList
|
||||
* @param FetchesDistrict $fetchesDistrict
|
||||
*/
|
||||
public function __construct(CanUpdateContainerPackingList $canUpdateContainerPackingList, UpdatesContainerPackingList $updatesContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList, FetchesDistrict $fetchesDistrict)
|
||||
{
|
||||
$this->canUpdateContainerPackingList = $canUpdateContainerPackingList;
|
||||
$this->updatesContainerPackingList = $updatesContainerPackingList;
|
||||
$this->fetchesContainerPackingList = $fetchesContainerPackingList;
|
||||
$this->fetchesDistrict = $fetchesDistrict;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
$object = new ContainerPackingListObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'));
|
||||
//$object = new ContainerPackingListObject($request->input('company_id'), $request->input('street_one'), $request->input('street_two'), $request->input('city'), $request->input('state'), $request->input('post_code'), $request->input('country'), $request->input('default'), $request->input('billing'));
|
||||
|
||||
$this->canUpdateContainerPackingList->passes($object);
|
||||
|
||||
$query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
$query = $this->updatesContainerPackingList->execute($query, $object);
|
||||
|
||||
return $this->resourceResponse(new ContainerPackingListResource($query));
|
||||
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\DataTransferObjects;
|
||||
namespace App\Classes\Modules\ContainerPackingLists\DataTransferObjects;
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
|
||||
class PackingListObject implements DataTransferObject
|
||||
class ContainerPackingListObject implements DataTransferObject
|
||||
{
|
||||
|
||||
private $packingListId;
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\ContainerPackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
use App\Models\ContainerPackingList;
|
||||
|
||||
class CreatesContainerPackingList extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(ContainerPackingListObject $object) {
|
||||
$model = new ContainerPackingList();
|
||||
|
||||
$model->packing_list_id = $object->getPackingListId();
|
||||
$model->container_reference = $object->getContainerReference();
|
||||
$model->container_type = $object->getContainerType();
|
||||
$model->seal_reference = $object->getSealReference();
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractDeleteRecord;
|
||||
use App\Models\ContainerPackingList;
|
||||
|
||||
class DeletesContainerPackingList extends AbstractDeleteRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param ContainerPackingList $model
|
||||
* @return mixed
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(ContainerPackingList $model) {
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\ContainerPackingList;
|
||||
|
||||
class FetchesContainerPackingList extends AbstractFetchRecord
|
||||
{
|
||||
|
||||
/** @var ContainerPackingList */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* FetchesContainerPackingList constructor.
|
||||
* @param ContainerPackingList $repository
|
||||
*/
|
||||
public function __construct(ContainerPackingList $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractListRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\ContainerPackingList;
|
||||
|
||||
class ListsContainerPackingLists extends AbstractListRecord
|
||||
{
|
||||
|
||||
/** @var ContainerPackingList */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsContainerPackingLists constructor.
|
||||
* @param ContainerPackingList $repository
|
||||
*/
|
||||
public function __construct(ContainerPackingList $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\ContainerPackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
use App\Models\ContainerPackingList;
|
||||
|
||||
class UpdatesContainerPackingList extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param ContainerPackingList $model
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(ContainerPackingList $model, ContainerPackingListObject $object) {
|
||||
|
||||
$model->container_reference = $object->getContainerReference();
|
||||
$model->container_type = $object->getContainerType();
|
||||
$model->seal_reference = $object->getSealReference();
|
||||
|
||||
return $this->handler($model);
|
||||
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
use App\Classes\Modules\PackingLists\Standards\Validators\ContainerPackingListValidation;
|
||||
|
||||
class CanCreateContainerPackingList extends AbstractRule
|
||||
{
|
||||
|
||||
/** @var PackingListValidation */
|
||||
private $containerPackingListValidation;
|
||||
|
||||
/**
|
||||
* CanCreatePackingList constructor.
|
||||
* @param PackingListValidation $PackingListValidation
|
||||
*/
|
||||
public function __construct(ContainerPackingListValidation $containerPackingListValidation)
|
||||
{
|
||||
$this->containerPackingListValidation = $containerPackingListValidation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PackingListObject $object
|
||||
* @return bool
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return $this->containerPackingListValidation->validate($object);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param PackingListObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\ContainerPackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
|
||||
class CanDeleteContainerPackingList extends AbstractRule
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\ContainerPackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
|
||||
class CanFetchContainerPackingList extends AbstractRule
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\ContainerPackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
|
||||
class CanListContainerPackingLists extends AbstractRule
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ContainerPackingLists\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\ContainerPackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
use App\Classes\Modules\ContainerPackingLists\Standards\Validators\ContainerPackingListValidation;
|
||||
|
||||
class CanUpdateContainerPackingList extends AbstractRule
|
||||
{
|
||||
|
||||
/** @var ContainerPackingListValidation */
|
||||
private $ContainerPackingListValidation;
|
||||
|
||||
/**
|
||||
* CanUpdateContainerPackingList constructor.
|
||||
* @param ContainerPackingListValidation $ContainerPackingListValidation
|
||||
*/
|
||||
public function __construct(ContainerPackingListValidation $ContainerPackingListValidation)
|
||||
{
|
||||
$this->ContainerPackingListValidation = $ContainerPackingListValidation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return bool
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return $this->ContainerPackingListValidation->validate($object);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ContainerPackingListObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\Standards\Validators;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractValidation;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
|
||||
class PackingListPackageValidation extends AbstractValidation
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param PackingListObject $object
|
||||
* @return array
|
||||
*/
|
||||
protected function data($object): array {
|
||||
return [
|
||||
'packing_list_id' => $object->getPackingListId(),
|
||||
'package_id' => $object->getPackageId()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function rules(): array {
|
||||
return [
|
||||
'packing_list_id' => 'required',
|
||||
'package_id' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function messages(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\Standards\Validators;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractValidation;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
|
||||
class PackingListValidation extends AbstractValidation
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param PackingListObject $object
|
||||
* @return array
|
||||
*/
|
||||
protected function data($object): array {
|
||||
return [
|
||||
'status' => $object->getStatus(),
|
||||
'reference' => $object->getReference()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function rules(): array {
|
||||
return [
|
||||
'status' => 'required',
|
||||
'reference' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function messages(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\Standards\Validators;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractValidation;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
|
||||
class ContainerPackingListValidation extends AbstractValidation
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param PackingListObject $object
|
||||
* @return array
|
||||
*/
|
||||
protected function data($object): array {
|
||||
return [
|
||||
'status' => $object->getPackingListId(),
|
||||
'reference' => $object->getContainerReference(),
|
||||
'container_type' => $object->getContainerType(),
|
||||
'seal_reference' => $object->getSealReference(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function rules(): array {
|
||||
return [
|
||||
'status' => 'required',
|
||||
'reference' => 'required',
|
||||
'container_type' => 'required',
|
||||
'seal_reference' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function messages(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\Services\CreatesPackingList;
|
||||
use App\Classes\Modules\PackingLists\Standards\Rules\CanCreatePackingList;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Http\Resources\PackingListResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreatePackingListLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created PackingList',
|
||||
'message' => 'You have successfully created a new PackingList'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanCreatePackingList */
|
||||
private $canCreatePackingList;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var CreatesPackingList */
|
||||
private $createsPackingList;
|
||||
|
||||
/**
|
||||
* CreatePackingListLogic constructor.
|
||||
* @param CanCreatePackingList $canCreatePackingList
|
||||
* @param FetchesDistrict $fetchesDistrict
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param CreatesPackingList $createsPackingList
|
||||
*/
|
||||
public function __construct(CanCreatePackingList $canCreatePackingList, FetchesCompany $fetchesCompany, CreatesPackingList $createsPackingList)
|
||||
{
|
||||
$this->canCreatePackingList = $canCreatePackingList;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->createsPackingList = $createsPackingList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
|
||||
$object = new PackingListObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'));
|
||||
|
||||
$this->canCreatePackingList->passes($object);
|
||||
|
||||
$query = $this->createsPackingList->execute($this->fetchesCompany->execute(['id' => $request->input('company_id')]), $object);
|
||||
|
||||
return $this->resourceResponse(new PackingListResource($query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
use App\Classes\Modules\PackingLists\Standards\Rules\CanFetchPackingList;
|
||||
use App\Http\Resources\PackingListResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchContainerPackingList extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved PackingList',
|
||||
'message' => 'You have successfully retrieved a PackingList'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanFetchPackingList */
|
||||
private $canFetchPackingList;
|
||||
|
||||
/** @var FetchesPackingList */
|
||||
private $fetchesPackingList;
|
||||
|
||||
/**
|
||||
* FetchPackingListControllersLogic constructor.
|
||||
* @param CanFetchPackingList $canFetchPackingList
|
||||
* @param FetchesPackingList $fetchesPackingList
|
||||
*/
|
||||
public function __construct(CanFetchPackingList $canFetchPackingList, FetchesPackingList $fetchesPackingList)
|
||||
{
|
||||
$this->canFetchPackingList = $canFetchPackingList;
|
||||
$this->fetchesPackingList = $fetchesPackingList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->canFetchPackingList->passes();
|
||||
|
||||
$query = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
return $this->resourceResponse(new PackingListResource($query));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
use App\Models\PackingList;
|
||||
use App\Models\Company;
|
||||
|
||||
class CreatesPackingList extends AbstractUpdateRelationshipRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Company $company
|
||||
* @param PackingListObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Company $company, PackingListObject $object) {
|
||||
$model = new PackingList();
|
||||
$model->street_one = $object->getStreetOne();
|
||||
$model->street_two = $object->getStreetTwo();
|
||||
$model->country_id = $object->getCountryId();
|
||||
$model->state_id = $object->getStateId();
|
||||
$model->district_id = $object->getDistrictId();
|
||||
$model->postcode = $object->getPostCode();
|
||||
|
||||
return $this->handler($company->PackingLists(), $model);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use App\Classes\Modules\Transports\Services\CreatesTransport;
|
||||
use App\Classes\Modules\Transports\Services\FetchesDistrict;
|
||||
use App\Classes\Modules\Transports\Standards\Rules\CanCreateTransport;
|
||||
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\FetchesContainerPackingList;
|
||||
use App\Http\Resources\TransportResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
@@ -50,7 +50,7 @@ class TransportObject implements DataTransferObject
|
||||
*/
|
||||
public function getType(): string
|
||||
{
|
||||
return $this->streetOne;
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ class TransportObject implements DataTransferObject
|
||||
*/
|
||||
public function getCourier(): ?string
|
||||
{
|
||||
return $this->streetTwo;
|
||||
return $this->courier;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,13 +66,13 @@ class TransportObject implements DataTransferObject
|
||||
*/
|
||||
public function getTrackingNumber(): int
|
||||
{
|
||||
return $this->countryId;
|
||||
return $this->tracking_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDispatchDate(): Carbon
|
||||
public function getDispatchDate(): ?Carbon
|
||||
{
|
||||
return $this->dispatch_date ? Carbon::parse($this->dispatch_date) : null;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ class TransportObject implements DataTransferObject
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDropDate(): Carbon
|
||||
public function getDropDate(): ?Carbon
|
||||
{
|
||||
return $this->drop_date ? Carbon::parse($this->drop_date) : null;
|
||||
}
|
||||
|
||||
@@ -6,27 +6,28 @@ use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
|
||||
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
||||
use App\Models\Transport;
|
||||
use App\Models\Company;
|
||||
use App\Models\ContainerPackingList;
|
||||
|
||||
class CreatesTransport extends AbstractUpdateRelationshipRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Company $company
|
||||
* @param ContainerPackingList $containerPackingList
|
||||
* @param TransportObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Company $company, TransportObject $object) {
|
||||
public function execute(ContainerPackingList $containerPackingList, TransportObject $object) {
|
||||
$model = new Transport();
|
||||
$model->street_one = $object->getStreetOne();
|
||||
$model->street_two = $object->getStreetTwo();
|
||||
$model->country_id = $object->getCountryId();
|
||||
$model->state_id = $object->getStateId();
|
||||
$model->district_id = $object->getDistrictId();
|
||||
$model->postcode = $object->getPostCode();
|
||||
|
||||
return $this->handler($company->Transports(), $model);
|
||||
$model->type = $object->getType();
|
||||
$model->courier = $object->getCourier();
|
||||
$model->tracking_number = $object->getTrackingNumber();
|
||||
$model->dispatch_date = $object->getDispatchDate();
|
||||
$model->drop_date = $object->getDropDate();
|
||||
$model->status = $object->getStatus();
|
||||
|
||||
return $this->handler($containerPackingList->transports(), $model);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,15 +17,12 @@ class UpdatesTransport extends AbstractUpdateRecord
|
||||
*/
|
||||
public function execute(Transport $model, TransportObject $object) {
|
||||
|
||||
//$model->company_id = $object->getCompanyId();
|
||||
$model->street_one = $object->getStreetOne();
|
||||
$model->street_two = $object->getStreetTwo();
|
||||
$model->district_id = $object->getDistrictId();
|
||||
$model->state_id = $object->getStateId();
|
||||
$model->postcode = $object->getPostCode();
|
||||
$model->country_id = $object->getCountryId();
|
||||
//$model->default = $object->getDefault();
|
||||
//$model->billing = $object->getBilling();
|
||||
$model->type = $object->getType();
|
||||
$model->courier = $object->getCourier();
|
||||
$model->tracking_number = $object->getTrackingNumber();
|
||||
$model->dispatch_date = $object->getDispatchDate();
|
||||
$model->drop_date = $object->getDropDate();
|
||||
$model->status = $object->getStatus();
|
||||
|
||||
return $this->handler($model);
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ class TransportValidation extends AbstractValidation
|
||||
return [
|
||||
'type' => $object->getType(),
|
||||
'courier' => $object->getCourier(),
|
||||
'tracking_number' => $object->getTrackingNumber()
|
||||
'dispacth_date' => $object->getDispatchDate()
|
||||
'drop_date' => $object->getDropDate()
|
||||
'status' => $object->getStatus()
|
||||
'tracking_number' => $object->getTrackingNumber(),
|
||||
'dispacth_date' => $object->getDispatchDate(),
|
||||
'drop_date' => $object->getDropDate(),
|
||||
'status' => $object->getStatus(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -33,9 +33,7 @@ class TransportValidation extends AbstractValidation
|
||||
'type' => 'required',
|
||||
'courier' => 'required',
|
||||
'tracking_number' => 'required',
|
||||
'dispacth_date' => '',
|
||||
'drop_date' => '',
|
||||
'status' => '',
|
||||
'status' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\PackingLists\Containers;
|
||||
|
||||
use App\Classes\Modules\ContainerPackingLists\ControllersLogic\CreateContainerPackingListLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateContainerPackingListController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateContainerPackingListLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateContainerPackingListLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\PackingLists\Containers;
|
||||
|
||||
use App\Classes\Modules\ContainerPackingLists\ControllersLogic\DeleteContainerPackingListLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteContainerPackingListController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeleteContainerPackingListLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(Request $request, DeleteContainerPackingListLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\PackingLists\Containers;
|
||||
|
||||
use App\Classes\Modules\ContainerPackingLists\ControllersLogic\FetchContainerPackingListLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchContainerPackingListController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchContainerPackingListLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchContainerPackingListLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\PackingLists\Containers;
|
||||
|
||||
use App\Classes\Modules\ContainerPackingLists\ControllersLogic\ListContainerPackingListsLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListContainerPackingListsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListContainerPackingListLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListContainerPackingListsLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\PackingLists\Containers;
|
||||
|
||||
use App\Classes\Modules\ContainerPackingLists\ControllersLogic\UpdateContainerPackingListLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateContainerPackingListController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateContainerPackingListLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateContainerPackingListLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\CreateTransportLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateRemarkController
|
||||
class CreateTransportController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
|
||||
@@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\DeleteTransportLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteRemarkController
|
||||
class DeleteTransportController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
|
||||
@@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\FetchTransportLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchRemarkController
|
||||
class FetchTransportController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
|
||||
@@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\ListTransportsLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListRemarksController
|
||||
class ListTransportsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
|
||||
@@ -6,7 +6,7 @@ use App\Classes\Modules\Transports\ControllersLogic\UpdateTransportLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateRemarkController
|
||||
class UpdateTransportController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
class ContainerPackingList extends AbstractModel
|
||||
{
|
||||
|
||||
@@ -4,12 +4,22 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
class Transport extends AbstractModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'schedules';
|
||||
protected $table = 'transport_arrangements';
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
*/
|
||||
public function owner(): morphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
@@ -21,7 +21,7 @@ class CreateTransportArrangementsTable extends Migration
|
||||
$table->string('courier',45);
|
||||
$table->string('tracking_number',45);
|
||||
|
||||
$table->timestamp('dispacth_date')->nullable();
|
||||
$table->timestamp('dispatch_date')->nullable();
|
||||
$table->timestamp('drop_date')->nullable();
|
||||
|
||||
$table->integer('status')->default(0);
|
||||
|
||||
@@ -300,6 +300,283 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/packing_list/container/create": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Packing"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"operationId": "createContainerPackingList",
|
||||
"summary": "Create container packing list",
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "packing_list_id",
|
||||
"in": "query",
|
||||
"description": "Packing list id",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"name": "container_reference",
|
||||
"in": "query",
|
||||
"description": "Container reference",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "container_type",
|
||||
"in": "query",
|
||||
"description": "Container type",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "seal_reference",
|
||||
"in": "query",
|
||||
"description": "Seal reference",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"headers": {
|
||||
"X-Expires-After": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "date in UTC when token expires"
|
||||
},
|
||||
"X-Rate-Limit": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "calls per hour allowed by the user"
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Invalid input supplied"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/packing_list/container/list": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Packing"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"operationId": "containerListPacking",
|
||||
"summary": "Container list packing",
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "filter",
|
||||
"in": "query",
|
||||
"description": "Filters",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"headers": {
|
||||
"X-Expires-After": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "date in UTC when token expires"
|
||||
},
|
||||
"X-Rate-Limit": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "calls per hour allowed by the user"
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Invalid input supplied"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/packing_list/container/{id}/show": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Packing"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"operationId": "showPacking",
|
||||
"summary": "Show container packing list",
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"description": "Container packing list id",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"headers": {
|
||||
"X-Expires-After": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "date in UTC when token expires"
|
||||
},
|
||||
"X-Rate-Limit": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "calls per hour allowed by the user"
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Invalid input supplied"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/packing_list/container/update/{id}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"Packing"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"operationId": "updatePacking",
|
||||
"summary": "Update packing",
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"description": "Container packing list id",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"name": "packing_list_id",
|
||||
"in": "query",
|
||||
"description": "Packing list id",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"name": "container_reference",
|
||||
"in": "query",
|
||||
"description": "Container reference",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "container_type",
|
||||
"in": "query",
|
||||
"description": "Container type",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "seal_reference",
|
||||
"in": "query",
|
||||
"description": "Seal reference",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"headers": {
|
||||
"X-Expires-After": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "date in UTC when token expires"
|
||||
},
|
||||
"X-Rate-Limit": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "calls per hour allowed by the user"
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Invalid input supplied"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/packing_list/container/delete/{id}": {
|
||||
"delete": {
|
||||
"tags": [
|
||||
"Packing"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"operationId": "deleteContainerPackingList",
|
||||
"summary": "Delete container packing list",
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"description": "Container packing list id",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"headers": {
|
||||
"X-Expires-After": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "date in UTC when token expires"
|
||||
},
|
||||
"X-Rate-Limit": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "calls per hour allowed by the user"
|
||||
}
|
||||
},
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Invalid input supplied"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/bank/create": {
|
||||
"post": {
|
||||
"tags": [
|
||||
@@ -1178,6 +1455,13 @@
|
||||
"summary": "Create transport",
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "container_id",
|
||||
"in": "query",
|
||||
"description": "Container Id",
|
||||
"required": true,
|
||||
"type": "integer"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"in": "query",
|
||||
|
||||
+2
-2
@@ -4,14 +4,14 @@ use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['namespace' => 'Packages', 'as' => 'package.', 'prefix' => 'package'], function () {
|
||||
Route::get('/{id}/show', 'FetchPackageController@fetch')->name('show');
|
||||
Route::get('/list', 'ListPackageController@list')->name('list');
|
||||
Route::get('/list', 'ListPackagesController@list')->name('list');
|
||||
Route::post('/create', 'CreatePackageController@create')->name('create');
|
||||
Route::put('/update/{id}', 'UpdatePackageController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeletePackageController@delete')->name('delete');
|
||||
|
||||
Route::group(['namespace' => 'PackageItems', 'prefix' => 'item', 'as' => 'item.'], function () {
|
||||
Route::get('/{id}/show', 'FetchPackageItemController@fetch')->name('show');
|
||||
Route::get('/list', 'ListPackageItemController@list')->name('list');
|
||||
Route::get('/list', 'ListPackageItemsController@list')->name('list');
|
||||
Route::post('/create', 'CreatePackageItemController@create')->name('create');
|
||||
Route::put('/update/{id}', 'UpdatePackageItemController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeletePackageItemController@delete')->name('delete');
|
||||
|
||||
@@ -4,8 +4,16 @@ use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['namespace' => 'PackingLists', 'as' => 'packing_list.', 'prefix' => 'packing_list'], function () {
|
||||
Route::get('/{id}/show', 'FetchPackingListController@fetch')->name('show');
|
||||
Route::get('/list', 'ListPackingListController@list')->name('list');
|
||||
Route::get('/list', 'ListPackingListsController@list')->name('list');
|
||||
Route::post('/create', 'CreatePackingListController@create')->name('create');
|
||||
Route::put('/update/{id}', 'UpdatePackingListController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeletePackingListController@delete')->name('delete');
|
||||
|
||||
Route::group(['namespace' => 'Containers', 'prefix' => 'container', 'as' => 'container.'], function () {
|
||||
Route::get('/{id}/show', 'FetchContainerPackingListController@fetch')->name('show');
|
||||
Route::get('/list', 'ListContainerPackingListsController@list')->name('list');
|
||||
Route::post('/create', 'CreateContainerPackingListController@create')->name('create');
|
||||
Route::put('/update/{id}', 'UpdateContainerPackingListController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeleteContainerPackingListController@delete')->name('delete');
|
||||
});
|
||||
});
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['namespace' => 'Schedules', 'as' => 'schedule.', 'prefix' => 'schedule'], function () {
|
||||
Route::get('/{id}/show', 'FetchScheduleController@fetch')->name('show');
|
||||
Route::get('/list', 'ListScheduleController@list')->name('list');
|
||||
Route::get('/list', 'ListSchedulesController@list')->name('list');
|
||||
Route::post('/create', 'CreateScheduleController@create')->name('create');
|
||||
Route::put('/update/{id}', 'UpdateScheduleController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeleteScheduleController@delete')->name('delete');
|
||||
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['namespace' => 'Transports', 'as' => 'transport.', 'prefix' => 'transport'], function () {
|
||||
Route::get('/{id}/show', 'FetchTransportController@fetch')->name('show');
|
||||
Route::get('/list', 'ListTransportController@list')->name('list');
|
||||
Route::get('/list', 'ListTransportsController@list')->name('list');
|
||||
Route::post('/create', 'CreateTransportController@create')->name('create');
|
||||
Route::put('/update/{id}', 'UpdateTransportController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeleteTransportController@delete')->name('delete');
|
||||
|
||||
Reference in New Issue
Block a user