merged master in

This commit is contained in:
Grzegorz Leoniec 2018-11-26 15:31:13 +01:00
commit 329fe0ac63
31 changed files with 2943 additions and 5501 deletions

View File

@ -1 +1 @@
{ "presets": ["env"] }
{ "presets": ["@babel/preset-env"] }

View File

@ -1,7 +1,7 @@
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=letmein
GRAPHQL_LISTEN_PORT=4000
GRAPHQL_PORT=4000
GRAPHQL_URI=http://localhost:4000
MOCK=false

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules/
.env
.vscode
yarn-error.log

View File

@ -12,7 +12,7 @@ services:
- 4000:4000
environment:
- NEO4J_URI=bolt://neo4j:7687
- GRAPHQL_LISTEN_PORT=4000
- GRAPHQL_PORT=4000
- GRAPHQL_URI=http://localhost:4000
- CLIENT_URI=http://localhost:3000
- JWT_SECRET=b/&&7b78BF&fv/Vd

View File

@ -1,19 +1,34 @@
# Usage with minikube
assuming you installed the packages git, docker, minikube and virtualbox here...
First of all start minikube on your machine:
```sh
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:
https://forum.manjaro.org/t/installing-virtualbox-kernel-modules/6999
You can always get an overview and see what's going on with your minikube:
```sh
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:
```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
```
From now on stay in your favorite work directory. First let's clone the necessary sources:
```sh
git clone https://github.com/Human-Connection/Nitro-Backend.git
git clone https://github.com/Human-Connection/Nitro-Web.git
```
Build Docker images, using the Minikube Docker daemon:
```sh
eval $(minikube docker-env)
docker build -t humanconnection/backend:latest .
docker build -t humanconnection/neo4j:latest -f Dockerfile.neo4j .
docker build -t humanconnection/backend:latest Nitro-Backend/
docker build -t humanconnection/neo4j:latest -f Nitro-Backend/Dockerfile.neo4j Nitro-Backend/
```
check that the image is in Minikubes Docker registry:
@ -21,10 +36,9 @@ check that the image is in Minikubes Docker registry:
minikube ssh docker images
```
Now change into directory kubernetes and create services and deployments:
Now change into directory Nitro-Backend/kubernetes and create services and deployments:
```sh
cd kubernetes
cd Nitro-Backend/kubernetes
kubectl create -f neo4j-deployment.yaml,neo4j-data-persistentvolumeclaim.yaml,backend-deployment.yaml,neo4j-service.json,backend-service.json
```

View File

@ -21,7 +21,7 @@ spec:
- env:
- name: CLIENT_URI
value: http://localhost:3000
- name: GRAPHQL_LISTEN_PORT
- name: GRAPHQL_PORT
value: "4000"
- name: GRAPHQL_URI
value: http://localhost:4000

View File

@ -1,17 +1,22 @@
{
"name": "hc-prototype-api-",
"name": "human-connection-backend",
"version": "0.0.1",
"description": "Graph API Protype for Human Connection",
"description": "GraphQL Backend for Human Connection",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"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",
"seedDb": "./node_modules/.bin/babel-node src/seed/seed-db.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'"
},
"author": "Grzegorz Leoniec",
"author": "Human Connection gGmbh",
"license": "MIT",
"dependencies": {
"@babel/cli": "^7.1.5",
"@babel/core": "^7.1.6",
"@babel/node": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/register": "^7.0.0",
"apollo-boost": "^0.1.10",
"apollo-cache-inmemory": "^1.2.5",
"apollo-client": "^2.3.2",
@ -42,9 +47,10 @@
"trunc-html": "^1.1.2"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"concurrently": "^4.1.0",
"cross-env": "^5.2.0",
"faker": "^4.1.0",
"nodemon": "^1.18.4"
"nodemon": "^1.18.4",
"wait-on": "^3.2.0"
}
}

20
src/bootstrap/neo4j.js Normal file
View File

@ -0,0 +1,20 @@
import { v1 as neo4j } from 'neo4j-driver'
let driver
export default function () {
return {
getDriver() {
if (!driver) {
driver = neo4j.driver(
process.env.NEO4J_URI || 'bolt://localhost:7687',
neo4j.auth.basic(
process.env.NEO4J_USER || 'neo4j',
process.env.NEO4J_PASSWORD || 'neo4j'
)
)
}
return driver
}
}
}

View File

@ -2,12 +2,12 @@ import { GraphQLServer } from 'graphql-yoga'
import { makeExecutableSchema } from 'apollo-server'
import { augmentSchema } from 'neo4j-graphql-js'
import { typeDefs, resolvers } from './graphql-schema'
import { v1 as neo4j } from 'neo4j-driver'
import dotenv from 'dotenv'
import mocks from './mocks'
import middleware from './middleware'
import applyDirectives from './bootstrap/directives'
import applyScalars from './bootstrap/scalars'
import neo4j from './bootstrap/neo4j'
import passport from 'passport'
import jwtStrategy from './jwt/strategy'
@ -20,13 +20,7 @@ let schema = makeExecutableSchema({
resolvers
})
const driver = neo4j.driver(
process.env.NEO4J_URI || 'bolt://localhost:7687',
neo4j.auth.basic(
process.env.NEO4J_USER || 'neo4j',
process.env.NEO4J_PASSWORD || 'neo4j'
)
)
const driver = neo4j().getDriver()
const MOCK = (process.env.MOCK === 'true')
console.log('MOCK:', MOCK)
@ -67,7 +61,7 @@ server.express.use(passport.initialize())
server.express.post('/graphql', passport.authenticate(['jwt'], { session: false }))
const serverConfig = {
port: 4000
port: process.env.GRAPHQL_PORT || 4000
// cors: {
// credentials: true,
// origin: [process.env.CLIENT_URI] // your frontend url.

View File

@ -8,14 +8,22 @@ import xssMiddleware from './xssMiddleware'
import permissionsMiddleware from './permissionsMiddleware'
import userMiddleware from './userMiddleware'
export default schema => [
permissionsMiddleware.generate(schema),
passwordMiddleware,
dateTimeMiddleware,
sluggifyMiddleware,
excerptMiddleware,
xssMiddleware,
fixImageUrlsMiddleware,
softDeleteMiddleware,
userMiddleware
]
export default schema => {
let middleware = [
passwordMiddleware,
dateTimeMiddleware,
sluggifyMiddleware,
excerptMiddleware,
xssMiddleware,
fixImageUrlsMiddleware,
softDeleteMiddleware,
userMiddleware
]
// add permisions middleware at the first position (unless we're seeding)
// NOTE: DO NOT SET THE PERMISSION FLAT YOUR SELF
if (process.env.PERMISSIONS !== 'disabled' && process.env.NODE_ENV !== 'production') {
middleware.unshift(permissionsMiddleware.generate(schema))
}
return middleware
}

View File

@ -4,7 +4,6 @@ const isAuthenticated = rule()(async (parent, args, ctx, info) => {
return ctx.user !== null
})
const isOwner = rule()(async (parent, args, ctx, info) => {
console.log('parent', parent)
return ctx.user.id === parent.id
})
const isAdmin = rule()(async (parent, args, ctx, info) => {
@ -17,18 +16,19 @@ const isModerator = rule()(async (parent, args, ctx, info) => {
// Permissions
const permissions = shield({
Query: {
statistics: isAdmin
statistics: allow
// fruits: and(isAuthenticated, or(isAdmin, isModerator)),
// customers: and(isAuthenticated, isAdmin)
},
Mutation: {
// addFruitToBasket: isAuthenticated
// CreateUser: allow
},
User: {
email: isOwner,
password: isOwner
},
Post: isAuthenticated
}
// Post: isAuthenticated
})
export default permissions

View File

@ -11,12 +11,12 @@ export default {
return result
},
Comment: async (resolve, root, args, context, info) => {
// if (typeof args.deleted !== 'boolean') {
// args.deleted = false
// }
// if (typeof args.disabled !== 'boolean') {
// args.disabled = false
// }
if (typeof args.deleted !== 'boolean') {
args.deleted = false
}
if (typeof args.disabled !== 'boolean') {
args.disabled = false
}
const result = await resolve(root, args, context, info)
return result
},

View File

@ -46,21 +46,6 @@ enum UserGroupEnum {
user
}
type WrittenPost @relation(name: "WROTE") {
from: User
to: Post
timestamp: Int # TODO: change that to custom Date Type
}
# type WrittenPost2 {
# Post: Post!
# timestamp: Int # TODO: change that to custom Date Type
# }
type WrittenComment @relation(name: "WROTE") {
from: User
to: Comment
timestamp: Int # TODO: change that to custom Date Type
}
type Location {
id: ID!
name: String!
@ -109,7 +94,7 @@ type User {
RETURN COUNT(r)"""
)
comments: [WrittenComment]!
comments: [Comment]! @relation(name: "WROTE", direction: "OUT")
commentsCount: Int! @cypher(statement: "MATCH (this)-[:WROTE]->(r:Comment) WHERE NOT r.deleted = true RETURN COUNT(r)")
shouted: [Post]! @relation(name: "SHOUTED", direction: "OUT")
@ -128,7 +113,7 @@ type User {
type Post {
id: ID!
author: WrittenPost
author: User @relation(name: "WROTE", direction: "IN")
title: String!
slug: String
content: String!
@ -158,12 +143,12 @@ type Post {
type Comment {
id: ID!
author: WrittenComment
author: User @relation(name: "WROTE", direction: "IN")
content: String!
contentExcerpt: String
post: Post @relation(name: "COMMENT", direction: "OUT")
createdAt: String,
updatedAt: String,
post: Post @relation(name: "COMMENTS", direction: "OUT")
createdAt: String
updatedAt: String
deleted: Boolean
disabled: Boolean
}

12
src/seed/data/badges.js Normal file
View File

@ -0,0 +1,12 @@
export default function (data) {
return `
mutation {
b1: CreateBadge(id: "b1", key: "indiegogo_en_racoon", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_racoon.svg") { id }
b2: CreateBadge(id: "b2", key: "indiegogo_en_rabbit", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_rabbit.svg") { id }
b3: CreateBadge(id: "b3", key: "indiegogo_en_wolf", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_wolf.svg") { id }
b4: CreateBadge(id: "b4", key: "indiegogo_en_bear", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_bear.svg") { id }
b5: CreateBadge(id: "b5", key: "indiegogo_en_turtle", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_turtle.svg") { id }
b6: CreateBadge(id: "b6", key: "indiegogo_en_rhino", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_rhino.svg") { id }
}
`
}

View File

@ -0,0 +1,22 @@
export default function (data) {
return `
mutation {
cat1: CreateCategory( id: "cat1", name: "Just For Fun", slug: "justforfun", icon: "smile" ) { name }
cat2: CreateCategory( id: "cat2", name: "Happyness & Values", slug: "happyness-values", icon: "heart-o" ) { name }
cat3: CreateCategory( id: "cat3", name: "Health & Wellbeing", slug: "health-wellbeing", icon: "medkit" ) { name }
cat4: CreateCategory( id: "cat4", name: "Environment & Nature", slug: "environment-nature", icon: "tree" ) { name }
cat5: CreateCategory( id: "cat5", name: "Animal Protection", slug: "animalprotection", icon: "paw" ) { name }
cat6: CreateCategory( id: "cat6", name: "Humanrights Justice", slug: "humanrights-justice", icon: "balance-scale" ) { name }
cat7: CreateCategory( id: "cat7", name: "Education & Sciences", slug: "education-sciences", icon: "graduation-cap" ) { name }
cat8: CreateCategory( id: "cat8", name: "Cooperation & Development", slug: "cooperation-development", icon: "users" ) { name }
cat9: CreateCategory( id: "cat9", name: "Democracy & Politics", slug: "democracy-politics", icon: "university" ) { name }
cat10: CreateCategory( id: "cat10", name: "Economy & Finances", slug: "economy-finances", icon: "money" ) { name }
cat11: CreateCategory( id: "cat11", name: "Energy & Technology", slug: "energy-technology", icon: "flash" ) { name }
cat12: CreateCategory( id: "cat12", name: "IT, Internet & Data Privacy", slug: "it-internet-dataprivacy", icon: "mouse-pointer" ) { name }
cat13: CreateCategory( id: "cat13", name: "Art, Curlure & Sport", slug: "art-culture-sport", icon: "paint-brush" ) { name }
cat14: CreateCategory( id: "cat14", name: "Freedom of Speech", slug: "freedomofspeech", icon: "bullhorn" ) { name }
cat15: CreateCategory( id: "cat15", name: "Consumption & Sustainability", slug: "consumption-sustainability", icon: "shopping-cart" ) { name }
cat16: CreateCategory( id: "cat16", name: "Global Peace & Nonviolence", slug: "globalpeace-nonviolence", icon: "angellist" ) { name }
}
`
}

80
src/seed/data/comments.js Normal file
View File

@ -0,0 +1,80 @@
import faker from 'faker'
/**
* TODO: add a comment automatically to the correct post and relate it to the current user
*/
export default function (data) {
return `
mutation {
c1: CreateComment(
id: "c1",
content: "<p>da stimm ich dir zu. Mir ging das auch nie in den kopf, und hatte jesus nie als gott gesehen </p>"
) { id }
c1_u1: AddCommentAuthor(from: { id: "u3" }, to: { id: "c1" }) { from { id } }
c1_p1: AddCommentPost(
from: { id: "c1" },
to: { id: "p1" }
) { from { id } }
c2: CreateComment(
id: "c2",
content: "<p>Schön das es dich gibt ❤️❤️❤️❤️❤️❤️❤️❤️❤️</p>"
) { id }
c2_u1: AddCommentAuthor(from: { id: "u1" }, to: { id: "c2" }) { from { id } }
c2_p1: AddCommentPost(
from: { id: "c2" },
to: { id: "p1" }
) { from { id } }
c3: CreateComment(
id: "c3",
content: "<p>Hi Dieter,</p><p>danke für Deine Info. Hast Du mal ein Foto von Deinem Cabrio mit dem Logo drauf?</p>"
) { id }
c3_u2: AddCommentAuthor(from: { id: "u1" }, to: { id: "c3" }) { from { id } }
c3_p3: AddCommentPost(
from: { id: "c3" },
to: { id: "p3" }
) { from { id } }
c4: CreateComment(
id: "c4",
content: "<p>Das Zusammenführen aller Gruppen, die mit uns am gleichen Strang in die gleiche Richtung ziehen, in eine gemeinsame Adressenstruktur sehe ich auch als Haupt - Aufgabe für unsere neue Netzwerkbildung an.</p>"
) { id }
c4_u3: AddCommentAuthor(from: { id: "u4" }, to: { id: "c4" }) { from { id } }
c4_p2: AddCommentPost(
from: { id: "c4" },
to: { id: "p2" }
) { from { id } }
c5: CreateComment(
id: "c5",
content: "${faker.lorem.paragraph()}"
) { id }
c5_u4: AddCommentAuthor(from: { id: "u4" }, to: { id: "c5" }) { from { id } }
c5_p3: AddCommentPost(
from: { id: "c5" },
to: { id: "p3" }
) { from { id } }
c6: CreateComment(
id: "c6",
content: "${faker.lorem.paragraph()}"
) { id }
c6_u3: AddCommentAuthor(from: { id: "u3" }, to: { id: "c6" }) { from { id } }
c6_p4: AddCommentPost(
from: { id: "c6" },
to: { id: "p4" }
) { from { id } }
c7: CreateComment(
id: "c7",
content: "${faker.lorem.paragraph()}"
) { id }
c7_u2: AddCommentAuthor(from: { id: "u2" }, to: { id: "c7" }) { from { id } }
c7_p2: AddCommentPost(
from: { id: "c7" },
to: { id: "p2" }
) { from { id } }
}
`
}

38
src/seed/data/index.js Normal file
View File

@ -0,0 +1,38 @@
import gql from 'graphql-tag'
import helper from '../seed-helpers'
const seed = {
Badge: require('./badges.js').default,
Category: require('./categories.js').default,
Tags: require('./tags.js').default,
User: require('./users.js').default,
UserBadges: require('./users-badges.js').default,
UserBlacklist: require('./users-blacklist.js').default,
UserFollows: require('./users-follows.js').default,
UserFriends: require('./users-friends.js').default,
Organization: require('./organizations.js').default,
Post: require('./posts.js').default,
Comment: require('./comments.js').default,
UserShouts: require('./users-shouts.js').default
}
let data = {}
export default async function (client) {
// iterate through seeds
await helper.asyncForEach(Object.keys(seed), async key => {
const mutations = seed[key]
try {
const res = await client
.mutate({
mutation: gql(mutations(data))
})
data[key] = Object.assign(data[key] || {}, res.data)
} catch (err) {
console.error(err)
}
})
console.log('Seeded Data', data)
}

View File

@ -0,0 +1,53 @@
import faker from 'faker'
export default () => {
return `mutation {
o1: CreateOrganization(
id: "o1",
name: "Democracy Deutschland",
description: "Description for democracy-deutschland.",
disabled: false,
deleted: false
) { name }
o2: CreateOrganization(
id: "o2",
name: "Human-Connection",
description: "Description for human-connection.",
disabled: false,
deleted: false
) { name }
o3: CreateOrganization(
id: "o3",
name: "Pro Veg",
description: "Description for pro-veg.",
disabled: false,
deleted: false
) { name }
o4: CreateOrganization(
id: "o4",
name: "Greenpeace",
description: "Description for greenpeace.",
disabled: false,
deleted: false
) { name }
u1_c_o1: AddOrganizationCreatedBy(
from: { id: "u1" },
to: { id: "o1" }
) { from { id } }
u1_c_o2: AddOrganizationCreatedBy(
from: { id: "u1" },
to: { id: "o2" }
) { from { id } }
u2_o_o1: AddOrganizationOwnedBy(
from: { id: "u2" },
to: { id: "o2" }
) { from { id } }
u2_c_o3: AddOrganizationOwnedBy(
from: { id: "u2" },
to: { id: "o3" }
) { from { id } }
}
`
}

112
src/seed/data/posts.js Normal file
View File

@ -0,0 +1,112 @@
import faker from 'faker'
export default function (data) {
return `
mutation {
p1: CreatePost(
id: "p1",
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>",
image: "https://picsum.photos/1280/1024?image=352",
visibility: public,
disabled: false,
deleted: false
) { title }
p1_cat1: AddPostCategories(from: {id: "p1"}, to: {id: "cat1"}) { from { id } }
p1_cat2: AddPostCategories(from: {id: "p1"}, to: {id: "cat2"}) { from { id } }
ur1: AddUserContributions(from: { id: "u1" }, to: { id: "p1" }) { from { id } }
p1_t1: AddPostTags(
from: { id: "p1" }
to: { id: "t1" }
) { from { id } }
p1_t2: AddPostTags(
from: { id: "p1" }
to: { id: "t2" }
) { from { id } }
p1_t3: AddPostTags(
from: { id: "p1" }
to: { id: "t3" }
) { from { id } }
p2: CreatePost(
id: "p2",
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>",
image: "https://picsum.photos/1280/1024?image=72",
visibility: public,
disabled: false,
deleted: false
) { title }
p2_cat1: AddPostCategories(from: {id: "p2"}, to: {id: "cat1"}) { from { id } }
p2_cat16: AddPostCategories(from: {id: "p2"}, to: {id: "cat16"}) { from { id } }
ur2: AddUserContributions(from: { id: "u2" }, to: { id: "p2" }) { from { id } }
p2_t4: AddPostTags(
from: { id: "p2" }
to: { id: "t4" }
) { from { id } }
p3: CreatePost(
id: "p3",
title: "Hacker, Freaks und Funktionäre...Der CCC",
content: "${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()}",
image: "https://picsum.photos/1280/1024?image=121",
visibility: public,
disabled: false,
deleted: false
) { title }
p3_cat1: AddPostCategories(from: {id: "p3"}, to: {id: "cat1"}) { from { id } }
p3_cat3: AddPostCategories(from: {id: "p3"}, to: {id: "cat3"}) { from { id } }
p3_cat14: AddPostCategories(from: {id: "p3"}, to: {id: "cat14"}) { from { id } }
ur3: AddUserContributions(from: { id: "u3" }, to: { id: "p3" }) { from { id } }
p3_t2: AddPostTags(
from: { id: "p3" }
to: { id: "t2" }
) { from { id } }
p3_t4: AddPostTags(
from: { id: "p3" }
to: { id: "t4" }
) { from { id } }
p4: CreatePost(
id: "p4",
title: "Lebensmittel (?)",
content: "${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()}",
image: "https://picsum.photos/1280/1024?image=142",
visibility: public,
disabled: false,
deleted: false
) { title }
p4_cat1: AddPostCategories(from: {id: "p4"}, to: {id: "cat1"}) { from { id } }
p4_cat9: AddPostCategories(from: {id: "p4"}, to: {id: "cat9"}) { from { id } }
p4_cat4: AddPostCategories(from: {id: "p4"}, to: {id: "cat4"}) { from { id } }
ur4: AddUserContributions(from: { id: "u4" }, to: { id: "p4" }) { from { id } }
p5: CreatePost(
id: "p5",
title: "${faker.lorem.sentence()}",
content: "${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()}",
image: "https://picsum.photos/1280/1024?image=231",
visibility: public,
disabled: false,
deleted: false
) { title }
p5_cat8: AddPostCategories(from: {id: "p5"}, to: {id: "cat8"}) { from { id } }
p5_cat12: AddPostCategories(from: {id: "p5"}, to: {id: "cat12"}) { from { id } }
ur5: AddUserContributions(from: { id: "u2" }, to: { id: "p5" }) { from { id } }
p6: CreatePost(
id: "p6",
title: "${faker.lorem.sentence()}",
content: "${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()}",
image: "https://picsum.photos/1280/1024?image=424",
visibility: public,
disabled: false,
deleted: false
) { title }
p6_cat1: AddPostCategories(from: {id: "p6"}, to: {id: "cat1"}) { from { id } }
p6_cat2: AddPostCategories(from: {id: "p6"}, to: {id: "cat2"}) { from { id } }
p6_cat5: AddPostCategories(from: {id: "p6"}, to: {id: "cat5"}) { from { id } }
ur6: AddUserContributions(from: { id: "u4" }, to: { id: "p6" }) { from { id } }
}
`
}

22
src/seed/data/tags.js Normal file
View File

@ -0,0 +1,22 @@
export default function (data) {
return `
mutation {
t1: CreateTag(
id: "t1",
name: "Umwelt"
) { name }
t2: CreateTag(
id: "t2",
name: "Naturschutz"
) { name }
t3: CreateTag(
id: "t3",
name: "Demokratie"
) { name }
t4: CreateTag(
id: "t4",
name: "Freiheit"
) { name }
}
`
}

View File

@ -0,0 +1,7 @@
export default function (data) {
return `
mutation {
u1_blacklist_u4: AddUserBlacklisted(from: { id: "u1" }, to: { id: "u4" }) { from { id } }
}
`
}

View File

@ -0,0 +1,12 @@
export default function (data) {
return `
mutation {
b1_u1: AddUserBadges(from: {id: "b1"}, to: {id: "u1"}) { from { id } }
b2_u1: AddUserBadges(from: {id: "b2"}, to: {id: "u1"}) { from { id } }
b3_u1: AddUserBadges(from: {id: "b3"}, to: {id: "u1"}) { from { id } }
b6_u2: AddUserBadges(from: {id: "b6"}, to: {id: "u2"}) { from { id } }
b3_u3: AddUserBadges(from: {id: "b3"}, to: {id: "u3"}) { from { id } }
b5_u4: AddUserBadges(from: {id: "b5"}, to: {id: "u4"}) { from { id } }
}
`
}

View File

@ -0,0 +1,26 @@
export default function (data) {
return `
mutation {
u1_follow_u2: AddUserFollowing(
from: { id: "u1" },
to: { id: "u2" }
) { from { id } }
u2_follow_u1: AddUserFollowing(
from: { id: "u2" },
to: { id: "u1" }
) { from { id } }
u2_follow_u3: AddUserFollowing(
from: { id: "u2" },
to: { id: "u3" }
) { from { id } }
u2_follow_u4: AddUserFollowing(
from: { id: "u2" },
to: { id: "u4" }
) { from { id } }
u4_follow_u2: AddUserFollowing(
from: { id: "u4" },
to: { id: "u2" }
) { from { id } }
}
`
}

View File

@ -0,0 +1,14 @@
export default function (data) {
return `
mutation {
u1_friends_u2: AddUserFriends(
from: { id: "u1" },
to: { id: "u2" }
) { from { id } }
u1_friends_u3: AddUserFriends(
from: { id: "u1" },
to: { id: "u3" }
) { from { id } }
}
`
}

View File

@ -0,0 +1,30 @@
export default function (data) {
return `
mutation {
u1s2: AddUserShouted(
from: { id: "u1" },
to: { id: "p2" }
) { from { id } }
u1s3: AddUserShouted(
from: { id: "u1" },
to: { id: "p3" }
) { from { id } }
u2s1: AddUserShouted(
from: { id: "u2" },
to: { id: "p1" }
) { from { id } }
u3s1: AddUserShouted(
from: { id: "u3" },
to: { id: "p1" }
) { from { id } }
u3s4: AddUserShouted(
from: { id: "u3" },
to: { id: "p4" }
) { from { id } }
u4s1: AddUserShouted(
from: { id: "u4" },
to: { id: "p1" }
) { from { id } }
}
`
}

68
src/seed/data/users.js Normal file
View File

@ -0,0 +1,68 @@
import faker from 'faker'
export default function (data) {
return `
mutation {
u1: CreateUser(
id: "u1",
name: "Peter Lustig",
password: "1234",
email: "admin@example.org",
avatar: "${faker.internet.avatar()}",
role: admin,
disabled: false,
deleted: false) {
id
name
email
avatar
role
}
u2: CreateUser(
id: "u2",
name: "Bob der Bausmeister",
password: "1234",
email: "moderator@example.org",
avatar: "${faker.internet.avatar()}",
role: moderator,
disabled: false,
deleted: false) {
id
name
email
avatar
role
}
u3: CreateUser(
id: "u3",
name: "Jenny Rostock",
password: "1234",
email: "user@example.org",
avatar: "${faker.internet.avatar()}",
role: user,
disabled: false,
deleted: false) {
id
name
email
avatar
role
}
u4: CreateUser(
id: "u4",
name: "Angie Banjie",
password: "1234",
email: "angie@example.org",
avatar: "${faker.internet.avatar()}",
role: user,
disabled: false,
deleted: false) {
id
name
email
avatar
role
}
}
`
}

View File

@ -1,21 +1,20 @@
import ApolloClient from "apollo-client";
import dotenv from "dotenv";
import gql from 'graphql-tag'
import seedMutations from "./seed-mutations";
import fetch from "node-fetch";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import Seed from './data/index'
dotenv.config();
if (process.env.NODE_ENV === 'production') {
throw new Error('YOU CAN`T SEED IN PRODUCTION MODE')
}
const client = new ApolloClient({
link: new HttpLink({ uri: process.env.GRAPHQL_URI, fetch }),
cache: new InMemoryCache()
});
client
.mutate({
mutation: gql(seedMutations)
})
.then(data => console.log(data))
.catch(error => console.error(error));
Seed(client)

145
src/seed/seed-helpers.js Normal file
View File

@ -0,0 +1,145 @@
const _ = require('lodash')
const faker = require('faker')
const unsplashTopics = [
'love',
'family',
'spring',
'business',
'nature',
'travel',
'happy',
'landscape',
'health',
'friends',
'computer',
'autumn',
'space',
'animal',
'smile',
'face',
'people',
'portrait',
'amazing'
]
let unsplashTopicsTmp = []
const ngoLogos = [
'http://www.fetchlogos.com/wp-content/uploads/2015/11/Girl-Scouts-Of-The-Usa-Logo.jpg',
'http://logos.textgiraffe.com/logos/logo-name/Ngo-designstyle-friday-m.png',
'http://seeklogo.com/images/N/ngo-logo-BD53A3E024-seeklogo.com.png',
'https://dcassetcdn.com/design_img/10133/25833/25833_303600_10133_image.jpg',
'https://cdn.tutsplus.com/vector/uploads/legacy/articles/08bad_ngologos/20.jpg',
'https://cdn.tutsplus.com/vector/uploads/legacy/articles/08bad_ngologos/33.jpg',
null
]
const difficulties = ['easy', 'medium', 'hard']
export default {
randomItem: (items, filter) => {
let ids = filter
? Object.keys(items)
.filter(id => {
return filter(items[id])
})
: _.keys(items)
let randomIds = _.shuffle(ids)
return items[randomIds.pop()]
},
randomItems: (items, key = '_id', min = 1, max = 1) => {
let randomIds = _.shuffle(_.keys(items))
let res = []
const count = _.random(min, max)
for (let i = 0; i < count; i++) {
let r = items[randomIds.pop()][key]
if (key === '_id') {
r = r.toString()
}
res.push(r)
}
return res
},
random: (items) => {
return _.shuffle(items).pop()
},
randomDifficulty: () => {
return _.shuffle(difficulties).pop()
},
randomLogo: () => {
return _.shuffle(ngoLogos).pop()
},
randomUnsplashUrl: () => {
if (Math.random() < 0.6) {
// do not attach images in 60 percent of the cases (faster seeding)
return
}
if (unsplashTopicsTmp.length < 2) {
unsplashTopicsTmp = _.shuffle(unsplashTopics)
}
return 'https://source.unsplash.com/daily?' + unsplashTopicsTmp.pop() + ',' + unsplashTopicsTmp.pop()
},
randomCategories: (seederstore, allowEmpty = false) => {
let count = Math.round(Math.random() * 3)
if (allowEmpty === false && count === 0) {
count = 1
}
let categorieIds = _.shuffle(_.keys(seederstore.categories))
let ids = []
for (let i = 0; i < count; i++) {
ids.push(categorieIds.pop())
}
return ids
},
randomAddresses: () => {
const count = Math.round(Math.random() * 3)
let addresses = []
for (let i = 0; i < count; i++) {
addresses.push({
city: faker.address.city(),
zipCode: faker.address.zipCode(),
street: faker.address.streetAddress(),
country: faker.address.countryCode(),
lat: 54.032726 - (Math.random() * 10),
lng: 6.558838 + (Math.random() * 10)
})
}
return addresses
},
/**
* Get array of ids from the given seederstore items after mapping them by the key in the values
*
* @param items items from the seederstore
* @param values values for which you need the ids
* @param key the field key that is represented in the values (slug, name, etc.)
*/
mapIdsByKey: (items, values, key) => {
let res = []
values.forEach(value => {
res.push(_.find(items, [key, value])._id.toString())
})
return res
},
/**
* Provide a way to iterate for each element in an array while waiting for async functions to finish
*
* @param array
* @param callback
* @returns {Promise<void>}
*/
asyncForEach: async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
},
genInviteCode: () => {
const chars = '23456789abcdefghkmnpqrstuvwxyzABCDEFGHJKLMNPRSTUVWXYZ'
let code = ''
for (let i = 0; i < 8; i++) {
const n = _.random(0, chars.length-1)
code += chars.substr(n, 1)
}
return code
}
}

View File

@ -1,420 +0,0 @@
import faker from 'faker'
export default `
mutation {
# Users
u1: CreateUser(
id: "u1",
name: "Peter Lustig",
password: "1234",
email: "admin@example.org",
avatar: "${faker.internet.avatar()}",
role: admin,
disabled: false,
deleted: false) {
id
name
email
avatar
role
}
u2: CreateUser(
id: "u2",
name: "Bob der Bausmeister",
password: "1234",
email: "moderator@example.org",
avatar: "${faker.internet.avatar()}",
role: moderator,
disabled: false,
deleted: false) {
id
name
email
avatar
role
}
u3: CreateUser(
id: "u3",
name: "Jenny Rostock",
password: "1234",
email: "user@example.org",
avatar: "${faker.internet.avatar()}",
role: user,
disabled: false,
deleted: false) {
id
name
email
avatar
role
}
u4: CreateUser(
id: "u4",
name: "Angie Banjie",
password: "1234",
email: "angie@example.org",
avatar: "${faker.internet.avatar()}",
role: user,
disabled: false,
deleted: false) {
id
name
email
avatar
role
}
u1_blacklist_u4: AddUserBlacklisted(from: { id: "u1" }, to: { id: "u4" }) { from { id } }
# Badges
b1: CreateBadge(id: "b1", key: "indiegogo_en_racoon", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_racoon.svg") { id }
b2: CreateBadge(id: "b2", key: "indiegogo_en_rabbit", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_rabbit.svg") { id }
b3: CreateBadge(id: "b3", key: "indiegogo_en_wolf", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_wolf.svg") { id }
b4: CreateBadge(id: "b4", key: "indiegogo_en_bear", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_bear.svg") { id }
b5: CreateBadge(id: "b5", key: "indiegogo_en_turtle", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_turtle.svg") { id }
b6: CreateBadge(id: "b6", key: "indiegogo_en_rhino", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_rhino.svg") { id }
b1_u1: AddUserBadges(from: {id: "b1"}, to: {id: "u1"}) { from { id } }
b2_u1: AddUserBadges(from: {id: "b2"}, to: {id: "u1"}) { from { id } }
b3_u1: AddUserBadges(from: {id: "b3"}, to: {id: "u1"}) { from { id } }
b6_u2: AddUserBadges(from: {id: "b6"}, to: {id: "u2"}) { from { id } }
b3_u3: AddUserBadges(from: {id: "b3"}, to: {id: "u3"}) { from { id } }
b5_u4: AddUserBadges(from: {id: "b5"}, to: {id: "u4"}) { from { id } }
# categories
cat1: CreateCategory( id: "cat1", name: "Just For Fun", slug: "justforfun", icon: "smile" ) { name }
cat2: CreateCategory( id: "cat2", name: "Happyness & Values", slug: "happyness-values", icon: "heart-o" ) { name }
cat3: CreateCategory( id: "cat3", name: "Health & Wellbeing", slug: "health-wellbeing", icon: "medkit" ) { name }
cat4: CreateCategory( id: "cat4", name: "Environment & Nature", slug: "environment-nature", icon: "tree" ) { name }
cat5: CreateCategory( id: "cat5", name: "Animal Protection", slug: "animalprotection", icon: "paw" ) { name }
cat6: CreateCategory( id: "cat6", name: "Humanrights Justice", slug: "humanrights-justice", icon: "balance-scale" ) { name }
cat7: CreateCategory( id: "cat7", name: "Education & Sciences", slug: "education-sciences", icon: "graduation-cap" ) { name }
cat8: CreateCategory( id: "cat8", name: "Cooperation & Development", slug: "cooperation-development", icon: "users" ) { name }
cat9: CreateCategory( id: "cat9", name: "Democracy & Politics", slug: "democracy-politics", icon: "university" ) { name }
cat10: CreateCategory( id: "cat10", name: "Economy & Finances", slug: "economy-finances", icon: "money" ) { name }
cat11: CreateCategory( id: "cat11", name: "Energy & Technology", slug: "energy-technology", icon: "flash" ) { name }
cat12: CreateCategory( id: "cat12", name: "IT, Internet & Data Privacy", slug: "it-internet-dataprivacy", icon: "mouse-pointer" ) { name }
cat13: CreateCategory( id: "cat13", name: "Art, Curlure & Sport", slug: "art-culture-sport", icon: "paint-brush" ) { name }
cat14: CreateCategory( id: "cat14", name: "Freedom of Speech", slug: "freedomofspeech", icon: "bullhorn" ) { name }
cat15: CreateCategory( id: "cat15", name: "Consumption & Sustainability", slug: "consumption-sustainability", icon: "shopping-cart" ) { name }
cat16: CreateCategory( id: "cat16", name: "Global Peace & Nonviolence", slug: "globalpeace-nonviolence", icon: "angellist" ) { name }
# Posts
p1: CreatePost(
id: "p1",
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>",
image: "https://picsum.photos/1280/1024?image=352",
visibility: public,
disabled: false,
deleted: false
) { title }
p1_cat1: AddPostCategories(from: {id: "p1"}, to: {id: "cat1"}) { from { id } }
p1_cat2: AddPostCategories(from: {id: "p1"}, to: {id: "cat2"}) { from { id } }
ur1: AddUserContributions(from: { id: "u1" }, to: { id: "p1" }) { from { id } }
p2: CreatePost(
id: "p2",
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>",
image: "https://picsum.photos/1280/1024?image=72",
visibility: public,
disabled: false,
deleted: false
) { title }
p2_cat1: AddPostCategories(from: {id: "p2"}, to: {id: "cat1"}) { from { id } }
p2_cat16: AddPostCategories(from: {id: "p2"}, to: {id: "cat16"}) { from { id } }
ur2: AddUserContributions(from: { id: "u2" }, to: { id: "p2" }) { from { id } }
p3: CreatePost(
id: "p3",
title: "Hacker, Freaks und Funktionäre...Der CCC",
content: "${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()}",
image: "https://picsum.photos/1280/1024?image=121",
visibility: public,
disabled: false,
deleted: false
) { title }
p3_cat1: AddPostCategories(from: {id: "p3"}, to: {id: "cat1"}) { from { id } }
p3_cat3: AddPostCategories(from: {id: "p3"}, to: {id: "cat3"}) { from { id } }
p3_cat14: AddPostCategories(from: {id: "p3"}, to: {id: "cat14"}) { from { id } }
ur3: AddUserContributions(from: { id: "u3" }, to: { id: "p3" }) { from { id } }
p4: CreatePost(
id: "p4",
title: "Lebensmittel (?)",
content: "${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()}",
image: "https://picsum.photos/1280/1024?image=142",
visibility: public,
disabled: false,
deleted: false
) { title }
p4_cat1: AddPostCategories(from: {id: "p4"}, to: {id: "cat1"}) { from { id } }
p4_cat9: AddPostCategories(from: {id: "p4"}, to: {id: "cat9"}) { from { id } }
p4_cat4: AddPostCategories(from: {id: "p4"}, to: {id: "cat4"}) { from { id } }
ur4: AddUserContributions(from: { id: "u4" }, to: { id: "p4" }) { from { id } }
p5: CreatePost(
id: "p5",
title: "${faker.lorem.sentence()}",
content: "${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()}",
image: "https://picsum.photos/1280/1024?image=231",
visibility: public,
disabled: false,
deleted: false
) { title }
p5_cat8: AddPostCategories(from: {id: "p5"}, to: {id: "cat8"}) { from { id } }
p5_cat12: AddPostCategories(from: {id: "p5"}, to: {id: "cat12"}) { from { id } }
ur5: AddUserContributions(from: { id: "u2" }, to: { id: "p5" }) { from { id } }
p6: CreatePost(
id: "p6",
title: "${faker.lorem.sentence()}",
content: "${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()} ${faker.lorem.sentence()}",
image: "https://picsum.photos/1280/1024?image=424",
visibility: public,
disabled: false,
deleted: false
) { title }
p6_cat1: AddPostCategories(from: {id: "p6"}, to: {id: "cat1"}) { from { id } }
p6_cat2: AddPostCategories(from: {id: "p6"}, to: {id: "cat2"}) { from { id } }
p6_cat5: AddPostCategories(from: {id: "p6"}, to: {id: "cat5"}) { from { id } }
ur6: AddUserContributions(from: { id: "u4" }, to: { id: "p6" }) { from { id } }
# Comments
c1: CreateComment(
id: "c1",
content: "<p>da stimm ich dir zu. Mir ging das auch nie in den kopf, und hatte jesus nie als gott gesehen. </p>",
disabled: false,
deleted: false
) { id }
c1_u1: AddCommentAuthor(from: { id: "u3" }, to: { id: "c1" }, data: { timestamp: 1538655020 }) { from { id } }
c2: CreateComment(
id: "c2",
content: "<p>Schön das es dich gibt ❤️❤️❤️❤️❤️❤️❤️❤️❤️</p>",
disabled: false,
deleted: false
) { id }
c2_u1: AddCommentAuthor(from: { id: "u1" }, to: { id: "c2" }, data: { timestamp: 1538655020 }) { from { id } }
c3: CreateComment(
id: "c3",
content: "<p>Hi Dieter,</p><p>danke für Deine Info. Hast Du mal ein Foto von Deinem Cabrio mit dem Logo drauf?</p>",
disabled: false,
deleted: false
) { id }
c3_u2: AddCommentAuthor(from: { id: "u1" }, to: { id: "c3" }, data: { timestamp: 1538655020 }) { from { id } }
c4: CreateComment(
id: "c4",
content: "<p>Das Zusammenführen aller Gruppen, die mit uns am gleichen Strang in die gleiche Richtung ziehen, in eine gemeinsame Adressenstruktur sehe ich auch als Haupt - Aufgabe für unsere neue Netzwerkbildung an.</p>",
disabled: false,
deleted: false
) { id }
c4_u3: AddCommentAuthor(from: { id: "u4" }, to: { id: "c4" }, data: { timestamp: 1538655020 }) { from { id } }
c5: CreateComment(
id: "c5",
content: "${faker.lorem.paragraph()}",
disabled: false,
deleted: false
) { id }
c5_u4: AddCommentAuthor(from: { id: "u4" }, to: { id: "c5" }, data: { timestamp: 1538655020 }) { from { id } }
c6: CreateComment(
id: "c6",
content: "${faker.lorem.paragraph()}",
disabled: false,
deleted: false
) { id }
c6_u3: AddCommentAuthor(from: { id: "u3" }, to: { id: "c6" }, data: { timestamp: 1538655020 }) { from { id } }
c7: CreateComment(
id: "c7",
content: "${faker.lorem.paragraph()}",
disabled: false,
deleted: false
) { id }
c7_u2: AddCommentAuthor(from: { id: "u2" }, to: { id: "c7" }, data: { timestamp: 1538655020 }) { from { id } }
c1_p1: AddCommentPost(
from: { id: "c1" },
to: { id: "p1" }
) { from { id } }
c2_p1: AddCommentPost(
from: { id: "c2" },
to: { id: "p1" }
) { from { id } }
c3_p3: AddCommentPost(
from: { id: "c3" },
to: { id: "p3" }
) { from { id } }
c4_p2: AddCommentPost(
from: { id: "c4" },
to: { id: "p2" }
) { from { id } }
c5_p3: AddCommentPost(
from: { id: "c5" },
to: { id: "p3" }
) { from { id } }
c6_p4: AddCommentPost(
from: { id: "c6" },
to: { id: "p4" }
) { from { id } }
c6_p1: AddCommentPost(
from: { id: "c6" },
to: { id: "p1" }
) { from { id } }
c7_p2: AddCommentPost(
from: { id: "c7" },
to: { id: "p2" }
) { from { id } }
# Tags
t1: CreateTag(
id: "t1",
name: "Umwelt"
) { name }
t2: CreateTag(
id: "t2",
name: "Naturschutz"
) { name }
t3: CreateTag(
id: "t3",
name: "Demokratie"
) { name }
t4: CreateTag(
id: "t4",
name: "Freiheit"
) { name }
p1_t1: AddPostTags(
from: { id: "p1" }
to: { id: "t1" }
) { from { id } }
p1_t2: AddPostTags(
from: { id: "p1" }
to: { id: "t2" }
) { from { id } }
p1_t3: AddPostTags(
from: { id: "p1" }
to: { id: "t3" }
) { from { id } }
p2_t4: AddPostTags(
from: { id: "p2" }
to: { id: "t4" }
) { from { id } }
p3_t2: AddPostTags(
from: { id: "p3" }
to: { id: "t2" }
) { from { id } }
p3_t4: AddPostTags(
from: { id: "p3" }
to: { id: "t4" }
) { from { id } }
o1: CreateOrganization(
id: "o1",
name: "Democracy Deutschland",
description: "Description for democracy-deutschland.",
disabled: false,
deleted: false
) { name }
o2: CreateOrganization(
id: "o2",
name: "Human-Connection",
description: "Description for human-connection.",
disabled: false,
deleted: false
) { name }
o3: CreateOrganization(
id: "o3",
name: "Pro Veg",
description: "Description for pro-veg.",
disabled: false,
deleted: false
) { name }
o4: CreateOrganization(
id: "o4",
name: "Greenpeace",
description: "Description for greenpeace.",
disabled: false,
deleted: false
) { name }
u1_c_o1: AddOrganizationCreatedBy(
from: { id: "u1" },
to: { id: "o1" }
) { from { id } }
u1_c_o2: AddOrganizationCreatedBy(
from: { id: "u1" },
to: { id: "o2" }
) { from { id } }
u2_o_o1: AddOrganizationOwnedBy(
from: { id: "u2" },
to: { id: "o2" }
) { from { id } }
u2_c_o3: AddOrganizationOwnedBy(
from: { id: "u2" },
to: { id: "o3" }
) { from { id } }
u1_friends_u2: AddUserFriends(
from: { id: "u1" },
to: { id: "u2" }
) { from { id } }
u1_friends_u3: AddUserFriends(
from: { id: "u1" },
to: { id: "u3" }
) { from { id } }
u1_follow_u2: AddUserFollowing(
from: { id: "u1" },
to: { id: "u2" }
) { from { id } }
u2_follow_u1: AddUserFollowing(
from: { id: "u2" },
to: { id: "u1" }
) { from { id } }
u2_follow_u3: AddUserFollowing(
from: { id: "u2" },
to: { id: "u3" }
) { from { id } }
u2_follow_u4: AddUserFollowing(
from: { id: "u2" },
to: { id: "u4" }
) { from { id } }
u4_follow_u2: AddUserFollowing(
from: { id: "u4" },
to: { id: "u2" }
) { from { id } }
u1s2: AddUserShouted(
from: { id: "u1" },
to: { id: "p2" }
) { from { id } }
u1s3: AddUserShouted(
from: { id: "u1" },
to: { id: "p3" }
) { from { id } }
u2s1: AddUserShouted(
from: { id: "u2" },
to: { id: "p1" }
) { from { id } }
u3s1: AddUserShouted(
from: { id: "u3" },
to: { id: "p1" }
) { from { id } }
u3s4: AddUserShouted(
from: { id: "u3" },
to: { id: "p4" }
) { from { id } }
u4s1: AddUserShouted(
from: { id: "u4" },
to: { id: "p1" }
) { from { id } }
}
`

File diff suppressed because it is too large Load Diff

3346
yarn.lock

File diff suppressed because it is too large Load Diff