diff --git a/app/views.py b/app/views.py index 81b7ed8..29ebf10 100644 --- a/app/views.py +++ b/app/views.py @@ -81,6 +81,10 @@ def update_dynamo_db_tables(ticket_response, form_elements_dict, desc_str, proje table_name = app.config['HIGH_SECURITY_STANDARD_STORAGE_REQUEST_INFO_TABLE'] app.logger.info(f"table_name:{table_name}") update_high_security_standard_storage_request_info_table(ticket_response, form_elements_dict, desc_str, project_ticket_route, table_name) + elif storage_choice == 'High-Security Research Project': + table_name = app.config['HIGH_SECURITY_PROJECT_STORAGE_REQUEST_INFO_TABLE'] + app.logger.info(f"table_name:{table_name}") + update_high_security_project_storage_request_info_table(ticket_response, form_elements_dict, desc_str, project_ticket_route, table_name) else: app.logger.info(f"Invalid storage choice: {storage_choice}. No updates performed.") else: @@ -235,6 +239,41 @@ def update_high_security_standard_storage_request_info_table(ticket_response, fo app.log_exception(e) print("Details: {e}") +def update_high_security_project_storage_request_info_table(ticket_response, form_elements_dict, desc_str, project_ticket_route, table_name): + try: + ticket_id = json.loads(ticket_response)['issueKey'] + today = datetime.datetime.now() + formatted_date = today.strftime("%Y-%m-%d %H:%M:%S") + fundingTypeData = updateFundingtype(form_elements_dict) + table_data = { + 'ticket_id': ticket_id, + 'date': formatted_date, + 'company': form_elements_dict.get('company-id', ''), + 'business_unit': form_elements_dict.get('business-unit', ''), + 'cost_center': form_elements_dict.get('cost-center', ''), + 'fund': form_elements_dict.get('fund', ''), + 'grant': fundingTypeData.get('grant', ''), + 'gift': fundingTypeData.get('gift', ''), + 'project': fundingTypeData.get('project', ''), + 'designated': fundingTypeData.get('designated', ''), + 'bill_amount': form_elements_dict.get('fdm-total', ''), + 'program': form_elements_dict.get('program', ''), + 'function': form_elements_dict.get('function', ''), + 'activity': form_elements_dict.get('activity', ''), + 'assignee': form_elements_dict.get('assignee', ''), + 'owner_name': form_elements_dict.get('name', ''), + 'owner_uid': form_elements_dict.get('uid', ''), + 'financial-contact': form_elements_dict.get('financial-contact', ''), + 'group_name': form_elements_dict.get('mygroup-ownership', ''), + 'share_name': form_elements_dict.get('shared-space-name', ''), + 'project_name': project_ticket_route[0], + 'descrition': desc_str + } + result = aws_service.insert_into_dynamodb(table_name, table_data) + except Exception as e: + app.log_exception(e) + print("Details: {e}") + def updateFundingtype(form_elements_dict): funding_type = form_elements_dict.get('funding-type', '') diff --git a/config/base.py b/config/base.py index 4448cf9..1e72976 100644 --- a/config/base.py +++ b/config/base.py @@ -47,7 +47,7 @@ def fetch_connections_info(): 'CHASE_GET_IT_HELP', 'ACCORD_SUPPORT_TECHNICAL_SUPPORT', 'DATA_ANALYTICS_CONSULTING', - 'ITHRIV_CONCIERGE_INQUIRY', + 'ITHRIV_CONCIERGE_INQUIRY' ) JIRA_PROJECT_INFO_LOOKUP = { @@ -88,7 +88,7 @@ def fetch_connections_info(): 'Accord Support': (JIRA_PROJECTS[5], JIRA_PROJECT_REQUEST_TYPES[5]), 'Data Analytics': (JIRA_PROJECTS[2], JIRA_PROJECT_REQUEST_TYPES[6]), 'Container': (JIRA_PROJECTS[2], JIRA_PROJECT_REQUEST_TYPES[2]), - 'Dedicated Resources': (JIRA_PROJECTS[0], JIRA_PROJECT_REQUEST_TYPES[0]), + 'Dedicated Resources': (JIRA_PROJECTS[0], JIRA_PROJECT_REQUEST_TYPES[0]) } # SMTP Email Settings @@ -136,6 +136,7 @@ def fetch_connections_info(): STANDARD_STORAGE_REQUEST_INFO_TABLE = 'jira_standard_storage_requests_info_dev' PROJECT_STORAGE_REQUEST_INFO_TABLE = 'jira_project_storage_requests_info_dev' HIGH_SECURITY_STANDARD_STORAGE_REQUEST_INFO_TABLE = 'jira_high_security_standard_storage_requests_info_dev' + HIGH_SECURITY_PROJECT_STORAGE_REQUEST_INFO_TABLE = 'jira_high_security_project_storage_requests_info_dev' PAID_SU_REQUESTS_INFO_TABLE = 'jira_paid_su_requests_info_dev' CUSTOMFIELD_VALUES = ('customfield_13076', 'customfield_13096', 'customfield_13090') @@ -180,6 +181,7 @@ def fetch_connections_info(): STANDARD_STORAGE_REQUEST_INFO_TABLE = 'jira_standard_storage_requests_info' PROJECT_STORAGE_REQUEST_INFO_TABLE = 'jira_project_storage_requests_info' HIGH_SECURITY_STANDARD_STORAGE_REQUEST_INFO_TABLE = 'jira_high_security_standard_storage_requests_info' + HIGH_SECURITY_PROJECT_STORAGE_REQUEST_INFO_TABLE = 'jira_high_security_project_storage_requests_info' PAID_SU_REQUESTS_INFO_TABLE = 'jira_paid_su_requests_info' KONAMI_ENPOINT_DEFAULT_SENDER = 'nem2p@virginia.edu'