-
Notifications
You must be signed in to change notification settings - Fork 0
/
seed-restaurants.js
62 lines (58 loc) · 1.59 KB
/
seed-restaurants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
'use strict';
const co = require('co');
const AWS = require('aws-sdk');
AWS.config.region = 'us-east-1';
const dynamodb = new AWS.DynamoDB.DocumentClient();
let restaurants = [
{
name: "Fangtasia",
image: "https://d2qt42rcwzspd6.cloudfront.net/manning/fangtasia.png",
themes: ["true blood"]
},
{
name: "Shoney's",
image: "https://d2qt42rcwzspd6.cloudfront.net/manning/shoney's.png",
themes: ["cartoon", "rick and morty"]
},
{
name: "Freddy's BBQ Joint",
image: "https://d2qt42rcwzspd6.cloudfront.net/manning/freddy's+bbq+joint.png",
themes: ["netflix", "house of cards"]
},
{
name: "Pizza Planet",
image: "https://d2qt42rcwzspd6.cloudfront.net/manning/pizza+planet.png",
themes: ["netflix", "toy story"]
},
{
name: "Leaky Cauldron",
image: "https://d2qt42rcwzspd6.cloudfront.net/manning/leaky+cauldron.png",
themes: ["movie", "harry potter"]
},
{
name: "Lil' Bits",
image: "https://d2qt42rcwzspd6.cloudfront.net/manning/lil+bits.png",
themes: ["cartoon", "rick and morty"]
},
{
name: "Fancy Eats",
image: "https://d2qt42rcwzspd6.cloudfront.net/manning/fancy+eats.png",
themes: ["cartoon", "rick and morty"]
},
{
name: "Don Cuco",
image: "https://d2qt42rcwzspd6.cloudfront.net/manning/don%20cuco.png",
themes: ["cartoon", "rick and morty"]
},
];
let putReqs = restaurants.map(x => ({
PutRequest: {
Item: x
}
}));
let req = {
RequestItems: {
'restaurants-dev': putReqs
}
};
dynamodb.batchWrite(req).promise().then(() => console.log("all done"));