Add pool interfaces, refactor imports in the bootstrap, re-organize some of the APIs

This commit is contained in:
Dave Smith-Hayes 2024-07-25 20:32:26 -04:00
parent 7f05554f4e
commit e58c442ccf
7 changed files with 34 additions and 41 deletions

View File

@ -2,41 +2,33 @@
namespace Slovocast; namespace Slovocast;
use Exception;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Slim\App;
use Slim\Factory\AppFactory;
use League\Config\Configuration;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use DI\Container; use DI\Container;
use DI\ContainerBuilder; use DI\ContainerBuilder;
use Exception;
use Slim\Psr7\Factory\ResponseFactory; use League\Config\Configuration;
use Slovocast\Configuration\SiteInformationSchema;
use Slovocast\Configuration\DatabaseConnectionSchema;
use Slovocast\Configuration\SessionSchema;
use Twig\Error\LoaderError;
use Slovocast\Domain\Repository\User\UserRepositoryInterface;
use Slovocast\Domain\Repository\User\UserRepository;
use Slovocast\Infrastructure\User\UserAuthorizationInterface;
use Slovocast\Infrastructure\User\BasicUserAuthorization;
use React\Mysql\MysqlClient;
use Psr\Log\LoggerInterface;
use Monolog\Logger;
use Monolog\Handler\StreamHandler; use Monolog\Handler\StreamHandler;
use Monolog\Level; use Monolog\Level;
use Monolog\Logger;
use Odan\Session\PhpSession; use Odan\Session\PhpSession;
use Odan\Session\SessionInterface; use Odan\Session\SessionInterface;
use Odan\Session\SessionManagerInterface; use Odan\Session\SessionManagerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Log\LoggerInterface;
use React\Mysql\MysqlClient;
use Slim\App;
use Slim\Factory\AppFactory;
use Slim\Psr7\Factory\ResponseFactory;
use Slovocast\Configuration\DatabaseConnectionSchema;
use Slovocast\Configuration\SessionSchema;
use Slovocast\Configuration\SiteInformationSchema;
use Slovocast\Domain\Repository\User\UserRepository;
use Slovocast\Domain\Repository\User\UserRepositoryInterface;
use Slovocast\Infrastructure\Api\User\UserAuthorizationInterface;
use Slovocast\Infrastructure\User\BasicUserAuthorization;
use Twig\Error\LoaderError;
/** /**
* Defines here are used globally * Defines here are used globally

View File

@ -2,12 +2,12 @@
namespace Slovocast\Controller\User; namespace Slovocast\Controller\User;
use Odan\Session\SessionInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Slovocast\Controller\Controller; use Slovocast\Controller\Controller;
use Slovocast\Domain\Repository\User\UserRepositoryInterface; use Slovocast\Domain\Repository\User\UserRepositoryInterface;
use Slovocast\Infrastructure\User\UserAuthorizationInterface;
use Slovocast\Exception\EntityNotFoundException; use Slovocast\Exception\EntityNotFoundException;
use Psr\Http\Message\ResponseInterface as Response; use Slovocast\Infrastructure\Api\User\UserAuthorizationInterface;
use Odan\Session\SessionInterface;
class LoginUserAction extends Controller class LoginUserAction extends Controller
{ {

View File

@ -2,11 +2,11 @@
namespace Slovocast\Domain\Repository\User; namespace Slovocast\Domain\Repository\User;
use function React\Async\await;
use React\Mysql\MysqlClient; use React\Mysql\MysqlClient;
use Slovocast\Infrastructure\User\UserAuthorizationInterface;
use Slovocast\Exception\EntityNotFoundException;
use Slovocast\Domain\Entity\User; use Slovocast\Domain\Entity\User;
use Slovocast\Exception\EntityNotFoundException;
use Slovocast\Infrastructure\Api\User\UserAuthorizationInterface;
use function React\Async\await;
class UserRepository implements UserRepositoryInterface class UserRepository implements UserRepositoryInterface
{ {

View File

@ -2,7 +2,7 @@
namespace Slovocast\Infrastructure\Api\Database; namespace Slovocast\Infrastructure\Api\Database;
interface ConnectionInterface interface PooledConnectionInterface
{ {
public function release(): void; public function release(): void;
} }

View File

@ -4,7 +4,8 @@ namespace Slovocast\Infrastructure\Api\Database;
interface ConnectionPoolInterface interface ConnectionPoolInterface
{ {
public function getTotalConnectionCount(): int; public function getFreeConnectionsCount(): int;
public function getActiveConnectionsCount(): int;
public function hasFreeConnection(): bool; public function hasFreeConnection(): bool;
public function getConnection(): ConnectionInterface; public function getConnection(): ConnectionInterface;
public function releaseConnection(ConnectionInterface $connection): void; public function releaseConnection(ConnectionInterface $connection): void;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace Slovocast\Infrastructure\User; namespace Slovocast\Infrastructure\Api\User;
/** /**
* A simple interface for securing and checking secured passwords for a user * A simple interface for securing and checking secured passwords for a user

View File

@ -2,7 +2,7 @@
namespace Slovocast\Infrastructure\User; namespace Slovocast\Infrastructure\User;
use Slovocast\Infrastructure\User\UserAuthorizationInterface; use Slovocast\Infrastructure\Api\User\UserAuthorizationInterface;
/** /**
* This empty class will essentially just check hashed passwords passed into it * This empty class will essentially just check hashed passwords passed into it