Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
227714a
feat(doges-on-trial): start integration
epiqueras Jul 2, 2018
853643c
feat(doges-on-trial): connect with s3
epiqueras Jul 4, 2018
0086f6e
feat(serverless): shorten role name
epiqueras Jul 4, 2018
a4db92e
feat(doges-on-trial): finish back end implementation
epiqueras Jul 5, 2018
b79bc1e
feat(doges-on-trial): update structure
epiqueras Jul 6, 2018
54c22ad
feat(doges-on-trial): add cors
epiqueras Jul 6, 2018
c00b670
feat: new arbitrable permission list
epiqueras Jul 16, 2018
4740d0a
feat(doges-on-trial): new arbitrable permission list
epiqueras Jul 25, 2018
e10c455
feat(user-settings): set up
epiqueras Jul 25, 2018
7212f05
feat(user-settings): implement patch
epiqueras Jul 25, 2018
c3ba4d5
fix(user-settings): syntax errors
epiqueras Jul 25, 2018
d732810
feat(doges-on-trial): new max size
epiqueras Jul 25, 2018
fa5945e
feat(doges-on-trial): server side validate min image dimensions
epiqueras Jul 25, 2018
2a85d7b
feat: new contract
epiqueras Jul 25, 2018
2626e11
feat: new contract
epiqueras Jul 26, 2018
7f55841
feat: new production contract
epiqueras Jul 30, 2018
d0d62bc
feat: new contract
epiqueras Jul 30, 2018
d8c0a87
feat: new contracts
epiqueras Jul 30, 2018
198cb3e
feat: new contract
epiqueras Jul 30, 2018
5f54144
feat: new contract
epiqueras Jul 30, 2018
90df689
feat: new contract
epiqueras Jul 30, 2018
d43abb1
feat(env): roll back list address
epiqueras Jul 31, 2018
5c289ca
feat(env): new arbitrable permission list
epiqueras Jul 31, 2018
7e95e3f
feat(env): new arbitrable permission list
epiqueras Jul 31, 2018
b8ec6d9
fix: clement's upload suggestions
epiqueras Aug 1, 2018
90f459a
feat(doges-on-trial): block image uploads for already registered images
epiqueras Sep 19, 2018
0ee09e2
feat(doges-on-trial): only block after now
epiqueras Sep 19, 2018
23f4ee6
feat(cfs): add model
epiqueras Sep 19, 2018
fea86c7
feat(cfs): add handler
epiqueras Sep 19, 2018
f59c0d5
feat(cfs): implement code
epiqueras Sep 19, 2018
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
Prev Previous commit
Next Next commit
feat(user-settings): set up
  • Loading branch information
epiqueras committed Jul 25, 2018
commit e10c4557b4772a08a387f9039e15bbe7a892f977
17 changes: 17 additions & 0 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,26 @@ custom:
- {path: doges-on-trial, description: 'Microservices for the Doges on Trial dapp.'}
models:
- {name: ErrorResponse, description: 'An error response.', contentType: application/json, schema: '${file(src/models/error.json)}'}
- {name: PatchUserSettingsRequest, description: 'The request for patchUserSettings.', contentType: application/json, schema: '${file(src/global/models/user-settings.json):patch.request}'}
- {name: PatchUserSettingsResponse, description: 'The response for patchUserSettings.', contentType: application/json, schema: '${file(src/global/models/user-settings.json):patch.response}'}
- {name: PostDogesOnTrialDogeImagesRequest, description: 'The request for postDogesOnTrialDogeImages.', contentType: application/json, schema: '${file(src/doges-on-trial/models/doge-images.json):post.request}'}
- {name: PostDogesOnTrialDogeImagesResponse, description: 'The response for postDogesOnTrialDogeImages.', contentType: application/json, schema: '${file(src/doges-on-trial/models/doge-images.json):post.response}'}
functions:
patchUserSettings:
handler: src/global/user-settings.patch
events:
- {http: {path: user-settings, method: patch, cors: true}}
environment:
INFURA_URL: '${self:custom.kmsSecrets.secrets.${self:custom.environments.${self:provider.stage}}_INFURA_URL}'
iamRoleStatementsName: 'patchUserSettings-${self:provider.stage}-lambda-role'
iamRoleStatements:
- {Effect: Allow, Action: ['KMS:Decrypt'], Resource: '${self:custom.kmsSecrets.keyArn}'}
- {Effect: Allow, Action: ['dynamodb:UpdateItem'], Resource: 'arn:aws:dynamodb:us-east-2:547511976516:table/user-settings'}
documentation:
summary: 'Update user settings.'
description: 'Update user settings for an Ethereum address.'
requestModels: {application/json: PatchUserSettingsRequest}
methodResponses: [{statusCode: '200', responseModels: {application/json: PatchUserSettingsResponse}}, {statusCode: '400', responseModels: {application/json: ErrorResponse}}]
postDogesOnTrialDogeImages:
handler: src/doges-on-trial/doge-images.post
events:
Expand Down
40 changes: 40 additions & 0 deletions src/global/models/user-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"patch": {
"request": {
"type": "object",
"properties": {
"payload": {
"type": "object",
"properties": {
"address": {
"type": "string",
"description": "The address to update settings for."
},
"settings": {
"type": "object",
"description": "The settings update."
},
"signature": {
"type": "string",
"description": "The signed settings update object."
}
}
}
}
},
"response": {
"type": "object",
"properties": {
"payload": {
"type": "object",
"properties": {
"settings": {
"type": "object",
"description": "The updated settings object."
}
}
}
}
}
}
}
Empty file added src/global/user-settings.js
Empty file.
9 changes: 9 additions & 0 deletions src/utils/dynamo-db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { promisify } = require('util')

const { DynamoDB } = require('aws-sdk')

const dynamoDB = new DynamoDB({ apiVersion: '2012-08-10', region: 'us-east-2' })
dynamoDB.getItem = promisify(dynamoDB.getItem)
dynamoDB.putItem = promisify(dynamoDB.putItem)

export default dynamoDB