Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor project structure #5

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
420 changes: 214 additions & 206 deletions app/composer.lock

Large diffs are not rendered by default.

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;
}
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');
}
}
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');
}
}
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
Loading