add fallback to id

This commit is contained in:
2025-12-03 13:31:28 -03:00
parent af45be7083
commit 1b4cbbce6c
8 changed files with 112 additions and 33 deletions

View File

@@ -32,7 +32,7 @@ Globals:
ENROLLMENT_TABLE: !Ref EnrollmentTable
COURSE_TABLE: !Ref CourseTable
KONVIVA_API_URL: https://lms.saladeaula.digital
KONVIVA_SECRET_KEY: "{{resolve:ssm:/betaeducacao/konviva/secret_key/str}}"
KONVIVA_SECRET_KEY: '{{resolve:ssm:/betaeducacao/konviva/secret_key/str}}'
Resources:
EventLog:
@@ -49,7 +49,7 @@ Resources:
Type: AWS::Serverless::HttpApi
Properties:
CorsConfiguration:
AllowOrigins: ["*"]
AllowOrigins: ['*']
AllowMethods: [POST, OPTIONS]
AllowHeaders: [Content-Type, X-Requested-With]
@@ -90,12 +90,34 @@ Resources:
detail-type: [INSERT]
detail:
new_image:
sk: ["0"]
sk: ['0']
cnpj:
- exists: false
metadata__konviva_user_id:
- exists: false
EventCreateOrgFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.create_org.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- DynamoDBWritePolicy:
TableName: !Ref UserTable
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref UserTable]
detail-type: [INSERT]
detail:
new_image:
sk: ['0']
cnpj:
- exists: true
EventUpdateUserFunction:
Type: AWS::Serverless::Function
Properties:
@@ -114,7 +136,7 @@ Resources:
detail-type: [MODIFY]
detail:
new_image:
sk: ["0"]
sk: ['0']
metadata__konviva_user_id:
- exists: true
changes: [name, email, cpf]
@@ -159,7 +181,7 @@ Resources:
detail-type: [MODIFY]
detail:
new_image:
sk: ["0"]
sk: ['0']
status: [CANCELED]
old_image:
status: [PENDING]