This commit is contained in:
2025-07-01 17:45:17 -03:00
parent d50d828029
commit a9f6a89d54
10 changed files with 337 additions and 28 deletions

View File

@@ -20,7 +20,7 @@ Globals:
Architectures:
- x86_64
Layers:
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:72
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:78
Environment:
Variables:
TZ: America/Sao_Paulo
@@ -30,6 +30,7 @@ Globals:
POWERTOOLS_LOGGER_LOG_EVENT: true
USER_TABLE: !Ref UserTable
ORDER_TABLE: !Ref OrderTable
ENROLLMENT_TABLE: !Ref EnrollmentTable
Resources:
EventLog:
@@ -89,6 +90,31 @@ Resources:
metadata__tenant_id:
- exists: false
EventRemoveSlotsOnCanceledFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.delete_slots_on_canceled.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- DynamoDBWritePolicy:
TableName: !Ref OrderTable
- DynamoDBWritePolicy:
TableName: !Ref EnrollmentTable
Events:
Event:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref OrderTable]
detail-type: [MODIFY]
detail:
new_image:
sk: ["0"]
cnpj:
- exists: true
status: [CANCELED, EXPIRED]
EventSetAsPaidFunction:
Type: AWS::Serverless::Function
Properties:
@@ -113,3 +139,27 @@ Resources:
total: [0]
status: [CREATING, PENDING]
payment_method: [MANUAL]
EventRemoveSlotsFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.stopgap.remove_slots.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- DynamoDBReadPolicy:
TableName: !Ref UserTable
- DynamoDBReadPolicy:
TableName: !Ref OrderTable
- DynamoDBCrudPolicy:
TableName: !Ref EnrollmentTable
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref OrderTable]
detail:
new_image:
sk: [generated_items]
status: [SUCCESS]