diff --git a/src/lambda/get-profile/index.py b/src/lambda/get-profile/index.py index 63009289b..d2d633ea1 100644 --- a/src/lambda/get-profile/index.py +++ b/src/lambda/get-profile/index.py @@ -12,6 +12,11 @@ def get_profile(uid): "uid").eq(uid), ScanIndexForward=True)["Items"] item = response[0] + + item.pop('uid', None) + item.pop('created_at', None) + item.pop('school_email', None) + item.pop('updated_at', None) body = JsonPayloadBuilder().add_status( True).add_data(item).add_message('').compile() diff --git a/src/lambda/post-application/index.py b/src/lambda/post-application/index.py index 3576ebdca..52a0d5ee1 100644 --- a/src/lambda/post-application/index.py +++ b/src/lambda/post-application/index.py @@ -18,18 +18,6 @@ def post_application(application, uid): dt_now = datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%f')[:-3] + 'Z' - application_data = { - "type": "application", - "created_at": dt_now, - "uid": uid, - "title": application["title"], - "job_id": application["job_id"], - "company": application["company"], - "email": application["email"], - "name": application["name"], - "agreed": application["agreed"], - } - ''' transact items, ensures that both operations succeed. If one fails the other automatically fails. @@ -41,20 +29,30 @@ def post_application(application, uid): { 'Put': { 'TableName': table_name, - 'Item': application_data + 'Item': { + "type": {"S": "application"}, + "created_at": {"S": dt_now}, + "uid": {"S": uid}, + "title": {"S": application["title"]}, + "job_id": {"S": application["job_id"]}, + "company": {"S": application["company"]}, + "email": {"S": application["email"]}, + "name": {"S": application["name"]}, + "agreed": {"BOOL": application["agreed"]}, + } } }, { 'Update': { 'TableName': table_name, 'Key': { - "type": "internship", - "created_at": application["created_at"], + "type": {"S": "internship"}, + "created_at": {"S": application["created_at"]}, }, 'UpdateExpression': 'ADD applicants :uid', 'ConditionExpression': 'attribute_not_exists(applicants) OR NOT contains(applicants, :uid)', 'ExpressionAttributeValues': { - ':uid': {uid} + ':uid': {"S": uid} } } }