add cancel schedule
This commit is contained in:
@@ -12,7 +12,7 @@ from boto3clients import dynamodb_client, s3_client, sesv2_client
|
||||
from config import EMAIL_SENDER, USER_TABLE
|
||||
|
||||
SUBJECT = (
|
||||
'Relatório de matrículas realizadas entre {start_date} e {end_date} na EDUSEG®'
|
||||
'Relatório de matrículas realizadas entre {start_period} e {end_period} na EDUSEG®'
|
||||
)
|
||||
REPLY_TO = ('Carolina Brand', 'carolina@somosbeta.com.br')
|
||||
BCC = [
|
||||
@@ -24,7 +24,7 @@ MESSAGE = """
|
||||
Oi, tudo bem?<br/><br/>
|
||||
|
||||
Em anexo você encontra o relatório das matrículas realizadas no período de
|
||||
<strong>{start_date}</strong> a <strong>{end_date}</strong>.<br/><br/>
|
||||
<strong>{start_period}</strong> a <strong>{end_period}</strong>.<br/><br/>
|
||||
|
||||
<a href="https://admin.saladeaula.digital/{org_id}/billing?start={start_query}&end={end_query}">
|
||||
📈 Clique aqui para ver mais detalhes do relatório
|
||||
@@ -43,8 +43,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
new_image = event.detail['new_image']
|
||||
# Key pattern `BILLING#ORG#{org_id}`
|
||||
*_, org_id = new_image['id'].split('#')
|
||||
# Key pattern `START#{start_date}#END#{end_date}
|
||||
_, start_date, _, end_date, *_ = new_image['sk'].split('#')
|
||||
# Key pattern `START#{start_period}#END#{v}
|
||||
_, start_period, _, end_period, *_ = new_image['sk'].split('#')
|
||||
|
||||
emailmsg = Message(
|
||||
from_=EMAIL_SENDER,
|
||||
@@ -52,24 +52,24 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
reply_to=REPLY_TO,
|
||||
bcc=BCC,
|
||||
subject=SUBJECT.format(
|
||||
start_date=_locale_dateformat(start_date),
|
||||
end_date=_locale_dateformat(end_date),
|
||||
start_period=_locale_dateformat(start_period),
|
||||
end_period=_locale_dateformat(end_period),
|
||||
),
|
||||
)
|
||||
emailmsg.add_alternative(
|
||||
MESSAGE.format(
|
||||
org_id=org_id,
|
||||
start_date=_locale_dateformat(start_date),
|
||||
end_date=_locale_dateformat(end_date),
|
||||
start_query=start_date,
|
||||
end_query=start_date,
|
||||
start_period=_locale_dateformat(start_period),
|
||||
end_period=_locale_dateformat(end_period),
|
||||
start_query=start_period,
|
||||
end_query=end_period,
|
||||
)
|
||||
)
|
||||
attachment = MIMEApplication(_get_file_bytes(new_image['s3_uri']))
|
||||
attachment.add_header(
|
||||
'Content-Disposition',
|
||||
'attachment',
|
||||
filename=f'{start_date}_{end_date}.pdf',
|
||||
filename=f'{start_period}_{end_period}.pdf',
|
||||
)
|
||||
emailmsg.attach(attachment)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user