Merge branch 'master' into dependabot/docker/neo4j-3.5.0

This commit is contained in:
Grzegorz Leoniec 2018-12-05 00:35:32 +01:00 committed by GitHub
commit ee911b46f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 689 additions and 97 deletions

18
.eslintrc.js Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
"extends": "standard",
"parser": "babel-eslint",
"env": {
"es6": true,
"node": true,
},
"rules": {
"indent": [
"error",
2
],
"quotes": [
"error",
"single"
]
}
};

View File

@ -1,24 +1,28 @@
language: node_js language: node_js
node_js: node_js:
- "10" - "10"
services:
- docker
cache: cache:
yarn: true yarn: true
directories: directories:
- node_modules - node_modules
services:
- docker
- neo4j
install: install:
- docker build --build-arg BUILD_COMMIT=$TRAVIS_COMMIT -t humanconnection/nitro-backend . - yarn install
- docker build --build-arg BUILD_COMMIT=$TRAVIS_COMMIT -t humanconnection/nitro-backend:latest .
- cp .env.template .env
script: script:
# TODO: re-add when testing is setup properly - docker run humanconnection/nitro-backend:latest yarn run eslint
# - docker run humanconnection/nitro-backend yarn run db:seed - yarn run db:reset
- yarn run db:seed
after_success: after_success:
# - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
# - chmod +x send.sh - chmod +x send.sh
# - ./send.sh success $WEBHOOK_URL - ./send.sh success $WEBHOOK_URL
- if [ $TRAVIS_BRANCH == "master" ] && [ $TRAVIS_EVENT_TYPE == "push" ]; then - if [ $TRAVIS_BRANCH == "master" ] && [ $TRAVIS_EVENT_TYPE == "push" ]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
docker tag humanconnection/nitro-backend humanconnection/nitro-backend:latest; docker tag humanconnection/nitro-backend humanconnection/nitro-backend:latest;

View File

