Skip to content

Commit 4b9bb27

Browse files
committed
feat: refactor project structure
1 parent 62cacf4 commit 4b9bb27

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+365
-284
lines changed

app/src/Application/Payment/Activities/PaymentActivity.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/src/Application/Payment/Workflows/PaymentWorkflow.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/src/Domain/Category/Category.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

app/src/Domain/Category/CategoryId.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

app/src/Domain/Category/Contracts/CategoryIdGenerator.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/src/Domain/Payment/PaymentActivityInterface.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/src/Domain/Payment/PaymentWorkflowInterface.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/src/Domain/Project/Contracts/ProjectIdGenerator.php

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Activities\Destination;
6+
7+
use Temporal\Activity\ActivityInterface;
8+
9+
#[ActivityInterface(prefix: 'website.transfer.destination.AllocateSpace.')]
10+
interface AllocateSpaceInterface
11+
{
12+
public function handle(): string;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Activities\Destination;
6+
7+
use Temporal\Activity\ActivityInterface;
8+
9+
#[ActivityInterface(prefix: 'website.transfer.destination.AttachDomain.')]
10+
interface AttachDomainInterface
11+
{
12+
public function handle(): string;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Activities\Destination;
6+
7+
use Temporal\Activity\ActivityInterface;
8+
9+
#[ActivityInterface(prefix: 'website.transfer.destination.ReConfigureWebsite.')]
10+
interface ReConfigureWebsiteInterface
11+
{
12+
public function handle(): string;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Activities\Destination;
6+
7+
use Temporal\Activity\ActivityInterface;
8+
9+
#[ActivityInterface(prefix: 'website.transfer.destination.RestoreDatabase.')]
10+
interface RestoreDatabaseInterface
11+
{
12+
public function handle(): string;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Activities\Destination;
6+
7+
use Temporal\Activity\ActivityInterface;
8+
9+
#[ActivityInterface(prefix: 'website.transfer.destination.RestoreFiles.')]
10+
interface RestoreFilesInterface
11+
{
12+
public function handle(): string;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Activities\Source;
6+
7+
use Temporal\Activity\ActivityInterface;
8+
9+
#[ActivityInterface(prefix: 'website.transfer.source.backupDatabase.')]
10+
interface BackupDatabaseInterface
11+
{
12+
public function handle(): string;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Activities\Source;
6+
7+
use Temporal\Activity\ActivityInterface;
8+
9+
#[ActivityInterface(prefix: 'website.transfer.source.backupFiles.')]
10+
interface BackupFilesInterface
11+
{
12+
public function handle(): string;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Activities\Source;
6+
7+
use Temporal\Activity\ActivityInterface;
8+
9+
#[ActivityInterface(prefix: 'website.transfer.source.releaseDomain.')]
10+
interface ReleaseDomainInterface
11+
{
12+
public function handle(): string;
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Activities\Source;
6+
7+
use Temporal\Activity\ActivityInterface;
8+
9+
#[ActivityInterface(prefix: 'website.transfer.source.transferBackup.')]
10+
interface TransferBackupInterface
11+
{
12+
public function handle(): string;
13+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Contracts;
6+
7+
use Domain\Transfer\TransferId;
8+
9+
interface TransferIdGenerator
10+
{
11+
public function nextId(): TransferId;
12+
}

app/src/Domain/Project/Contracts/ProjectRepository.php renamed to app/src/Domain/Transfer/Contracts/TransferRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
declare(strict_types=1);
44

5-
namespace Domain\Project\Contracts;
5+
namespace Domain\Transfer\Contracts;
66

77
use Cycle\ORM\RepositoryInterface;
88

9-
interface ProjectRepository extends RepositoryInterface
9+
interface TransferRepository extends RepositoryInterface
1010
{
1111
public function findById(string $id): ?object;
1212
}

app/src/Domain/Project/Events/ProjectCreated.php renamed to app/src/Domain/Transfer/Events/TransferCreated.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
declare(strict_types=1);
44

5-
namespace Domain\Project\Events;
5+
namespace Domain\Transfer\Events;
66

77
use Assert\AssertionFailedException;
88
use Domain\Auth\Signature;
9-
use Domain\Project\ProjectId;
9+
use Domain\Transfer\TransferId;
1010
use EventSauce\EventSourcing\Serialization\SerializablePayload;
1111
use Exception;
1212
use JsonSerializable;
1313

14-
final readonly class ProjectCreated implements SerializablePayload, JsonSerializable
14+
final readonly class TransferCreated implements SerializablePayload, JsonSerializable
1515
{
1616
/**
1717
* @phpstan-consistent-constructor
1818
*/
1919
public function __construct(
20-
private ProjectId $id,
20+
private TransferId $id,
2121
private string $name,
2222
private string $description,
2323
private Signature $signature,
@@ -31,10 +31,10 @@ public function __construct(
3131
final public static function fromPayload(array $payload): static
3232
{
3333
return new self(
34-
ProjectId::fromString($payload['id']),
35-
$payload['name'],
36-
$payload['description'],
37-
Signature::fromArray($payload['signature'])
34+
id: TransferId::fromString($payload['id']),
35+
name: $payload['name'],
36+
description: $payload['description'],
37+
signature: Signature::fromArray($payload['signature'])
3838
);
3939
}
4040

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Exceptions;
6+
7+
use RuntimeException;
8+
9+
final class AllocateSpaceFailedException extends RuntimeException
10+
{
11+
public function __construct()
12+
{
13+
parent::__construct('Failed to allocate space for transfer');
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Exceptions;
6+
7+
use RuntimeException;
8+
9+
final class AttachDomainFailedException extends RuntimeException
10+
{
11+
public function __construct()
12+
{
13+
parent::__construct('Failed attach domain for transfer');
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Domain\Transfer\Exceptions;
6+
7+
use RuntimeException;
8+
9+
final class BackupFilesFailedException extends RuntimeException
10+
{
11+
public function __construct()
12+
{
13+
parent::__construct('Failed to backup files on source server for transfer');
14+
}
15+
}

0 commit comments

Comments
 (0)