update email template
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Integrations\Domain\Transformers;
|
||||
|
||||
use App\Integrations\Domain\DTOs\DnsDomainData;
|
||||
use App\Integrations\Domain\Support\DnsServerIdResolver;
|
||||
|
||||
class DnsDomainTransformer
|
||||
{
|
||||
public function __construct(private DnsServerIdResolver $servers)
|
||||
{
|
||||
}
|
||||
|
||||
public function transform(array|object $row): DnsDomainData
|
||||
{
|
||||
$row = (array) $row;
|
||||
|
||||
return new DnsDomainData(
|
||||
legacyId: (int) $row['id'],
|
||||
domainName: $row['domain_name'] ?: null,
|
||||
dnsManagerServerId: $this->servers->resolve((int) $row['dns_manager_server_id']),
|
||||
isCreated: (int) $row['is_created'],
|
||||
pleskId: $row['plesk_id'] !== null ? (int) $row['plesk_id'] : null,
|
||||
createdAt: $this->nullableDate($row['created_at'] ?? null),
|
||||
updatedAt: $this->nullableDate($row['updated_at'] ?? null),
|
||||
);
|
||||
}
|
||||
|
||||
private function nullableDate(?string $value): ?string
|
||||
{
|
||||
if (! $value || (int) substr($value, 0, 4) < 1970) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Integrations\Domain\Transformers;
|
||||
|
||||
use App\Integrations\Domain\DTOs\DnsDomainUserData;
|
||||
use App\Integrations\Domain\Support\DnsDomainIdResolver;
|
||||
use App\Integrations\Domain\Support\DomainUserResolver;
|
||||
|
||||
class DnsDomainUserTransformer
|
||||
{
|
||||
public function __construct(
|
||||
private DnsDomainIdResolver $domains,
|
||||
private DomainUserResolver $users,
|
||||
) {
|
||||
}
|
||||
|
||||
public function transform(array|object $row): DnsDomainUserData
|
||||
{
|
||||
$row = (array) $row;
|
||||
|
||||
return new DnsDomainUserData(
|
||||
domainId: $this->domains->resolve((int) $row['domain_id']),
|
||||
customerId: $this->users->resolve((int) $row['user_id']),
|
||||
createdAt: $this->nullableDate($row['created_at'] ?? null),
|
||||
updatedAt: $this->nullableDate($row['updated_at'] ?? null),
|
||||
);
|
||||
}
|
||||
|
||||
private function nullableDate(?string $value): ?string
|
||||
{
|
||||
if (! $value || (int) substr($value, 0, 4) < 1970) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Integrations\Domain\Transformers;
|
||||
|
||||
use App\Integrations\Domain\DTOs\DnsRecordData;
|
||||
use App\Integrations\Domain\Support\DnsDomainIdResolver;
|
||||
|
||||
class DnsRecordTransformer
|
||||
{
|
||||
public function __construct(private DnsDomainIdResolver $domains)
|
||||
{
|
||||
}
|
||||
|
||||
public function transform(array|object $row): DnsRecordData
|
||||
{
|
||||
$row = (array) $row;
|
||||
|
||||
return new DnsRecordData(
|
||||
legacyId: (int) $row['id'],
|
||||
dnsManagerDomainId: $this->domains->resolve((int) $row['dns_manager_domain_id']),
|
||||
name: $row['name'] ?: null,
|
||||
type: $row['type'] ?: 'A',
|
||||
serviceName: $row['service_name'] ?: null,
|
||||
protocol: $row['protocol'] ?: null,
|
||||
priority: $row['priority'] ?? '0',
|
||||
weight: $row['weight'] ?? '0',
|
||||
port: $row['port'] ?? '0',
|
||||
value: $row['value'] ?: null,
|
||||
pleskId: $row['plesk_id'] !== null ? (int) $row['plesk_id'] : null,
|
||||
ttl: (int) ($row['ttl'] ?: 300),
|
||||
createdAt: $this->nullableDate($row['created_at'] ?? null),
|
||||
updatedAt: $this->nullableDate($row['updated_at'] ?? null),
|
||||
);
|
||||
}
|
||||
|
||||
private function nullableDate(?string $value): ?string
|
||||
{
|
||||
if (! $value || (int) substr($value, 0, 4) < 1970) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Integrations\Domain\Transformers;
|
||||
|
||||
use App\Integrations\Domain\DTOs\DnsServerData;
|
||||
|
||||
class DnsServerTransformer
|
||||
{
|
||||
public function transform(array|object $row): DnsServerData
|
||||
{
|
||||
$row = (array) $row;
|
||||
|
||||
return new DnsServerData(
|
||||
legacyId: (int) $row['id'],
|
||||
name: $row['name'] ?: null,
|
||||
ipAddress: $row['ip_address'],
|
||||
username: $row['username'] ?: 'root',
|
||||
// source ciphertext was encrypted with a different app's APP_KEY, Crypt::decryptString() will fail until re-entered
|
||||
password: $row['password'],
|
||||
apiKey: $row['api_key'] ?: null,
|
||||
status: $row['status'] ?: 'activated',
|
||||
createdAt: $this->nullableDate($row['created_at'] ?? null),
|
||||
updatedAt: $this->nullableDate($row['updated_at'] ?? null),
|
||||
);
|
||||
}
|
||||
|
||||
private function nullableDate(?string $value): ?string
|
||||
{
|
||||
if (! $value || (int) substr($value, 0, 4) < 1970) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user