diff --git a/serverless.yml b/serverless.yml index 194af8a..680e938 100644 --- a/serverless.yml +++ b/serverless.yml @@ -251,7 +251,12 @@ functions: - { Effect: Allow, Action: ['dynamodb:Query'], - Resource: 'arn:aws:dynamodb:us-east-2:547511976516:table/justifications', + Resource: 'arn:aws:dynamodb:us-east-2:547511976516:table/kovan-justifications', + } + - { + Effect: Allow, + Action: ['dynamodb:Query'], + Resource: 'arn:aws:dynamodb:us-east-2:547511976516:table/mainnet-justifications', } documentation: summary: 'Get justifications for a dispute round.' @@ -290,7 +295,12 @@ functions: - { Effect: Allow, Action: ['dynamodb:PutItem'], - Resource: 'arn:aws:dynamodb:us-east-2:547511976516:table/justifications', + Resource: 'arn:aws:dynamodb:us-east-2:547511976516:table/kovan-justifications', + } + - { + Effect: Allow, + Action: ['dynamodb:PutItem'], + Resource: 'arn:aws:dynamodb:us-east-2:547511976516:table/mainnet-justifications', } documentation: summary: 'Put justification for a vote.' diff --git a/src/court/justifications.js b/src/court/justifications.js index 6f1fe4b..8f2b363 100644 --- a/src/court/justifications.js +++ b/src/court/justifications.js @@ -17,7 +17,7 @@ module.exports.get = async (event, _context, callback) => { } }, KeyConditionExpression: 'disputeIDAndAppeal = :disputeIDAndAppeal', - TableName: 'justifications' + TableName: `${payload.network}-justifications` }) } }) @@ -96,7 +96,7 @@ module.exports.put = async (event, _context, callback) => { }, justification: { S: payload.justification.justification } }, - TableName: 'justifications' + TableName: `${payload.network}-justifications` }) callback(null, { statusCode: 200,