add user
This commit is contained in:
@@ -10,7 +10,7 @@ from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||
from boto3clients import dynamodb_client
|
||||
from config import API_URL, COURSE_TABLE
|
||||
|
||||
course_layer = DynamoDBPersistenceLayer(COURSE_TABLE, dynamodb_client)
|
||||
dyn = DynamoDBPersistenceLayer(COURSE_TABLE, dynamodb_client)
|
||||
|
||||
|
||||
@event_source(data_class=DynamoDBStreamEvent)
|
||||
@@ -21,7 +21,7 @@ def lambda_handler(event: DynamoDBStreamEvent, context: LambdaContext) -> bool:
|
||||
data = r.json()
|
||||
now_ = now()
|
||||
|
||||
with course_layer.transact_writer() as transact:
|
||||
with dyn.transact_writer() as transact:
|
||||
for course in data:
|
||||
transact.update(
|
||||
key=KeyPair(course['id'], '0'),
|
||||
@@ -14,7 +14,7 @@ Globals:
|
||||
Architectures:
|
||||
- x86_64
|
||||
Layers:
|
||||
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:83
|
||||
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:100
|
||||
Environment:
|
||||
Variables:
|
||||
TZ: America/Sao_Paulo
|
||||
@@ -28,19 +28,19 @@ Resources:
|
||||
EventLog:
|
||||
Type: AWS::Logs::LogGroup
|
||||
Properties:
|
||||
RetentionInDays: 90
|
||||
RetentionInDays: 7
|
||||
|
||||
EventDailySyncCourseMetadataFunction:
|
||||
EventCopyCourseMetadataScheduledFunction:
|
||||
Type: AWS::Serverless::Function
|
||||
Properties:
|
||||
Handler: events.daily_sync_course_metadata.lambda_handler
|
||||
Handler: events.copy_course_metadata.lambda_handler
|
||||
LoggingConfig:
|
||||
LogGroup: !Ref EventLog
|
||||
Policies:
|
||||
- DynamoDBWritePolicy:
|
||||
TableName: !Ref CourseTable
|
||||
Events:
|
||||
Rule:
|
||||
ScheduleEvent:
|
||||
Type: ScheduleV2
|
||||
Properties:
|
||||
ScheduleExpression: cron(0 0 * * ? *)
|
||||
|
||||
@@ -3,7 +3,7 @@ from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||
|
||||
|
||||
def test_daily_sync_course_metadata(
|
||||
def test_copy_course_metadata(
|
||||
dynamodb_client,
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
Reference in New Issue
Block a user