-
Notifications
You must be signed in to change notification settings - Fork 1
/
seeds.js
59 lines (53 loc) · 1.34 KB
/
seeds.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
const seeds = async () => {
try {
const resUser = await fetch("http://localhost:3000/accounts", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "john doe",
balance: 200,
}),
});
console.log("Seeding data");
resUser.ok
? console.log("User successful")
: console.log("User not created");
const resConfig = await fetch("http://localhost:3000/configs", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "million dollar baby321",
description: "Lots of money ba by312",
user : 11,
acquired: 100,
budget: 100,
activated: true,
}),
});
resConfig.ok
? console.log("Config successful")
: console.log("Config not created");
const resTxns = await fetch("http://127.0.0.1:3000/transactions", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
user: 11,
config: 1,
inputAmount: 100,
type: "BUY",
}),
});
resTxns.ok
? console.log("Transaction successful")
: console.log("Transaction not created");
} catch (error) {
console.log(error);
}
};
seeds();