Skip to content

stack-demo-ext-api out of sync with stack-demo-api #11

@biganth

Description

@biganth

I recently updated my api app to use the updated logic in the libs folder of the demo api but now I'm transitioning my app to the ext format to deploy on seed but the ext app hasn't been updated with the new logic.

Demo API Version

import AWS from "aws-sdk";
const client = new AWS.DynamoDB.DocumentClient();

export default {
  get   : (params) => client.get(params).promise(),
  put   : (params) => client.put(params).promise(),
  query : (params) => client.query(params).promise(),
  update: (params) => client.update(params).promise(),
  delete: (params) => client.delete(params).promise(),
};

EXT version

import AWS from "./aws-sdk";
import config from "../config";

const dynamoDb = new AWS.DynamoDB.DocumentClient();

export function call(action, params) {
  // Parameterize table names with stage name
  return dynamoDb[action]({
    ...params,
    TableName: `${config.resourcesStage}-${params.TableName}`
  }).promise();
}

Looks like we just need to spread the params into the table name stage.

get: (params) => client.get({
    ...params,
    TableName: `${config.resourcesStage}-${params.TableName}`
  }).promise()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions