|
| 1 | +import os |
| 2 | + |
| 3 | +from fastapi import FastAPI |
| 4 | +from mangum import Mangum |
| 5 | + |
| 6 | +from system_notification.application.send_notification_usecase.send_notification_usecase import ( |
| 7 | + SendNotificationUseCase, |
| 8 | +) |
| 9 | +from system_notification.config.config import SETTINGS |
| 10 | +from system_notification.domain.notification_factory_caller import ( |
| 11 | + NotificationFactoryCaller, |
| 12 | +) |
| 13 | +from system_notification.domain.notifications.factories.slack_notification_factory import ( |
| 14 | + SlackNotificationFactory, |
| 15 | +) |
| 16 | +from system_notification.infra.http.controller.health_check_controller import ( |
| 17 | + HealthCheckController, |
| 18 | +) |
| 19 | +from system_notification.infra.http.controller.send_notification_controller import ( |
| 20 | + SendNotificationController, |
| 21 | +) |
| 22 | +from system_notification.infra.http.server.fastapi_http_server import FastApiHttpServer |
| 23 | +from system_notification.infra.http.server.flask_http_server import FlaskHttpServer |
| 24 | +from tests.infra.http.controller.api_notification_serializer import ( |
| 25 | + ApiNotificationSerializer, |
| 26 | +) |
| 27 | + |
| 28 | +server = FastApiHttpServer(app=FastAPI(root_path=f"/{os.environ.get('STAGE', '')}")) |
| 29 | +# server = FlaskHttpServer() |
| 30 | +factory_caller = NotificationFactoryCaller() |
| 31 | +factory_caller.add_factory( |
| 32 | + SlackNotificationFactory(slack_token=SETTINGS.get("SLACK_API_TOKEN", "")) |
| 33 | +) |
| 34 | +uc = SendNotificationUseCase(factory_caller=factory_caller) |
| 35 | +send_notification_controller = SendNotificationController( |
| 36 | + http_server=server, |
| 37 | + send_notifcation_usecase=uc, |
| 38 | + serializer=ApiNotificationSerializer(), |
| 39 | +) |
| 40 | +health_check_controller = HealthCheckController( |
| 41 | + http_server=server, |
| 42 | +) |
| 43 | +handler = Mangum(server._app) |
| 44 | +if __name__ == "__main__": |
| 45 | + server.serve(port=5000) |
0 commit comments