second commit i guess
This commit is contained in:
parent
8d896bcd12
commit
5244e9b6e6
16
src/ApiDomain/External/Video/config/routes.php
vendored
Normal file
16
src/ApiDomain/External/Video/config/routes.php
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use MyTube\API\External\Health\Handler\HealthHandler;
|
||||||
|
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
'name' => 'health',
|
||||||
|
'path' => '/api/health',
|
||||||
|
'allowed_methods' => ['GET'],
|
||||||
|
'middleware' => [
|
||||||
|
HealthHandler::class
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
?>
|
||||||
12
src/ApiDomain/External/Video/config/service_manager.php
vendored
Normal file
12
src/ApiDomain/External/Video/config/service_manager.php
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use MyTube\API\External\Health\Handler\HealthHandler;
|
||||||
|
use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'factories' => [
|
||||||
|
HealthHandler::class => AutoWiringFactory::class
|
||||||
|
],
|
||||||
|
]
|
||||||
|
|
||||||
|
?>
|
||||||
16
src/ApiDomain/External/Video/src/ConfigProvider.php
vendored
Normal file
16
src/ApiDomain/External/Video/src/ConfigProvider.php
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace MyTube\API\External\Health;
|
||||||
|
|
||||||
|
class ConfigProvider
|
||||||
|
{
|
||||||
|
public function __invoke(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'dependencies' => require __DIR__ . './../config/service_manager.php',
|
||||||
|
'routes' => require __DIR__ . '/./../config/routes.php',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
66
src/DataDomain/Business/src/Entity/Video.php
Normal file
66
src/DataDomain/Business/src/Entity/Video.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MyTube\Data\Business\Entity;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use MyTube\Infrastructure\UuidGenerator\UuidGenerator;
|
||||||
|
use Ramsey\Uuid\UuidInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Entity(repositoryClass="MyTube\Data\Business\Repository\RegistrationRepository")
|
||||||
|
* @ORM\Table(name="registration")
|
||||||
|
*/
|
||||||
|
class Registration {
|
||||||
|
/**
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\Column(name="id", type="uuid_binary_ordered_time")
|
||||||
|
*/
|
||||||
|
private UuidInterface $id;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="username", type="string") */
|
||||||
|
private string $username;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="mail", type="string") */
|
||||||
|
private string $mail;
|
||||||
|
|
||||||
|
/** @ORM\Column(name="created_at", type="datetime") */
|
||||||
|
private DateTime $createdAt;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->id = UuidGenerator::generate();
|
||||||
|
|
||||||
|
$now = new DateTime();
|
||||||
|
$this->setCreatedAt($now);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getId(): UuidInterface {
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUsername(): string {
|
||||||
|
return $this->username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUsername(string $username): void {
|
||||||
|
$this->username = $username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMail(): ?string {
|
||||||
|
return $this->mail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMail(?string $mail): void {
|
||||||
|
$this->mail = $mail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedAt(): DateTime {
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCreatedAt(DateTime $createdAt): void {
|
||||||
|
$this->createdAt = $createdAt;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/DataDomain/Business/src/Repository/VideoRepository.php
Normal file
24
src/DataDomain/Business/src/Repository/VideoRepository.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MyTube\Data\Business\Repository;
|
||||||
|
|
||||||
|
use MyTube\Data\Business\Entity\Registration;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
|
||||||
|
class RegistrationRepository extends EntityRepository {
|
||||||
|
public function findByIdentifier(string $identifier) : ?Registration {
|
||||||
|
$queryBuilder = $this->createQueryBuilder('r');
|
||||||
|
$queryBuilder->where(
|
||||||
|
$queryBuilder->expr()->orX(
|
||||||
|
$queryBuilder->expr()->eq('r.username', ':identifier'),
|
||||||
|
$queryBuilder->expr()->eq('r.mail', ':identifier')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('identifier', $identifier);
|
||||||
|
$query = $queryBuilder->getQuery();
|
||||||
|
|
||||||
|
/** @var ?Registration $registration */
|
||||||
|
$registration = $query->execute()[0] ?? null;
|
||||||
|
return $registration;
|
||||||
|
}
|
||||||
|
}
|
||||||
31
src/HandlingDomain/Video/config/service_manager.php
Normal file
31
src/HandlingDomain/Video/config/service_manager.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use MyTube\Handling\UserSession\Builder\UserSessionBuilder;
|
||||||
|
use MyTube\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandBuilder;
|
||||||
|
use MyTube\Handling\UserSession\Handler\Command\LoginUser\LoginUserCommandHandler;
|
||||||
|
use MyTube\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandBuilder;
|
||||||
|
use MyTube\Handling\UserSession\Handler\Command\LogoutUser\LogoutUserCommandHandler;
|
||||||
|
use MyTube\Handling\UserSession\Rule\UserPasswordMatchesRule;
|
||||||
|
use Reinfi\DependencyInjection\Factory\AutoWiringFactory;
|
||||||
|
use Reinfi\DependencyInjection\Factory\InjectionFactory;
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'factories' => [
|
||||||
|
|
||||||
|
/// Rule
|
||||||
|
UserPasswordMatchesRule::class => AutoWiringFactory::class,
|
||||||
|
|
||||||
|
/// Builder
|
||||||
|
UserSessionBuilder::class => AutoWiringFactory::class,
|
||||||
|
|
||||||
|
/// CQRS
|
||||||
|
// Login User
|
||||||
|
LoginUserCommandHandler::class => InjectionFactory::class,
|
||||||
|
LoginUserCommandBuilder::class => AutoWiringFactory::class,
|
||||||
|
|
||||||
|
// Logout User
|
||||||
|
LogoutUserCommandHandler::class => InjectionFactory::class,
|
||||||
|
LogoutUserCommandBuilder::class => AutoWiringFactory::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
15
src/HandlingDomain/Video/src/ConfigProvider.php
Normal file
15
src/HandlingDomain/Video/src/ConfigProvider.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace MyTube\Handling\UserSession;
|
||||||
|
|
||||||
|
class ConfigProvider
|
||||||
|
{
|
||||||
|
public function __invoke(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'dependencies' => require __DIR__ . '/./../config/service_manager.php',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user