-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4d2f25
commit 46af271
Showing
37 changed files
with
683 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Mooc/Steps/Application/Create/CreateVideoStepCommandHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Application\Create; | ||
|
||
use CodelyTv\Shared\Domain\Bus\Command\CommandHandler; | ||
|
||
final readonly class CreateVideoStepCommandHandler implements CommandHandler | ||
{ | ||
public function __construct(private VideoStepCreator $creator) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Application\Create; | ||
|
||
use CodelyTv\Mooc\Steps\Domain\StepRepository; | ||
|
||
final readonly class VideoStepCreator | ||
{ | ||
public function __construct(private StepRepository $repository) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain\Exercise; | ||
|
||
use CodelyTv\Mooc\Steps\Domain\Step; | ||
use CodelyTv\Mooc\Steps\Domain\StepDuration; | ||
use CodelyTv\Mooc\Steps\Domain\StepId; | ||
use CodelyTv\Mooc\Steps\Domain\StepTitle; | ||
|
||
final class ExerciseStep extends Step | ||
{ | ||
public function __construct( | ||
StepId $id, | ||
StepTitle $title, | ||
StepDuration $duration, | ||
private readonly ExerciseStepContent $content | ||
) { | ||
parent::__construct($id, $title, $duration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain\Exercise; | ||
|
||
use CodelyTv\Shared\Domain\ValueObject\StringValueObject; | ||
|
||
final class ExerciseStepContent extends StringValueObject {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain\Quiz; | ||
|
||
use CodelyTv\Mooc\Steps\Domain\Step; | ||
use CodelyTv\Mooc\Steps\Domain\StepDuration; | ||
use CodelyTv\Mooc\Steps\Domain\StepId; | ||
use CodelyTv\Mooc\Steps\Domain\StepTitle; | ||
|
||
final class QuizStep extends Step | ||
{ | ||
/** @var QuizStepQuestion[] */ | ||
private array $questions; | ||
|
||
public function __construct( | ||
StepId $id, | ||
StepTitle $title, | ||
StepDuration $duration, | ||
QuizStepQuestion ...$questions | ||
) { | ||
parent::__construct($id, $title, $duration); | ||
|
||
$this->questions = $questions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain\Quiz; | ||
|
||
final readonly class QuizStepQuestion | ||
{ | ||
public function __construct(private string $question, private array $answers) {} | ||
|
||
public static function fromString(string $value): self | ||
{ | ||
[$question, $answers] = explode('----', $value); | ||
|
||
return new self($question, explode('****', $answers)); | ||
} | ||
|
||
public function toString(): string | ||
{ | ||
return $this->question . '----' . implode('****', $this->answers); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain; | ||
|
||
use CodelyTv\Shared\Domain\Aggregate\AggregateRoot; | ||
|
||
abstract class Step extends AggregateRoot | ||
{ | ||
public function __construct( | ||
public readonly StepId $id, | ||
private readonly StepTitle $title, | ||
private readonly StepDuration $duration | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain; | ||
|
||
use CodelyTv\Shared\Domain\ValueObject\IntValueObject; | ||
|
||
final class StepDuration extends IntValueObject {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain; | ||
|
||
use CodelyTv\Shared\Domain\ValueObject\Uuid; | ||
|
||
final class StepId extends Uuid {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain; | ||
|
||
interface StepRepository | ||
{ | ||
public function save(Step $step): void; | ||
|
||
public function search(StepId $id): ?Step; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain; | ||
|
||
use CodelyTv\Shared\Domain\ValueObject\StringValueObject; | ||
|
||
final class StepTitle extends StringValueObject {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain\Video; | ||
|
||
use CodelyTv\Mooc\Steps\Domain\Step; | ||
use CodelyTv\Mooc\Steps\Domain\StepDuration; | ||
use CodelyTv\Mooc\Steps\Domain\StepId; | ||
use CodelyTv\Mooc\Steps\Domain\StepTitle; | ||
|
||
final class VideoStep extends Step | ||
{ | ||
public function __construct( | ||
StepId $id, | ||
StepTitle $title, | ||
StepDuration $duration, | ||
private readonly VideoStepUrl $url | ||
) { | ||
parent::__construct($id, $title, $duration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodelyTv\Mooc\Steps\Domain\Video; | ||
|
||
use CodelyTv\Shared\Domain\ValueObject\StringValueObject; | ||
|
||
final class VideoStepUrl extends StringValueObject {} |
10 changes: 10 additions & 0 deletions
10
src/Mooc/Steps/Infrastructure/Persistence/Doctrine/Exercise.ExerciseStep.orm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<doctrine-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
|
||
<entity name="CodelyTv\Mooc\Steps\Domain\Exercise\ExerciseStep" table="steps_exercise"> | ||
<embedded name="content" class="CodelyTv\Mooc\Steps\Domain\Exercise\ExerciseStepContent" use-column-prefix="false" /> | ||
</entity> | ||
</doctrine-mapping> |
10 changes: 10 additions & 0 deletions
10
src/Mooc/Steps/Infrastructure/Persistence/Doctrine/Exercise.ExerciseStepContent.orm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<doctrine-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
|
||
<embeddable name="CodelyTv\Mooc\Steps\Domain\Exercise\ExerciseStepContent"> | ||
<field name="value" type="string" column="content" /> | ||
</embeddable> | ||
</doctrine-mapping> |
10 changes: 10 additions & 0 deletions
10
src/Mooc/Steps/Infrastructure/Persistence/Doctrine/Quiz.QuizStep.orm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<doctrine-mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
|
||
<entity name="CodelyTv\Mooc\Steps\Domain\Quiz\QuizStep" table="steps_quiz"> | ||
<field name="questions" type="quiz_step_questions" column="questions" /> | ||
</entity> | ||
</doctrine-mapping> |
Oops, something went wrong.