forked from zurichat/zc_plugin_deadlines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
54 lines (49 loc) · 1.44 KB
/
index.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
// eslint-disable-next-line import/no-unresolved
const faker = require('faker')
const axios = require('axios').default
// const environment = require('./src/config/environment/index')
// const { getDevBaseUrl, ORG_ID, PLUGIN_ID } = environment
// const BASE_URL = `${getDevBaseUrl()}/data`
// const readBaseUrl = `${BASE_URL}/read`
// const writeBaseUrl = `${BASE_URL}/write`
async function populateDB() {
// eslint-disable-next-line no-plusplus
for (let i = 0; i < 200; i++) {
const obj = {
plugin_id: 'zc_reminder',
organization_id: 'darwin_organization',
collection_name: 'reminders',
payload: {
title: faker.random.word(),
description: faker.random.words(),
assignees: faker.name.firstName(),
creator: faker.name.findName(),
startDate: faker.date.recent(),
dueDate: faker.date.soon(),
time: faker.time.recent(),
},
}
// eslint-disable-next-line no-await-in-loop
const res = await axios({
url: 'https://mock-dbapi.herokuapp.com/api/data/write',
method: 'post',
data: {
plugin_id: 'zc_reminder',
organization_id: 'darwin_organization',
collection_name: 'reminders',
payload: {
title: faker.random.word(),
description: faker.random.words(),
assignees: faker.name.firstName(),
creator: faker.name.findName(),
startDate: faker.date.recent(),
dueDate: faker.date.soon(),
time: faker.time.recent(),
},
// obj,
},
})
console.log(i)
}
}
populateDB()