-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #821 from weni-ai/feature/send-user-email-update-p…
…roject update in project update with eda
- Loading branch information
Showing
5 changed files
with
31 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from django.conf import settings | ||
|
||
from connect.api.v1.internal.chats.chats_rest_client import ChatsRESTClient | ||
from connect.celery import app as celery_app | ||
from connect.common.models import Project | ||
from connect.internals.event_driven.producer.rabbitmq_publisher import RabbitmqPublisher | ||
|
||
class UpdateProjectUseCase: | ||
|
||
def __init__(self): | ||
self.rabbitmq_publisher = RabbitmqPublisher() | ||
|
||
def send_updated_project(self, project: Project, user_email: str): | ||
message_body = { | ||
"project_uuid": str(project.uuid), | ||
"description": project.description, | ||
"user_email": user_email | ||
} | ||
|
||
celery_app.send_task( | ||
"update_project", | ||
args=[project.uuid, project.name], | ||
) | ||
|
||
self.rabbitmq_publisher.send_message(message_body, exchange="update-projects.topic", routing_key="") |