Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"serverless-offline": "^6.8.0"
}
}
Binary file added sample-apps/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"id": "0a1670aa-ec49-45ba-9b17-1d135017f9dd",
"name": "Hot Stock Tracker Environment",
"values": [
{
"key": "API_URL",
"value": " https://api.hot-stock-checker.com",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2021-02-09T21:06:26.231Z",
"_postman_exported_using": "Postman/7.36.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const process: Handler = async (event: any, context: Context) => {
statusCode: 500,
body,
headers: {
"Access-Control-Allow-Origin" : "*", // Required for CORS support to work
"Access-Control-Allow-Credentials" : true, // Required for cookies, authorization headers with HTTPS
"Cache-Control": "no-cache" // No Cache
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './httpResponse';
export * from './IHttpResponse';
export * from './IStock';
export * from './stock';
export * from './StockMarket';
29 changes: 15 additions & 14 deletions sample-apps/robinhood-for-reddit/handlers/hotStock/types/stock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IStock } from './IStock';
import { v4 as uuid } from 'uuid';
import { IStock, StockMarket } from './';

export class Stock implements IStock {

Expand All @@ -14,21 +15,21 @@ export class Stock implements IStock {
public updatedAt: Date;
public value: number;

constructor(response: IHttpResponse) {
this.id = (response.id)
? response.id
constructor(stock: IStock) {
this.id = (stock.id)
? stock.id
:uuid();

this.bloombergTerminalUrl = response.bloombergTerminalUrl;
this.companyName = response.companyName;
this.companyUrl = response.companyUrl;
this.hasElonMuskTweetedAboutIt = response.hasElonMuskTweetedAboutIt;
this.isHot = response.isHot;
this.marketSymbol = response.marketSymbol;
this.redditMentions = response.redditMentions;
this.stockMarket = response.stockMarket;
this.updatedAt = response.updatedAt;
this.value = response.value;
this.bloombergTerminalUrl = stock.bloombergTerminalUrl;
this.companyName = stock.companyName;
this.companyUrl = stock.companyUrl;
this.hasElonMuskTweetedAboutIt = stock.hasElonMuskTweetedAboutIt;
this.isHot = stock.isHot;
this.marketSymbol = stock.marketSymbol;
this.redditMentions = stock.redditMentions;
this.stockMarket = stock.stockMarket;
this.updatedAt = stock.updatedAt;
this.value = stock.value;
}

}
7 changes: 4 additions & 3 deletions sample-apps/robinhood-for-reddit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"test": "mocha -r ts-node/register/transpile-only tests/setup.ts \"tests/handlers/**/*.test.ts\" --timeout 30000 --exit"
},
"dependencies": {
"@types/uuid": "^8.3.0",
"@types/uuid": "8.3.0",
"aws-sdk": "2.556.0",
"moment": "2.29.1",
"serverless-localstack": "^0.4.28",
"uuid": "^8.3.2"
"serverless-localstack": "0.4.28",
"uuid": "8.3.2"
},
"devDependencies": {
"@types/aws-lambda": "8.10.24",
Expand All @@ -18,6 +18,7 @@
"chai-shallow-deep-equal": "1.4.6",
"lambda-tester": "3.6.0",
"mocha": "5.2.0",
"serverless-offline": "6.8.0",
"serverless-plugin-typescript": "1.1.7",
"ts-node": "8.1.0",
"typescript": "3.6.4"
Expand Down
3 changes: 2 additions & 1 deletion sample-apps/robinhood-for-reddit/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ provider:
region: us-east-1
stage: dev
timeout: 30
versionFunctions: false
versionFunctions: true

custom:
localstack:
Expand All @@ -17,6 +17,7 @@ custom:
plugins:
- serverless-plugin-typescript
- serverless-localstack
- serverless-offline

functions:
# api gateway
Expand Down
Loading