Skip to content

Commit

Permalink
WIP: Working on enabling the sendgrid mail service.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud-Emad committed Feb 7, 2024
1 parent b169797 commit b2ea45c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server/cshr/views/vacations.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from cshr.utils.email_messages_templates import (
# get_vacation_request_email_template,
get_vacation_reply_email_template,
get_vacation_request_email_template,
)

# from cshr.celery.send_email import send_email_for_request
Expand Down Expand Up @@ -295,9 +296,9 @@ def post(self, request: Request) -> Response:
actual_days=vacation_days,
)

# msg = get_vacation_request_email_template(
# request.user, serializer.data, saved.id
# )
msg = get_vacation_request_email_template(
request.user, serializer.data, saved.id
)

try:
ping_redis()
Expand All @@ -306,9 +307,9 @@ def post(self, request: Request) -> Response:

set_notification_request_redis(serializer.data)

# sent = send_email_for_request(request.user.id, msg, "Vacation request")
# if not sent:
# return CustomResponse.bad_request(message="Error in sending email, can not sent email with this request.")
sent = send_email_for_request(request.user.id, msg, "Vacation request")
if not sent:
return CustomResponse.bad_request(message="Error in sending email, can not sent email with this request.")

response_date: Dict = send_vacation_to_calendar(saved)
return CustomResponse.success(
Expand Down Expand Up @@ -489,6 +490,7 @@ def put(self, request: Request, id: str, format=None) -> Response:

vacation.save()
event_id = id

try:
ping_redis()
except:
Expand Down

0 comments on commit b2ea45c

Please sign in to comment.