in src/get_attachment/app.py [0:0]
def lambda_handler(event, context):
accepted_content_types = ['image/png', 'image/jpeg', 'application/jpeg', 'application/pdf', 'jpeg', 'png', 'pdf']
if event['detail']['ticket_event']['attachment']['content_type'] in accepted_content_types:
attachment_data = extract_attachment_data(event)
attachment_data['bucket_key'] = f"{attachment_data['file_name']}/{attachment_data['attachment_id']}"
upload_to_s3(attachment_data)
else:
return {
'accepted_file_type': False
}
return {
'accepted_file_type': True,
'attachment_data': attachment_data
}