add events

This commit is contained in:
2025-08-21 22:18:37 -03:00
parent c70a74b94a
commit 3ab20c485b
19 changed files with 315 additions and 164 deletions

View File

@@ -140,6 +140,32 @@ Resources:
scope: [SINGLE_USER]
status: [PENDING]
EventReenrollIfFailedFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.reenroll_if_failed.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref EnrollmentTable
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref EnrollmentTable]
detail-type: [MODIFY]
detail:
changes: [status]
new_image:
sk: ["0"]
status: [FAILED]
score:
- numeric: ["<", 70]
old_image:
status: [IN_PROGRESS]
EventAllocateSlotsFunction:
Type: AWS::Serverless::Function
Properties:
@@ -182,6 +208,7 @@ Resources:
- !Sub arn:aws:ses:${AWS::Region}:${AWS::AccountId}:identity/eduseg.com.br
- !Sub arn:aws:ses:${AWS::Region}:${AWS::AccountId}:configuration-set/tracking
# If the user does not access the course within 3 days after enrollment creation
EventReminderNoAccessAfter3DaysFunction:
Type: AWS::Serverless::Function
Properties:
@@ -204,10 +231,11 @@ Resources:
sk:
- SCHEDULE#REMINDER_NO_ACCESS_AFTER_3_DAYS
# Post-migration: remove the following lines
- SCHEDULES#REMINDER_NO_ACCESS_AFTER_3_DAYS
- schedules#does_not_access
- schedules#reminder_no_access_3_days
- SCHEDULES#REMINDER_NO_ACCESS_AFTER_3_DAYS
# 7 days after the user's last activity in the course
EventReminderNoActivityAfter7DaysFunction:
Type: AWS::Serverless::Function
Properties:
@@ -229,6 +257,58 @@ Resources:
keys:
sk:
- SCHEDULE#REMINDER_NO_ACTIVITY_AFTER_7_DAYS
# Post-migration: remove the following line
- schedules#no_activity
# 30 days before the course access period ends.
EventReminderAccessPeriodBefore30DaysFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.emails.reminder_access_period_before_30_days.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- !Ref SesPolicy
- DynamoDBCrudPolicy:
TableName: !Ref EnrollmentTable
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref EnrollmentTable]
detail-type: [EXPIRE]
detail:
keys:
sk:
- SCHEDULE#REMINDER_CERT_EXPIRATION_BEFORE_30_DAYS
# Post-migration: remove the following line
- schedules#access_period_ends
# If a certificate exists, remind the user 30 days before the certificate expires
EventReminderCertExpirationBefore30DaysFunction:
Type: AWS::Serverless::Function
Properties:
Handler: events.emails.reminder_cert_expiration_before_30_days.lambda_handler
LoggingConfig:
LogGroup: !Ref EventLog
Policies:
- !Ref SesPolicy
- DynamoDBCrudPolicy:
TableName: !Ref EnrollmentTable
Events:
DynamoDBEvent:
Type: EventBridgeRule
Properties:
Pattern:
resources: [!Ref EnrollmentTable]
detail-type: [EXPIRE]
detail:
keys:
sk:
- SCHEDULE#REMINDER_CERT_EXPIRATION_BEFORE_30_DAYS
# Post-migration: remove the following line
- schedules#expiration
EventScheduleRemindersFunction:
Type: AWS::Serverless::Function