Skip to content

Commit

Permalink
feat: refactor project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed Dec 1, 2024
1 parent 62cacf4 commit 4b9bb27
Show file tree
Hide file tree
Showing 42 changed files with 365 additions and 284 deletions.
24 changes: 0 additions & 24 deletions app/src/Application/Payment/Activities/PaymentActivity.php

This file was deleted.

25 changes: 0 additions & 25 deletions app/src/Application/Payment/Workflows/PaymentWorkflow.php

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/Domain/Category/Category.php

This file was deleted.

11 changes: 0 additions & 11 deletions app/src/Domain/Category/CategoryId.php

This file was deleted.

12 changes: 0 additions & 12 deletions app/src/Domain/Category/Contracts/CategoryIdGenerator.php

This file was deleted.

15 changes: 0 additions & 15 deletions app/src/Domain/Payment/PaymentActivityInterface.php

This file was deleted.

15 changes: 0 additions & 15 deletions app/src/Domain/Payment/PaymentWorkflowInterface.php

This file was deleted.

12 changes: 0 additions & 12 deletions app/src/Domain/Project/Contracts/ProjectIdGenerator.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Activities\Destination;

use Temporal\Activity\ActivityInterface;

#[ActivityInterface(prefix: 'website.transfer.destination.AllocateSpace.')]
interface AllocateSpaceInterface
{
public function handle(): string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Activities\Destination;

use Temporal\Activity\ActivityInterface;

#[ActivityInterface(prefix: 'website.transfer.destination.AttachDomain.')]
interface AttachDomainInterface
{
public function handle(): string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Activities\Destination;

use Temporal\Activity\ActivityInterface;

#[ActivityInterface(prefix: 'website.transfer.destination.ReConfigureWebsite.')]
interface ReConfigureWebsiteInterface
{
public function handle(): string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Activities\Destination;

use Temporal\Activity\ActivityInterface;

#[ActivityInterface(prefix: 'website.transfer.destination.RestoreDatabase.')]
interface RestoreDatabaseInterface
{
public function handle(): string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Activities\Destination;

use Temporal\Activity\ActivityInterface;

#[ActivityInterface(prefix: 'website.transfer.destination.RestoreFiles.')]
interface RestoreFilesInterface
{
public function handle(): string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Activities\Source;

use Temporal\Activity\ActivityInterface;

#[ActivityInterface(prefix: 'website.transfer.source.backupDatabase.')]
interface BackupDatabaseInterface
{
public function handle(): string;
}
13 changes: 13 additions & 0 deletions app/src/Domain/Transfer/Activities/Source/BackupFilesInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Activities\Source;

use Temporal\Activity\ActivityInterface;

#[ActivityInterface(prefix: 'website.transfer.source.backupFiles.')]
interface BackupFilesInterface
{
public function handle(): string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Activities\Source;

use Temporal\Activity\ActivityInterface;

#[ActivityInterface(prefix: 'website.transfer.source.releaseDomain.')]
interface ReleaseDomainInterface
{
public function handle(): string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Activities\Source;

use Temporal\Activity\ActivityInterface;

#[ActivityInterface(prefix: 'website.transfer.source.transferBackup.')]
interface TransferBackupInterface
{
public function handle(): string;
}
12 changes: 12 additions & 0 deletions app/src/Domain/Transfer/Contracts/TransferIdGenerator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Contracts;

use Domain\Transfer\TransferId;

interface TransferIdGenerator
{
public function nextId(): TransferId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Domain\Project\Contracts;
namespace Domain\Transfer\Contracts;

use Cycle\ORM\RepositoryInterface;

interface ProjectRepository extends RepositoryInterface
interface TransferRepository extends RepositoryInterface
{
public function findById(string $id): ?object;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

declare(strict_types=1);

namespace Domain\Project\Events;
namespace Domain\Transfer\Events;

use Assert\AssertionFailedException;
use Domain\Auth\Signature;
use Domain\Project\ProjectId;
use Domain\Transfer\TransferId;
use EventSauce\EventSourcing\Serialization\SerializablePayload;
use Exception;
use JsonSerializable;

final readonly class ProjectCreated implements SerializablePayload, JsonSerializable
final readonly class TransferCreated implements SerializablePayload, JsonSerializable
{
/**
* @phpstan-consistent-constructor
*/
public function __construct(
private ProjectId $id,
private TransferId $id,
private string $name,
private string $description,
private Signature $signature,
Expand All @@ -31,10 +31,10 @@ public function __construct(
final public static function fromPayload(array $payload): static
{
return new self(
ProjectId::fromString($payload['id']),
$payload['name'],
$payload['description'],
Signature::fromArray($payload['signature'])
id: TransferId::fromString($payload['id']),
name: $payload['name'],
description: $payload['description'],
signature: Signature::fromArray($payload['signature'])
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Exceptions;

use RuntimeException;

final class AllocateSpaceFailedException extends RuntimeException
{
public function __construct()
{
parent::__construct('Failed to allocate space for transfer');
}
}
15 changes: 15 additions & 0 deletions app/src/Domain/Transfer/Exceptions/AttachDomainFailedException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Exceptions;

use RuntimeException;

final class AttachDomainFailedException extends RuntimeException
{
public function __construct()
{
parent::__construct('Failed attach domain for transfer');
}
}
15 changes: 15 additions & 0 deletions app/src/Domain/Transfer/Exceptions/BackupFilesFailedException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace Domain\Transfer\Exceptions;

use RuntimeException;

final class BackupFilesFailedException extends RuntimeException
{
public function __construct()
{
parent::__construct('Failed to backup files on source server for transfer');
}
}
Loading

0 comments on commit 4b9bb27

Please sign in to comment.