Skip to content
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
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
"Tests\\": "tests/",
"ProtoPhpGen\\": "tools/protoc-php-gen/src/"
}
},
"config": {
Expand Down
12 changes: 7 additions & 5 deletions config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

declare(strict_types=1);

use App\Application\Handlers\AuthHandler;
use App\Application\Handlers\HandlerInterface;
use App\Application\Handlers\HomeHandler;

/**
* WARNING: This file is automatically generated
Expand All @@ -19,24 +21,24 @@
[
'method' => 'POST',
'path' => '/api/v1/auth/login',
'handler' => App\Application\Handlers\AuthHandler::class,
'handler' => AuthHandler::class,
],
// AuthService.Logout
[
'method' => 'POST',
'path' => '/api/v1/auth/logout',
'handler' => App\Application\Handlers\AuthHandler::class,
'handler' => AuthHandler::class,
],
// AuthService.RefreshToken
[
'method' => 'POST',
'path' => '/api/v1/auth/refresh',
'handler' => App\Application\Handlers\AuthHandler::class,
'handler' => AuthHandler::class,
],
// HomeService.Home
[
'method' => 'GET',
'path' => '/api/v1/home',
'handler' => App\Application\Handlers\HomeHandler::class,
]
'handler' => HomeHandler::class,
],
];
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ parameters:
- tests
- config
- public
scanDirectories:
- tools/protoc-php-gen/src
31 changes: 31 additions & 0 deletions src/Application/Handlers/AuthHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace App\Application\Handlers;

use App\Application\Http\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

/**
* Authentication handler stub.
* TODO: Implement actual authentication logic.
*/
final readonly class AuthHandler extends AbstractJsonHandler
{
public function __construct(
JsonResponse $jsonResponse,
) {
parent::__construct($jsonResponse);
}

/**
* @throws \JsonException
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
// TODO: Implement authentication endpoints (login, logout, refresh)
return $this->jsonResponse('{"error":"Not implemented"}', 501);
}
}
2 changes: 1 addition & 1 deletion src/Domain/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use ProtoPhpGen\Attributes\ProtoField;
use ProtoPhpGen\Attributes\ProtoMapping;

#[ProtoMapping(class: 'App\\Api\\V1\\User')]
#[ProtoMapping(class: 'App\Api\V1\User')]
final readonly class User implements Entity
{
public function __construct(
Expand Down