forked from drkstr101/coko-server-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (29 loc) · 747 Bytes
/
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
#!/usr/bin/env node
const { Collection, User } = require("@pubsweet/models");
const { setupDb } = require("@pubsweet/db-manager");
const config = require("config");
const seed = async () => {
console.log("Loaded Config:", config.util.toObject());
await setupDb({
username: "admin",
password: "password",
email: "[email protected]",
admin: true,
clobber: true,
});
const user = await new User({
username: "john",
email: "[email protected]",
password: "johnjohn",
}).save();
const collection = new Collection({
title: "My Blog",
owners: [user.id],
});
await collection.save();
console.info("Seeding complete.");
};
seed().catch((err) => {
console.trace(err);
process.exit(1);
});