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
12 changes: 11 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: setup start stop reset logs clean test lint help update
.PHONY: setup start stop reset logs clean test lint help update db-user db-order rabbit-listen

## Update dependencies in all services
update:
Expand Down Expand Up @@ -29,6 +29,11 @@ setup:
start:
@echo "🐳 Starting all services..."
docker-compose up -d --build
@docker-compose exec -d notification-service php bin/console messenger:consume async

## run listener
rabbit-listen:
@docker-compose exec notification-service php bin/console messenger:consume async

## Stop all services
stop:
Expand Down Expand Up @@ -91,6 +96,11 @@ composer-update:
@docker compose exec $(service) composer update --no-interaction --prefer-dist --optimize-autoloader
@echo "✅ Dependencies updated for $(service)."

db-user:
@docker compose exec user-db psql -U app -d user_service
db-order:
@docker compose exec order-db psql -U app -d order_service


## Show this help
help:
Expand Down
2 changes: 2 additions & 0 deletions services/notification-service/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
"ext-ctype": "*",
"ext-iconv": "*",
"microservices/shared-contracts": "1.*",
"monolog/monolog": "*",
"symfony/amqp-messenger": "7.3.*",
"symfony/console": "7.3.*",
"symfony/dotenv": "7.3.*",
"symfony/flex": "^2.8.2",
"symfony/framework-bundle": "7.3.*",
"symfony/messenger": "7.3.*",
"symfony/monolog-bundle": "^3.10",
"symfony/runtime": "7.3.*",
"symfony/yaml": "7.3.*"
},
Expand Down
1 change: 1 addition & 0 deletions services/notification-service/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
];
28 changes: 28 additions & 0 deletions services/notification-service/config/packages/monolog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
monolog:
channels:
- messenger

handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!messenger"]

nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug

console:
type: console
process_psr_3_messages: false
channels: ["!messenger", "!event"]

# Логи Messenger в отдельный файл
messenger:
type: stream
path: "%kernel.logs_dir%/messenger.%kernel.environment%.log"
level: debug
channels: [messenger]
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class HealthController extends AbstractController
public function health(): JsonResponse
{
return $this->json([
'status' => 'error',
'message' => 'test 500 status code'
], 500);
'status' => 'success',
'message' => 'is running'
], 200);
}
}
24 changes: 0 additions & 24 deletions services/notification-service/src/Controller/LuckyController.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,12 @@ private function sendWelcomeEmail(string $email, string $firstName, string $last
// Имитация отправки email
$this->logger->info("📧 Sending welcome email to: {$email}");
$this->logger->info("👋 Dear {$firstName} {$lastName}, welcome to our platform!");

// Заглушка для реальной отправки email
// sleep(1);
}

private function sendPushNotification(string $userId, string $firstName): void
{
// Имитация отправки push-уведомления
$this->logger->info("📱 Sending push notification to user: {$userId}");
$this->logger->info("🔔 Welcome {$firstName}! Your account has been created successfully.");

// Заглушка для реальной отправки push
// sleep(1);
}
}
12 changes: 12 additions & 0 deletions services/notification-service/symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@
"config/packages/messenger.yaml"
]
},
"symfony/monolog-bundle": {
"version": "3.10",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.7",
"ref": "aff23899c4440dd995907613c1dd709b6f59503f"
},
"files": [
"config/packages/monolog.yaml"
]
},
"symfony/routing": {
"version": "7.3",
"recipe": {
Expand Down
13 changes: 13 additions & 0 deletions services/user-service/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,32 @@
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/doctrine-orm": "^4.2",
"api-platform/symfony": "^4.2",
"doctrine/dbal": "^3",
"doctrine/doctrine-bundle": "^2.18",
"doctrine/doctrine-migrations-bundle": "^3.5",
"doctrine/orm": "^3.5",
"microservices/shared-contracts": "1.*",
"nelmio/cors-bundle": "^2.5",
"php-amqplib/php-amqplib": "^2.0",
"phpdocumentor/reflection-docblock": "^5.6",
"phpstan/phpdoc-parser": "^2.3",
"symfony/amqp-messenger": "7.3.*",
"symfony/asset": "7.3.*",
"symfony/console": "7.3.*",
"symfony/dotenv": "7.3.*",
"symfony/expression-language": "7.3.*",
"symfony/flex": "^2.8.2",
"symfony/framework-bundle": "7.3.*",
"symfony/messenger": "7.3.*",
"symfony/property-access": "7.3.*",
"symfony/property-info": "7.3.*",
"symfony/runtime": "7.3.*",
"symfony/security-bundle": "7.3.*",
"symfony/serializer": "7.3.*",
"symfony/twig-bundle": "7.3.*",
"symfony/validator": "7.3.*",
"symfony/yaml": "7.3.*"
},
"require-dev": {
Expand Down
3 changes: 3 additions & 0 deletions services/user-service/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
];
7 changes: 7 additions & 0 deletions services/user-service/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
api_platform:
title: Hello API Platform
version: 1.0.0
defaults:
stateless: true
cache_headers:
vary: ['Content-Type', 'Authorization', 'Origin']
10 changes: 10 additions & 0 deletions services/user-service/config/packages/nelmio_cors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
expose_headers: ['Link']
max_age: 3600
paths:
'^/': null
6 changes: 6 additions & 0 deletions services/user-service/config/packages/twig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
twig:
file_name_pattern: '*.twig'

when@test:
twig:
strict_variables: true
11 changes: 11 additions & 0 deletions services/user-service/config/packages/validator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
framework:
validation:
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []

when@test:
framework:
validation:
not_compromised_password: false
4 changes: 4 additions & 0 deletions services/user-service/config/routes/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
api_platform:
resource: .
type: api_platform
prefix: /api
5 changes: 5 additions & 0 deletions services/user-service/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ services:

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

App\State\UserPasswordHasher:
bind:
$processor: '@api_platform.doctrine.orm.state.persist_processor'
tags: [ 'api_platform.state_processor' ]
Empty file.
26 changes: 0 additions & 26 deletions services/user-service/src/Controller/BaseController.php

This file was deleted.

112 changes: 0 additions & 112 deletions services/user-service/src/Controller/UserController.php

This file was deleted.

Loading
Loading