This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# serverless.yml | |
service: step-functions | |
plugins: | |
- serverless-step-functions | |
- serverless-bundle | |
provider: | |
profile: medium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: step-functions | |
plugins: | |
- serverless-step-functions | |
- serverless-bundle | |
provider: | |
profile: medium | |
name: aws | |
runtime: nodejs12.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// email.js | |
"use-strict"; | |
export const congratulations = (event, context, callback) => { | |
callback( | |
null, | |
`Dear ${event.employeeDetails.employeeName}, Congrats! | |
We'd like to offer you the promotion to the role of ${event.employeeDetails.proposedRole}!"` | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# serverless.yml [truncated] | |
# ... | |
States: | |
ProposePromotion: | |
Type: Task | |
Resource: !GetAtt [proposePromotion, Arn] | |
ResultPath: "$.employeeDetails" | |
Next: GetManualReview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// handleDecisions.js | |
import handler from "./libs/handler-lib"; | |
import AWS from "aws-sdk"; | |
var stepfunctions = new AWS.StepFunctions(); | |
var client = new AWS.DynamoDB.DocumentClient(); | |
export const call = handler(async (event, context) => { | |
const body = JSON.parse(event.body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
font-family: Arial, Helvetica, sans-serif; | |
} | |
.container { | |
text-align: center; | |
} | |
.card-container { | |
display: grid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from "react"; | |
import { useToasts } from "react-toast-notifications"; | |
import { API } from "aws-amplify"; | |
import "./App.css"; | |
function App(props) { | |
const [promotionProposals, setPromotionProposals] = useState([]); | |
const [loading, setLoading] = useState(false); | |
const [refresh, setRefresh] = useState(new Date()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// index.js | |
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import App from "./App"; | |
import * as serviceWorker from "./serviceWorker"; | |
import Amplify from "aws-amplify"; | |
import { ToastProvider } from "react-toast-notifications"; | |
Amplify.configure({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// libs/handler-lib.js | |
export default function handler(lambda) { | |
return function (event, context) { | |
return Promise.resolve() | |
// Run the Lambda | |
.then(() => lambda(event, context)) | |
// On success | |
.then((responseBody) => [200, responseBody]) | |
// On failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// getPendingPromotions.js | |
import handler from "./libs/handler-lib"; | |
import AWS from "aws-sdk"; | |
const client = new AWS.DynamoDB.DocumentClient(); | |
export const call = handler(async (event, context) => { | |
const params = { | |
TableName: process.env.promotionsTable, |
NewerOlder