Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Servicio infrastructura #258

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
namespace CodelyTv\Apps\Mooc\Backend\Controller\Courses;

use CodelyTv\Mooc\Courses\Application\Create\CreateCourseCommand;
use CodelyTv\Shared\Infrastructure\Logger\MonologLogger;
use CodelyTv\Shared\Infrastructure\Symfony\ApiController;
use Monolog\Logger;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

final class CoursesPutController extends ApiController
{
public function __invoke(string $id, Request $request): Response



public function __invoke(string $id, Request $request, Logger $logger): Response
{
$this->dispatch(
new CreateCourseCommand(
Expand All @@ -21,6 +26,9 @@ public function __invoke(string $id, Request $request): Response
)
);

$loggerMessage = new MonologLogger($logger);
$loggerMessage->info('Created Course: '.$request->request->getAlpha('name'), 'info');

return new Response('', Response::HTTP_CREATED);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ services:
public: true


monolog:
handlers:
actions_log:
type: info
path: "%kernel.logs_dir%/%kernel.environment%_actions.log"

# Courses
CodelyTv\Mooc\Courses\Domain\CourseRepository: '@CodelyTv\Mooc\Courses\Infrastructure\Persistence\DoctrineCourseRepository'