forked from kriasoft/graphql-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[web] Add Privacy Policy and TOS pages (kriasoft#287)
- Loading branch information
Showing
12 changed files
with
598 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Imports reference (seed) data from the database. | ||
* | ||
* yarn db:import-seeds [--env #0] | ||
* | ||
* @copyright 2016-present Kriasoft (https://git.io/Jt7GM) | ||
*/ | ||
|
||
require("env"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const prettier = require("prettier"); | ||
const db = require("knex")(require("../knexfile")); | ||
|
||
function saveSync(filename, data) { | ||
fs.writeFileSync( | ||
path.resolve(__dirname, filename), | ||
prettier.format(JSON.stringify(data), { parser: "json" }), | ||
"utf-8", | ||
); | ||
} | ||
|
||
async function importData() { | ||
const users = await db.table("user").orderBy("created_at").select(); | ||
saveSync("../seeds/01_users.json", users); | ||
|
||
const identities = await db.table("identity").orderBy("created_at").select(); | ||
saveSync("../seeds/02_identities.json", identities); | ||
} | ||
|
||
importData() | ||
.finally(() => db.destroy()) | ||
.catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.