-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.js
More file actions
21 lines (19 loc) · 694 Bytes
/
list.js
File metadata and controls
21 lines (19 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import * as dynamoDbLib from "./libs/dynamodb-lib";
import { success, failure } from "./libs/response-lib.js";
export async function main(event, context, callback){
// Request body is passed in as a JSON embedded string in 'event.body'
const params = {
TableName: "notes",
KeyConditionExpression: "userId = :userId",
ExpressionAttributeValues: {
":userId": event.requestContext.identity.cognitoIdentityId
}
};
try {
const result = await dynamoDbLib.call("query", params);
callback(null, success(result.Items));
} catch(e){
console.log(e);
callback(null, failure({status: false}));
}
}