From 9e5b769e2545597260495ea0ba7630e8fe829f58 Mon Sep 17 00:00:00 2001 From: Jack Stubblefield Date: Tue, 18 Oct 2022 19:25:33 -0500 Subject: [PATCH 1/2] email is being grabbed correctly, lambda function started for SES --- emailSolution/package.json | 12 ++++++++++++ emailSolution/ses_sendemail.js | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 emailSolution/package.json create mode 100644 emailSolution/ses_sendemail.js diff --git a/emailSolution/package.json b/emailSolution/package.json new file mode 100644 index 0000000..9f07011 --- /dev/null +++ b/emailSolution/package.json @@ -0,0 +1,12 @@ +{ + "name": "emailsolution", + "version": "1.0.0", + "description": "", + "main": "ses_sendemail.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/emailSolution/ses_sendemail.js b/emailSolution/ses_sendemail.js new file mode 100644 index 0000000..2aced53 --- /dev/null +++ b/emailSolution/ses_sendemail.js @@ -0,0 +1,35 @@ +exports.handler = async (event) => { + console.log('LOG NUMBER 1', event); + + const AWS = require('aws-sdk'); + AWS.config.update({region: 'us-east-2'}); + + // let params = { + // Destination: { + // ToAddresses: ['Jack011601@gmail.com'] + // }, + // Message: { + // Body: { + // Text: { + // Charset: 'UTF-8', + // Data: 'Test email' + // } + // } + // }, + // Source: 'Jack011601@gmail.com', + // }; + + let sendPromise = new AWS.SES({apiVersion: '2010-12-01'}).sendEmail(params).promise(); + + sendPromise + .then(data => console.log('JACKS LOG---------------------', data.MessageId)) + .catch(err => console.error(err, err.stack)); + + + + const response = { + statusCode: 200, + body: JSON.stringify('Hello from Lambda!'), + }; + return response; +}; From 5ca0df2bdfb6a98887b0b3fe24ae971b18261fae Mon Sep 17 00:00:00 2001 From: Jack Stubblefield Date: Thu, 20 Oct 2022 18:22:14 -0500 Subject: [PATCH 2/2] email functionality complete --- TechPrepDev | 1 + challenges.json | 44 ---------------------------------- emailSolution/package.json | 12 ---------- emailSolution/ses_sendemail.js | 35 --------------------------- 4 files changed, 1 insertion(+), 91 deletions(-) create mode 160000 TechPrepDev delete mode 100644 challenges.json delete mode 100644 emailSolution/package.json delete mode 100644 emailSolution/ses_sendemail.js diff --git a/TechPrepDev b/TechPrepDev new file mode 160000 index 0000000..499dd0b --- /dev/null +++ b/TechPrepDev @@ -0,0 +1 @@ +Subproject commit 499dd0b65161a3240a3f06dc7b9cfeea005f5520 diff --git a/challenges.json b/challenges.json deleted file mode 100644 index f8e6b88..0000000 --- a/challenges.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "challenges": [ - {"title": "Tree Sum", - "description": "Write a function to find the sum of all the odd numbers in a binary search tree.", - "hints": ["Try using a variable to store your output.", "Have you considered using a recursive function?"], - "solution": null, - }, - {"title": "Max Stack", - "description": "Write a max stack function that returns the largest element in a stack.", - "hints": ["You can assume all the values in the stack are numbers.", "Consider using another data structure like an array or linked list somehow."], - "solution": null, - }, - {"title": "Reverse Linked List", - "description": "Write a function that reverses a linked list.", - "hints": ["You could make a copy of the list, but try finding an in-place solution.", "Have you thought of using a few temporary reference variables?"], - "solution": null, - }, - {"title": "Linked List Palindrome", - "description": "Write a function to validate whether or not a linked list is a palindrome. Your return value should be a boolean.", - "hints": ["A palindrome is a word, phrase, number or sequence of nodes that reads the same backward as forward.", "Have you ever reversed a linked list? One possible solution might utilize this approach."], - "solution": null, - }, - {"title": "Tree Traversal", - "description": "Write a function that takes in a binary tree and log the value of each node within the tree.", - "hints": ["Have you considered using recursion?", "The order of the nodes doesn't matter."], - "solution": null, - }, - {"title": "Matrix Sum", - "description": "Write a function to add up the sum of each row in a matrix of arbitrary size, and return an array with the appropriate values.", - "hints": ["A matrix is an array of arrays.", "Assume all values will be integers and consider null to be zero."], - "solution": null, - }, - {"title": "Fibonacci", - "description": "Write a function that accepts an integer, and returns the nth number in the Fibonacci sequence.", - "hints": ["Your solution should probably use recursion or iteration with a while or for loop.", "The fibonacci sequence adds the previous two numbers together. The first seven numbers are 0, 1, 1, 2, 3, 5, and 8"], - "solution": null, - }, - {"title": "Binary Search", - "description": "Write a function called Binary Search which takes in 2 parameters: a sorted array and the search key. Without utilizing any of the built-in methods available to your language, return the index of the array’s element that is equal to the value of the search key, or -1 if the element is not in the array.", - "hints": ["Remember to use a binary search, not a sequential search.", "You should be comparing the search value to the middle element in the array."], - "solution": null, - } - ] -} \ No newline at end of file diff --git a/emailSolution/package.json b/emailSolution/package.json deleted file mode 100644 index 9f07011..0000000 --- a/emailSolution/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "emailsolution", - "version": "1.0.0", - "description": "", - "main": "ses_sendemail.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC" -} diff --git a/emailSolution/ses_sendemail.js b/emailSolution/ses_sendemail.js deleted file mode 100644 index 2aced53..0000000 --- a/emailSolution/ses_sendemail.js +++ /dev/null @@ -1,35 +0,0 @@ -exports.handler = async (event) => { - console.log('LOG NUMBER 1', event); - - const AWS = require('aws-sdk'); - AWS.config.update({region: 'us-east-2'}); - - // let params = { - // Destination: { - // ToAddresses: ['Jack011601@gmail.com'] - // }, - // Message: { - // Body: { - // Text: { - // Charset: 'UTF-8', - // Data: 'Test email' - // } - // } - // }, - // Source: 'Jack011601@gmail.com', - // }; - - let sendPromise = new AWS.SES({apiVersion: '2010-12-01'}).sendEmail(params).promise(); - - sendPromise - .then(data => console.log('JACKS LOG---------------------', data.MessageId)) - .catch(err => console.error(err, err.stack)); - - - - const response = { - statusCode: 200, - body: JSON.stringify('Hello from Lambda!'), - }; - return response; -};