add cancel schedule
This commit is contained in:
@@ -25,13 +25,13 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
now_ = now()
|
||||
# Key pattern `BILLING#ORG#{org_id}`
|
||||
*_, org_id = keys['id'].split('#')
|
||||
# Key pattern `START#{start_date}#END#{end_date}#SCHEDULE#AUTO_CLOSE`
|
||||
_, start_date, _, end_date, *_ = keys['sk'].split('#')
|
||||
# Key pattern `START#{start_period}#END#{end_period}#SCHEDULE#AUTO_CLOSE`
|
||||
_, start_period, _, end_period, *_ = keys['sk'].split('#')
|
||||
|
||||
result = order_layer.collection.query(
|
||||
KeyPair(
|
||||
pk=keys['id'],
|
||||
sk=f'START#{start_date}#END#{end_date}#ENROLLMENT',
|
||||
sk=f'START#{start_period}#END#{end_period}#ENROLLMENT',
|
||||
),
|
||||
limit=150,
|
||||
)
|
||||
@@ -40,8 +40,8 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
{
|
||||
'template_uri': BILLING_TEMPLATE_URI,
|
||||
'args': {
|
||||
'start_date': start_date,
|
||||
'end_date': end_date,
|
||||
'start_date': start_period,
|
||||
'end_date': end_period,
|
||||
'items': result['items'],
|
||||
},
|
||||
},
|
||||
@@ -56,7 +56,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
logger.info('The request timed out')
|
||||
raise
|
||||
|
||||
object_key = f'billing/{org_id}/{start_date}_{end_date}.pdf'
|
||||
object_key = f'billing/{org_id}/{start_period}_{end_period}.pdf'
|
||||
s3_uri = f's3://{BUCKET_NAME}/{object_key}'
|
||||
|
||||
try:
|
||||
@@ -74,7 +74,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
transact.update(
|
||||
key=KeyPair(
|
||||
pk=keys['id'],
|
||||
sk=f'START#{start_date}#END#{end_date}',
|
||||
sk=f'START#{start_period}#END#{end_period}',
|
||||
),
|
||||
update_expr='SET #status = :status, s3_uri = :s3_uri, \
|
||||
updated_at = :updated_at',
|
||||
|
||||
Reference in New Issue
Block a user