Skip to content

Commit

Permalink
[Docs] : lambda_function 제목 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeon-chae authored Jul 31, 2024
1 parent 1db912d commit 8dd8f9b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lambda_functionv2.py → lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def lambda_handler(event, context):
bucket_name = record['s3']['bucket']['name']
object_key = unquote_plus(record['s3']['object']['key'])

# object_key에서 file_name과 user_id 추출
file_name, user_id = object_key.split('/', 1)

try:
Expand All @@ -24,7 +23,6 @@ def lambda_handler(event, context):
last_modified = response['LastModified']
created_at = last_modified.isoformat()

# DynamoDB 항목 삽입 또는 업데이트
try:
table.update_item(
Key={
Expand All @@ -35,7 +33,7 @@ def lambda_handler(event, context):
ExpressionAttributeValues={
':created_at': created_at,
':content_length': content_length,
':file_size': content_length, # Assuming file_size is the same as content_length
':file_size': content_length,
':file_type': content_type
},
ConditionExpression="attribute_exists(file_name) AND attribute_exists(user_id)",
Expand All @@ -50,7 +48,7 @@ def lambda_handler(event, context):
'user_id': user_id,
'created_at': created_at,
'file_content_length': content_length,
'file_size': content_length, # Assuming file_size is the same as content_length
'file_size': content_length,
'file_type': content_type
}
)
Expand Down

0 comments on commit 8dd8f9b

Please sign in to comment.