@ -92,14 +92,14 @@ run Neo4j in one of the [many cloud options](https://neo4j.com/developer/guide-c
[spin up Neo4j in a Docker container](https://neo4j.com/developer/docker/) or on Debian-based systems install [Neo4j from the Debian Repository](http://debian.neo4j.org/). [spin up Neo4j in a Docker container](https://neo4j.com/developer/docker/) or on Debian-based systems install [Neo4j from the Debian Repository](http://debian.neo4j.org/).
Just be sure to update the Neo4j connection string and credentials accordingly in `.env`. Just be sure to update the Neo4j connection string and credentials accordingly in `.env`.
## Mocking API Results ## Mock API Results
Alternatively you can just mock all responses from the api which let Alternatively you can just mock all responses from the api which let
you build a frontend application without running a neo4j instance. you build a frontend application without running a neo4j instance.
Just set `MOCK=true` inside `.env` or pass it on application start. Just set `MOCK=true` inside `.env` or pass it on application start.
## Seeding The Database ## Seed and Reset the Database
Optionally you can seed the GraphQL service by executing mutations that Optionally you can seed the GraphQL service by executing mutations that
will write sample data to the database: will write sample data to the database:
@ -110,6 +110,14 @@ yarn db:seed
npm run db:seed npm run db:seed
``` ```
For a reset you can use the reset script:
```bash
yarn db:reset
# -or-
npm run db:reset
```
## Todo`s ## Todo`s
- [x] add jwt authentication - [x] add jwt authentication

View File

@ -4,8 +4,8 @@ services:
backend: backend:
container_name: backend.127.0.0.1.xip.io container_name: backend.127.0.0.1.xip.io
volumes: volumes:
- .:/backend - .:/nitro-backend
- /backend/node_modules - /nitro-backend/node_modules
neo4j: neo4j:
ports: ports:
- 7687:7687 - 7687:7687

View File

@ -6,14 +6,15 @@ First of all start minikube on your machine:
```sh ```sh
minikube start minikube start
``` ```
[troubleshoot] If you get an error message along th lines of 'The vboxdrv kernel module is not loaded.' - then you have the same issue i had. to solve this you need to install the propper linux kernel host modules package. Here an example for Manjaro: **[troubleshoot]** If you get an error message along th lines of 'The vboxdrv kernel module is not loaded.' - then you have the same issue i had. to solve this you need to install the propper linux kernel host modules package. Here an example for Manjaro:
https://forum.manjaro.org/t/installing-virtualbox-kernel-modules/6999 https://forum.manjaro.org/t/installing-virtualbox-kernel-modules/6999
**[troubleshoot]** When you can not start minikube, try also to remove the cluster with `minikube delete` and start again with `minikube start`. Sometimes this fix startup problems of the cluster.
You can always get an overview and see what's going on with your minikube: You can always get an overview and see what's going on with your minikube:
```sh ```sh
minikube dashboard minikube dashboard
``` ```
[troubleshoot] now again you might run into trouble with an error like 'kubectl could not be found on your path.' In this case run the following command: **[troubleshoot]** now again you might run into trouble with an error like 'kubectl could not be found on your path.' In this case run the following command:
```sh ```sh
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo cp kubectl /usr/local/bin/ && rm kubectl curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo cp kubectl /usr/local/bin/ && rm kubectl
``` ```

View File

@ -3,11 +3,18 @@
"version": "0.0.1", "version": "0.0.1",
"description": "GraphQL Backend for Human Connection", "description": "GraphQL Backend for Human Connection",
"main": "src/index.js", "main": "src/index.js",
"config": {
"no_auth": "cross-env GRAPHQL_URI=http://localhost:4001 GRAPHQL_PORT=4001 PERMISSIONS=disabled"
},
"scripts": { "scripts": {
"eslint": "eslint src --config .eslintrc.js",
"test": "echo \"Error: no test specified\" && exit 0", "test": "echo \"Error: no test specified\" && exit 0",
"start": "./node_modules/.bin/nodemon --exec babel-node src/index.js", "start": "./node_modules/.bin/nodemon --exec babel-node src/index.js",
"start:debug": "./node_modules/.bin/nodemon --exec babel-node --inspect=0.0.0.0:9229 src/index.js", "start:debug": "./node_modules/.bin/nodemon --exec babel-node --inspect=0.0.0.0:9229 src/index.js",
"db:seed": "concurrently --kill-others --success first 'cross-env GRAPHQL_URI=http://localhost:4001 PERMISSIONS=disabled GRAPHQL_PORT=4001 yarn run start' 'wait-on tcp:4001 && cross-env GRAPHQL_URI=http://localhost:4001 ./node_modules/.bin/babel-node src/seed/seed-db.js'" "db:script:seed": "wait-on tcp:4001 && $npm_package_config_no_auth ./node_modules/.bin/babel-node src/seed/seed-db.js",
"db:script:reset": "wait-on tcp:4001 && $npm_package_config_no_auth ./node_modules/.bin/babel-node src/seed/reset-db.js",
"db:seed": "concurrently --kill-others --success first -n no-auth-server,seed '$npm_package_config_no_auth yarn run start' 'yarn run db:script:seed'",
"db:reset": "concurrently --kill-others --success first -n no-auth-server,reset '$npm_package_config_no_auth yarn run start' 'yarn run db:script:reset'"
}, },
"author": "Human Connection gGmbH", "author": "Human Connection gGmbH",
"license": "MIT", "license": "MIT",
@ -40,13 +47,20 @@
"node-fetch": "^2.1.2", "node-fetch": "^2.1.2",
"passport": "^0.4.0", "passport": "^0.4.0",
"passport-jwt": "^4.0.0", "passport-jwt": "^4.0.0",
"sanitize-html": "^1.19.1", "sanitize-html": "^1.19.2",
"slug": "^0.9.1", "slug": "^0.9.1",
"trunc-html": "^1.1.2" "trunc-html": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"babel-eslint": "^10.0.1",
"concurrently": "^4.1.0", "concurrently": "^4.1.0",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"eslint": "^5.9.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^4.0.0",
"faker": "^4.1.0", "faker": "^4.1.0",
"nodemon": "^1.18.7", "nodemon": "^1.18.7",
"wait-on": "^3.2.0" "wait-on": "^3.2.0"

View File

@ -4,7 +4,7 @@ import {
GraphQLDefaultToDirective GraphQLDefaultToDirective
} from 'graphql-custom-directives' } from 'graphql-custom-directives'
export default function applyDirectives(augmentedSchema) { export default function applyDirectives (augmentedSchema) {
const directives = [ const directives = [
GraphQLLowerCaseDirective, GraphQLLowerCaseDirective,
GraphQLTrimDirective, GraphQLTrimDirective,

View File

@ -4,7 +4,7 @@ let driver
export default function () { export default function () {
return { return {
getDriver() { getDriver () {
if (!driver) { if (!driver) {
driver = neo4j.driver( driver = neo4j.driver(
process.env.NEO4J_URI || 'bolt://localhost:7687', process.env.NEO4J_URI || 'bolt://localhost:7687',

View File

@ -4,7 +4,7 @@ import {
GraphQLDateTime GraphQLDateTime
} from 'graphql-iso-date' } from 'graphql-iso-date'
export default function applyScalars(augmentedSchema) { export default function applyScalars (augmentedSchema) {
augmentedSchema._typeMap.Date = GraphQLDate augmentedSchema._typeMap.Date = GraphQLDate
augmentedSchema._typeMap.Time = GraphQLTime augmentedSchema._typeMap.Time = GraphQLTime
augmentedSchema._typeMap.DateTime = GraphQLDateTime augmentedSchema._typeMap.DateTime = GraphQLDateTime

View File

@ -7,10 +7,10 @@ import generateJwt from './jwt/generateToken'
import { fixUrl } from './middleware/fixImageUrlsMiddleware' import { fixUrl } from './middleware/fixImageUrlsMiddleware'
export const typeDefs = export const typeDefs =
fs.readFileSync(process.env.GRAPHQL_SCHEMA || path.join(__dirname, "schema.graphql")) fs.readFileSync(process.env.GRAPHQL_SCHEMA || path.join(__dirname, 'schema.graphql'))
.toString('utf-8') .toString('utf-8')
const query = (cypher, session) => { export const query = (cypher, session) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let data = [] let data = []
session session
@ -54,15 +54,15 @@ export const resolvers = {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
const session = driver.session() const session = driver.session()
const queries = { const queries = {
countUsers: `MATCH (r:User) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countUsers`, countUsers: 'MATCH (r:User) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countUsers',
countPosts: `MATCH (r:Post) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countPosts`, countPosts: 'MATCH (r:Post) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countPosts',
countComments: `MATCH (r:Comment) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countComments`, countComments: 'MATCH (r:Comment) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countComments',
countNotifications: `MATCH (r:Notification) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countNotifications`, countNotifications: 'MATCH (r:Notification) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countNotifications',
countOrganizations: `MATCH (r:Organization) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countOrganizations`, countOrganizations: 'MATCH (r:Organization) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countOrganizations',
countProjects: `MATCH (r:Project) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countProjects`, countProjects: 'MATCH (r:Project) WHERE r.deleted <> true OR NOT exists(r.deleted) RETURN COUNT(r) AS countProjects',
countInvites: `MATCH (r:Invite) WHERE r.wasUsed <> true OR NOT exists(r.wasUsed) RETURN COUNT(r) AS countInvites`, countInvites: 'MATCH (r:Invite) WHERE r.wasUsed <> true OR NOT exists(r.wasUsed) RETURN COUNT(r) AS countInvites',
countFollows: `MATCH (:User)-[r:FOLLOWS]->(:User) RETURN COUNT(r) AS countFollows`, countFollows: 'MATCH (:User)-[r:FOLLOWS]->(:User) RETURN COUNT(r) AS countFollows',
countShouts: `MATCH (:User)-[r:SHOUTED]->(:Post) RETURN COUNT(r) AS countShouts` countShouts: 'MATCH (:User)-[r:SHOUTED]->(:Post) RETURN COUNT(r) AS countShouts'
} }
let data = { let data = {
countUsers: (await queryOne(queries.countUsers, session)).countUsers, countUsers: (await queryOne(queries.countUsers, session)).countUsers,

View File

@ -69,5 +69,5 @@ const serverConfig = {
} }
server.start(serverConfig, options => { server.start(serverConfig, options => {
console.log(`Server ready at ${process.env.GRAPHQL_URI} 🚀`); console.log(`Server ready at ${process.env.GRAPHQL_URI} 🚀`)
}) })

View File

@ -3,7 +3,7 @@ import jwt from 'jsonwebtoken'
import ms from 'ms' import ms from 'ms'
// Generate an Access Token for the given User ID // Generate an Access Token for the given User ID
export default function generateJwt(user) { export default function generateJwt (user) {
const token = jwt.sign(user, process.env.JWT_SECRET, { const token = jwt.sign(user, process.env.JWT_SECRET, {
expiresIn: ms('1d'), expiresIn: ms('1d'),
issuer: process.env.GRAPHQL_URI, issuer: process.env.GRAPHQL_URI,

View File

@ -20,7 +20,10 @@ export default () => {
(JWTPayload, next) => { (JWTPayload, next) => {
// usually this would be a database call: // usually this would be a database call:
// var user = users[_.findIndex(users, {id: JWTPayload.id})] // var user = users[_.findIndex(users, {id: JWTPayload.id})]
// TODO: fix https://github.com/Human-Connection/Nitro-Backend/issues/41
/* eslint-disable */
if (true) { if (true) {
/* eslint-enable */
next(null, {}) next(null, {})
} else { } else {
next(null, false) next(null, false)

View File

@ -3,9 +3,9 @@ import softDeleteMiddleware from './softDeleteMiddleware'
import sluggifyMiddleware from './sluggifyMiddleware' import sluggifyMiddleware from './sluggifyMiddleware'
import fixImageUrlsMiddleware from './fixImageUrlsMiddleware' import fixImageUrlsMiddleware from './fixImageUrlsMiddleware'
import excerptMiddleware from './excerptMiddleware' import excerptMiddleware from './excerptMiddleware'
import dateTimeMiddleware from './dateTimeMiddleware'; import dateTimeMiddleware from './dateTimeMiddleware'
import xssMiddleware from './xssMiddleware'; import xssMiddleware from './xssMiddleware'
import permissionsMiddleware from './permissionsMiddleware'; import permissionsMiddleware from './permissionsMiddleware'
export default schema => { export default schema => {
let middleware = [ let middleware = [

View File

@ -1,17 +1,22 @@
import { rule, shield, and, or, not, allow } from 'graphql-shield' import { rule, shield, allow } from 'graphql-shield'
/*
* TODO: implement
* See: https://github.com/Human-Connection/Nitro-Backend/pull/40#pullrequestreview-180898363
const isAuthenticated = rule()(async (parent, args, ctx, info) => { const isAuthenticated = rule()(async (parent, args, ctx, info) => {
return ctx.user !== null return ctx.user !== null
}) })
const isOwner = rule()(async (parent, args, ctx, info) => {
return ctx.user.id === parent.id
})
const isAdmin = rule()(async (parent, args, ctx, info) => { const isAdmin = rule()(async (parent, args, ctx, info) => {
return ctx.user.role === 'ADMIN' return ctx.user.role === 'ADMIN'
}) })
const isModerator = rule()(async (parent, args, ctx, info) => { const isModerator = rule()(async (parent, args, ctx, info) => {
return ctx.user.role === 'MODERATOR' return ctx.user.role === 'MODERATOR'
}) })
*/
const isOwner = rule()(async (parent, args, ctx, info) => {
return ctx.user.id === parent.id
})
// Permissions // Permissions
const permissions = shield({ const permissions = shield({

View File

@ -1,5 +1,4 @@
import walkRecursive from './helpers/walkRecursive' import walkRecursive from './helpers/walkRecursive'
import trunc from 'trunc-html'
// import { getByDot, setByDot, getItems, replaceItems } from 'feathers-hooks-common' // import { getByDot, setByDot, getItems, replaceItems } from 'feathers-hooks-common'
import sanitizeHtml from 'sanitize-html' import sanitizeHtml from 'sanitize-html'
// import { isEmpty, intersection } from 'lodash' // import { isEmpty, intersection } from 'lodash'

View File

@ -1,5 +1,3 @@
import faker from 'faker'
export default () => { export default () => {
return `mutation { return `mutation {
o1: CreateOrganization( o1: CreateOrganization(

View File

@ -6,7 +6,7 @@ export default function (data) {
p1: CreatePost( p1: CreatePost(
id: "p1", id: "p1",
title: "Gedanken eines Polizisten zum Einsatz im Hambacher Forst", title: "Gedanken eines Polizisten zum Einsatz im Hambacher Forst",
content: "<p><strong>Diese Zukunftsstadt ist real und keine Computer-Animation</strong> sondern sie ist das Lebenswerk des mittlerweile über 100 Jahre alten Futuristen und Architekten Jacque Fresco aus Florida. In 35 Jahren (seit seinem 13. Lebensjahr) hat dieser zusammen mit seiner Frau seinen futuristischen Traum von einer besonderen Zukunftsstadt auf 85.000 Quadratmetern realisiert. In den Gebäuden und Gärten befinden sich u.a. ein Forschungszentrum, Vortragsräume und unzählige seiner Modelle &amp; Architekturentwürfe.</p><br /><p>Sein zentrales Anliegen ist eine resourcenbasierte Wirtschaft und die Abschaffung von Geld und Privatbesitz. Mit Hilfe von Roboterarbeit und dem Bedingungslosen Grundeinkommen (da nach seiner Ansicht in den kommenden Jahren fast alle Jobs automatisiert werden), möchte er eine ökologische Landwirtschaft mit Permakulturen etc. und eine effiziente Energiegewinnung (ausschließlich durch regenerative Energien) schaffen. Wenige kompatible Formen in einer sparsamen Modulbauweise (in die u.a. bereits variable Service- und Reparaturelemente integriert sind) sollen insgesamt eine soziale &amp; ökologische Utopie im Einklang mit der Natur ermöglichen.</p><br /><p>Nachfolgend der Direkt-Link auf den interessanten Artikel von Zoltan Istvan, der den Architekten und seine Frau in Florida besuchen durfte und seinen Artikel Ende 2016 auf „MOTHERBOARD“ veröffentlicht hatte:</p><br /><p>https://motherboard.vice.com/de/article/vv34nb/ich-habe-die-zukunft-besucht-in-der-wir-ohne-geld-steuern-und-besitz-leben </p><br /><p>Da soll noch jemand behaupten, es gäbe keine Utopien mehr bzw. keine Futuristen, die ihre kreativen und zukunftsfähigen Ideen (auch in ganz großem Stil) selbst in die Tat umsetzen. LG @all :) </p><br /><p><strong>Wir sind eine Menschheitsfamilie. • Wir sind eins. • Wir sind HUMAN CONNECTION</strong> ❤️</p>", content: "<p><strong>Diese Zukunftsstadt ist real und keine Computer-Animation</strong> sondern sie ist das Lebenswerk des mittlerweile über 100 Jahre alten Futuristen und Architekten Jacque Fresco aus Florida. In 35 Jahren (seit seinem 13. Lebensjahr) hat dieser zusammen mit seiner Frau seinen futuristischen Traum von einer besonderen Zukunftsstadt auf 85.000 Quadratmetern realisiert. In den Gebäuden und Gärten befinden sich u.a. ein Forschungszentrum, Vortragsräume und unzählige seiner Modelle &amp; Architekturentwürfe.</p><br /><p>Sein zentrales Anliegen ist eine resourcenbasierte Wirtschaft und die Abschaffung von Geld und Privatbesitz. Mit Hilfe von Roboterarbeit und dem Bedingungslosen Grundeinkommen (da nach seiner Ansicht in den kommenden Jahren fast alle Jobs automatisiert werden), möchte er eine ökologische Landwirtschaft mit Permakulturen etc. und eine effiziente Energiegewinnung (ausschließlich durch regenerative Energien) schaffen. Wenige kompatible Formen in einer sparsamen Modulbauweise (in die u.a. bereits variable Service- und Reparaturelemente integriert sind) sollen insgesamt eine soziale &amp; ökologische Utopie im Einklang mit der Natur ermöglichen.</p><br /><p>Nachfolgend der Direkt-Link auf den interessanten Artikel von Zoltan Istvan, der den Architekten und seine Frau in Florida besuchen durfte und seinen Artikel Ende 2016 auf „MOTHERBOARD“ veröffentlicht hatte:</p><br /><p>https://motherboard.vice.com/de/article/vv34nb/ich-habe-die-zukunft-besucht-in-der-wir-ohne-geld-steuern-und-besitz-leben</p><br /><p>Da soll noch jemand behaupten, es gäbe keine Utopien mehr bzw. keine Futuristen, die ihre kreativen und zukunftsfähigen Ideen (auch in ganz großem Stil) selbst in die Tat umsetzen. LG @all :)</p><br /><p><strong>Wir sind eine Menschheitsfamilie. • Wir sind eins. • Wir sind HUMAN CONNECTION</strong>❤️</p>",
image: "https://picsum.photos/1280/1024?image=352", image: "https://picsum.photos/1280/1024?image=352",
visibility: public, visibility: public,
disabled: false, disabled: false,
@ -31,7 +31,7 @@ export default function (data) {
p2: CreatePost( p2: CreatePost(
id: "p2", id: "p2",
title: "Julian Assange", title: "Julian Assange",
content: "<p><strong>Diese Zukunftsstadt ist real und keine Computer-Animation</strong> sondern sie ist das Lebenswerk des mittlerweile über 100 Jahre alten Futuristen und Architekten Jacque Fresco aus Florida. In 35 Jahren (seit seinem 13. Lebensjahr) hat dieser zusammen mit seiner Frau seinen futuristischen Traum von einer besonderen Zukunftsstadt auf 85.000 Quadratmetern realisiert. In den Gebäuden und Gärten befinden sich u.a. ein Forschungszentrum, Vortragsräume und unzählige seiner Modelle &amp; Architekturentwürfe.</p><br /><p>Sein zentrales Anliegen ist eine resourcenbasierte Wirtschaft und die Abschaffung von Geld und Privatbesitz. Mit Hilfe von Roboterarbeit und dem Bedingungslosen Grundeinkommen (da nach seiner Ansicht in den kommenden Jahren fast alle Jobs automatisiert werden), möchte er eine ökologische Landwirtschaft mit Permakulturen etc. und eine effiziente Energiegewinnung (ausschließlich durch regenerative Energien) schaffen. Wenige kompatible Formen in einer sparsamen Modulbauweise (in die u.a. bereits variable Service- und Reparaturelemente integriert sind) sollen insgesamt eine soziale &amp; ökologische Utopie im Einklang mit der Natur ermöglichen.</p><br /><p>Nachfolgend der Direkt-Link auf den interessanten Artikel von Zoltan Istvan, der den Architekten und seine Frau in Florida besuchen durfte und seinen Artikel Ende 2016 auf „MOTHERBOARD“ veröffentlicht hatte:</p><br /><p>https://motherboard.vice.com/de/article/vv34nb/ich-habe-die-zukunft-besucht-in-der-wir-ohne-geld-steuern-und-besitz-leben </p><br /><p>Da soll noch jemand behaupten, es gäbe keine Utopien mehr bzw. keine Futuristen, die ihre kreativen und zukunftsfähigen Ideen (auch in ganz großem Stil) selbst in die Tat umsetzen. LG @all :) </p><br /><p><strong>Wir sind eine Menschheitsfamilie. • Wir sind eins. • Wir sind HUMAN CONNECTION</strong> ❤️</p>", content: "<p><strong>Diese Zukunftsstadt ist real und keine Computer-Animation</strong> sondern sie ist das Lebenswerk des mittlerweile über 100 Jahre alten Futuristen und Architekten Jacque Fresco aus Florida. In 35 Jahren (seit seinem 13. Lebensjahr) hat dieser zusammen mit seiner Frau seinen futuristischen Traum von einer besonderen Zukunftsstadt auf 85.000 Quadratmetern realisiert. In den Gebäuden und Gärten befinden sich u.a. ein Forschungszentrum, Vortragsräume und unzählige seiner Modelle &amp; Architekturentwürfe.</p><br /><p>Sein zentrales Anliegen ist eine resourcenbasierte Wirtschaft und die Abschaffung von Geld und Privatbesitz. Mit Hilfe von Roboterarbeit und dem Bedingungslosen Grundeinkommen (da nach seiner Ansicht in den kommenden Jahren fast alle Jobs automatisiert werden), möchte er eine ökologische Landwirtschaft mit Permakulturen etc. und eine effiziente Energiegewinnung (ausschließlich durch regenerative Energien) schaffen. Wenige kompatible Formen in einer sparsamen Modulbauweise (in die u.a. bereits variable Service- und Reparaturelemente integriert sind) sollen insgesamt eine soziale &amp; ökologische Utopie im Einklang mit der Natur ermöglichen.</p><br /><p>Nachfolgend der Direkt-Link auf den interessanten Artikel von Zoltan Istvan, der den Architekten und seine Frau in Florida besuchen durfte und seinen Artikel Ende 2016 auf „MOTHERBOARD“ veröffentlicht hatte:</p><br /><p>https://motherboard.vice.com/de/article/vv34nb/ich-habe-die-zukunft-besucht-in-der-wir-ohne-geld-steuern-und-besitz-leben</p><br /><p>Da soll noch jemand behaupten, es gäbe keine Utopien mehr bzw. keine Futuristen, die ihre kreativen und zukunftsfähigen Ideen (auch in ganz großem Stil) selbst in die Tat umsetzen. LG @all :)</p><br /><p><strong>Wir sind eine Menschheitsfamilie. • Wir sind eins. • Wir sind HUMAN CONNECTION</strong>❤️</p>",
image: "https://picsum.photos/1280/1024?image=72", image: "https://picsum.photos/1280/1024?image=72",
visibility: public, visibility: public,
disabled: false, disabled: false,

23
src/seed/reset-db.js Normal file
View File

@ -0,0 +1,23 @@
import { query } from '../graphql-schema'
import dotenv from 'dotenv'
import neo4j from '../bootstrap/neo4j'
dotenv.config()
if (process.env.NODE_ENV === 'production') {
throw new Error('YOU CAN`T UNSEED IN PRODUCTION MODE')
}
const driver = neo4j().getDriver()
const session = driver.session()
query('MATCH (n) DETACH DELETE n', session).then(() => {
console.log('Successfully deleted all nodes and relations!')
}).catch((err) => {
console.log(`Error occurred deleting the nodes and relations (reset the db)\n\n${err}`)
}).finally(() => {
if (session) {
session.close()
}
process.exit(0)
})

View File

@ -1,12 +1,11 @@
import ApolloClient from "apollo-client"; import ApolloClient from 'apollo-client'
import dotenv from "dotenv"; import dotenv from 'dotenv'
import gql from 'graphql-tag' import fetch from 'node-fetch'
import fetch from "node-fetch"; import { HttpLink } from 'apollo-link-http'
import { HttpLink } from "apollo-link-http"; import { InMemoryCache } from 'apollo-cache-inmemory'
import { InMemoryCache } from "apollo-cache-inmemory";
import Seed from './data/index' import Seed from './data/index'
dotenv.config(); dotenv.config()
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
throw new Error('YOU CAN`T SEED IN PRODUCTION MODE') throw new Error('YOU CAN`T SEED IN PRODUCTION MODE')
@ -15,6 +14,6 @@ if (process.env.NODE_ENV === 'production') {
const client = new ApolloClient({ const client = new ApolloClient({
link: new HttpLink({ uri: process.env.GRAPHQL_URI, fetch }), link: new HttpLink({ uri: process.env.GRAPHQL_URI, fetch }),
cache: new InMemoryCache() cache: new InMemoryCache()
}); })
Seed(client) Seed(client)

View File

@ -137,7 +137,7 @@ export default {
const chars = '23456789abcdefghkmnpqrstuvwxyzABCDEFGHJKLMNPRSTUVWXYZ' const chars = '23456789abcdefghkmnpqrstuvwxyzABCDEFGHJKLMNPRSTUVWXYZ'
let code = '' let code = ''
for (let i = 0; i < 8; i++) { for (let i = 0; i < 8; i++) {
const n = _.random(0, chars.length-1) const n = _.random(0, chars.length - 1)
code += chars.substr(n, 1) code += chars.substr(n, 1)
} }
return code return code

606
yarn.lock

File diff suppressed because it is too large Load Diff