Compare commits
5
Commits
0.5.0
...
3e2865dbe7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e2865dbe7 | ||
|
|
60eb1f92e8 | ||
|
|
9a542c9108 | ||
|
|
a035ea9648 | ||
|
|
46f3a6491d |
@@ -105,3 +105,4 @@ Temporary Items
|
||||
/api/vendor/
|
||||
/api/tests/_*
|
||||
/api/tests/*.suite.yml
|
||||
/api/.env
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
## Datenbank-Einstellungen
|
||||
DATABASES_HOST=psql.torsten-hettstedt.net
|
||||
DATABASES_NAME=torsten
|
||||
DATABASES_USER=web_user
|
||||
DATABASES_PASS=V6ZGhtdXEbxH8oWD
|
||||
@@ -0,0 +1,5 @@
|
||||
## Datenbank-Einstellungen
|
||||
DATABASES_HOST=psql.domain.tld
|
||||
DATABASES_NAME=db
|
||||
DATABASES_USER=user
|
||||
DATABASES_PASS=1234
|
||||
@@ -1,6 +1,5 @@
|
||||
FROM php:8.0-apache
|
||||
|
||||
#RUN apt update && apt install -y postgresql postgresql-client
|
||||
RUN apt update && apt install -y libpq-dev
|
||||
RUN docker-php-ext-install -j$(nproc) pdo pdo_pgsql
|
||||
|
||||
|
||||
@@ -6,16 +6,15 @@ use Slim\Exception\HttpSpecializedException;
|
||||
|
||||
class HttpConflictRequestException extends HttpSpecializedException
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
/** @var int */
|
||||
protected $code = 409;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
/** @var string */
|
||||
protected $message = 'Conflict.';
|
||||
|
||||
/** @var string */
|
||||
protected $title = '409 Conflict';
|
||||
|
||||
/** @var string */
|
||||
protected $description = 'The 409 (Conflict) status code indicates that the request could not be completed due to a conflict with the current state of the target resource.';
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ class WorkingHoursController
|
||||
{
|
||||
|
||||
protected PDO $databases;
|
||||
protected ContainerInterface $container;
|
||||
|
||||
/**
|
||||
* WorkingHoursController constructor.
|
||||
@@ -34,11 +33,10 @@ class WorkingHoursController
|
||||
*/
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
if ($this->container->has('databases') === false) {
|
||||
if ($container->has('databases') === false) {
|
||||
throw new NotDatabasesException('Datenbank ist nicht Vorhanden');
|
||||
}
|
||||
$this->databases = $this->container->get('databases');
|
||||
$this->databases = $container->get('databases');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,13 +69,17 @@ class WorkingHoursController
|
||||
*
|
||||
* @return Response
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws HttpInternalServerErrorException
|
||||
* @noinspection PhpUnusedParameterInspection
|
||||
*/
|
||||
public function browse(Request $request, Response $response, array $args): Response
|
||||
{
|
||||
$repository = new WorkingHoursRepository($this->databases);
|
||||
return $this->printResponse($response, $repository->findAll(), StatusCodeInterface::STATUS_OK);
|
||||
try {
|
||||
return $this->printResponse($response, $repository->findAll(), StatusCodeInterface::STATUS_OK);
|
||||
} catch (Exception $exception) {
|
||||
throw new HttpInternalServerErrorException($request, 'Der Wert für das Datum oder die Zeit ist falsch in der Datenbank', $exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user