add phone number, notes, and contact person to carrier
This commit is contained in:
parent
f37868f0d0
commit
a739479e22
9 changed files with 88 additions and 6 deletions
|
|
@ -8,6 +8,9 @@ class Carrier
|
|||
private ?int $id,
|
||||
private string $email,
|
||||
private string $companyName,
|
||||
private string $contactPerson,
|
||||
private string $phoneNumber,
|
||||
private string $notes,
|
||||
) {}
|
||||
|
||||
public function getId(): ?int
|
||||
|
|
@ -29,4 +32,19 @@ class Carrier
|
|||
{
|
||||
return $this->companyName;
|
||||
}
|
||||
|
||||
public function getContactPerson(): string
|
||||
{
|
||||
return $this->contactPerson;
|
||||
}
|
||||
|
||||
public function getPhoneNumber(): string
|
||||
{
|
||||
return $this->phoneNumber;
|
||||
}
|
||||
|
||||
public function getNotes(): string
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,10 @@ class CarrierController
|
|||
$body = $request->getParsedBody();
|
||||
$dto = new CreateCarrierRequest(
|
||||
$body['email'],
|
||||
$body['companyName'],
|
||||
$body['company_name'],
|
||||
$body['contact_person'],
|
||||
$body['phone_number'],
|
||||
$body['notes'],
|
||||
);
|
||||
$useCase = new CreateCarrier($dto, $this->carrierRepo);
|
||||
$useCase->execute();
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ class FlatFileCarrierRepository implements CarrierRepository
|
|||
$jsonCarrier['id'],
|
||||
$jsonCarrier['email'],
|
||||
$jsonCarrier['companyName'],
|
||||
$jsonCarrier['contactPerson'],
|
||||
$jsonCarrier['phoneNumber'],
|
||||
$jsonCarrier['notes'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +41,9 @@ class FlatFileCarrierRepository implements CarrierRepository
|
|||
'id' => $this->autoIncrementId($data),
|
||||
'email' => $carrier->getEmail(),
|
||||
'companyName' => $carrier->getCompanyName(),
|
||||
'contactPerson' => $carrier->getContactPerson(),
|
||||
'phoneNumber' => $carrier->getPhoneNumber(),
|
||||
'notes' => $carrier->getNotes(),
|
||||
];
|
||||
$data[] = $newCarrier;
|
||||
file_put_contents(
|
||||
|
|
@ -48,6 +54,9 @@ class FlatFileCarrierRepository implements CarrierRepository
|
|||
$newCarrier['id'],
|
||||
$newCarrier['email'],
|
||||
$newCarrier['companyName'],
|
||||
$newCarrier['contactPerson'],
|
||||
$newCarrier['phoneNumber'],
|
||||
$newCarrier['notes'],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +69,10 @@ class FlatFileCarrierRepository implements CarrierRepository
|
|||
return new Carrier(
|
||||
$carrier['id'],
|
||||
$carrier['email'],
|
||||
$carrier['companyName']
|
||||
$carrier['companyName'],
|
||||
$carrier['contactPerson'],
|
||||
$carrier['phoneNumber'],
|
||||
$carrier['notes'],
|
||||
);
|
||||
}, $this->getCarrierData());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ class CreateCarrier
|
|||
$carrier = new Carrier(
|
||||
null,
|
||||
$this->dto->email,
|
||||
$this->dto->companyName
|
||||
$this->dto->companyName,
|
||||
$this->dto->contactPerson,
|
||||
$this->dto->phoneNumber,
|
||||
$this->dto->notes,
|
||||
);
|
||||
|
||||
return $this->carrierRepo->save($carrier);
|
||||
|
|
|
|||
|
|
@ -7,5 +7,8 @@ class CreateCarrierRequest
|
|||
public function __construct(
|
||||
public string $email,
|
||||
public string $companyName,
|
||||
public string $contactPerson,
|
||||
public string $phoneNumber,
|
||||
public string $notes,
|
||||
) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue