mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-28 17:03:57 +00:00
update contact recode and clean up
This commit is contained in:
@@ -2,41 +2,38 @@
|
||||
|
||||
namespace App\Modules\ControllerLogic\Contacts;
|
||||
|
||||
|
||||
use App\Classes\Constants;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Exceptions\CannotCreateContactException;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateContactLogic
|
||||
{
|
||||
|
||||
/** @var CreatesContact */
|
||||
private $createsContact;
|
||||
/** @var CreatesContact */
|
||||
private $createContact;
|
||||
|
||||
/**
|
||||
* CreateContactLogic constructor.
|
||||
* @param CreatesContact $createsContact
|
||||
* @param CreatesContact $createContact
|
||||
*/
|
||||
public function __construct(CreatesContact $createsContact)
|
||||
public function __construct(CreatesContact $createContact)
|
||||
{
|
||||
$this->createsContact = $createsContact;
|
||||
$this->createContact = $createContact;
|
||||
}
|
||||
|
||||
|
||||
public function execute(int $type, int $referenceId, Request $request){
|
||||
public function execute(string $type, int $referenceId, Request $request)
|
||||
{
|
||||
try{
|
||||
|
||||
try {
|
||||
$object = new ContactObject($type, $referenceId, $request->input('name'), $request->input('designation'), $request->input('contact'), $request->input('email'));
|
||||
$object = new ContactObject($request->input('name'), $request->input('designation'), $request->input('contact'), $request->input('email'));
|
||||
return $this->createContact->execute($object, $type, $referenceId);
|
||||
|
||||
return $this->createsContact->execute($object);
|
||||
} catch (CannotCreateContactException $exception){
|
||||
}
|
||||
catch (CannotCreateContactException $exception){
|
||||
throw new InternalServerErrorException("Failed to create contact because {$exception->getMessage()}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user