From e46c8d18e5da4caf34246d2b5e52d28d3801e6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 21:32:53 +0100 Subject: [PATCH 1/8] Implement public folder --- src/middleware/fixImageUrlsMiddleware.js | 2 +- src/middleware/fixImageUrlsMiddleware.spec.js | 4 ++-- src/server.js | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/middleware/fixImageUrlsMiddleware.js b/src/middleware/fixImageUrlsMiddleware.js index c3b828da..e5dc47a6 100644 --- a/src/middleware/fixImageUrlsMiddleware.js +++ b/src/middleware/fixImageUrlsMiddleware.js @@ -7,7 +7,7 @@ const legacyUrls = [ export const fixUrl = (url) => { legacyUrls.forEach((legacyUrl) => { - url = url.replace(legacyUrl, '') + url = url.replace(legacyUrl, '/api') }) return url } diff --git a/src/middleware/fixImageUrlsMiddleware.spec.js b/src/middleware/fixImageUrlsMiddleware.spec.js index 081154c5..89d2a520 100644 --- a/src/middleware/fixImageUrlsMiddleware.spec.js +++ b/src/middleware/fixImageUrlsMiddleware.spec.js @@ -4,14 +4,14 @@ describe('fixImageURLs', () => { describe('image url of legacy alpha', () => { it('removes domain', () => { const url = 'https://api-alpha.human-connection.org/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png' - expect(fixImageURLs(url)).toEqual('/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png') + expect(fixImageURLs(url)).toEqual('/api/uploads/4bfaf9172c4ba03d7645108bbbd16f0a696a37d01eacd025fb131e5da61b15d9.png') }) }) describe('image url of legacy staging', () => { it('removes domain', () => { const url = 'https://staging-api.human-connection.org/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg' - expect(fixImageURLs(url)).toEqual('/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg') + expect(fixImageURLs(url)).toEqual('/api/uploads/1b3c39a24f27e2fb62b69074b2f71363b63b263f0c4574047d279967124c026e.jpeg') }) }) diff --git a/src/server.js b/src/server.js index 76e8419b..72823756 100644 --- a/src/server.js +++ b/src/server.js @@ -2,6 +2,7 @@ import { GraphQLServer } from 'graphql-yoga' import { makeExecutableSchema } from 'apollo-server' import { augmentSchema } from 'neo4j-graphql-js' import { typeDefs, resolvers } from './graphql-schema' +import express from 'express' import dotenv from 'dotenv' import mocks from './mocks' import middleware from './middleware' @@ -68,6 +69,7 @@ const createServer = (options) => { passport.use('jwt', jwtStrategy(driver)) server.express.use(passport.initialize()) + server.express.use(express.static('public')) server.express.post('/graphql', passport.authenticate(['jwt'], { session: false })) return server From 509e4feeb9ec6c289a7fd49d097aa5e8182ea94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 22:12:50 +0100 Subject: [PATCH 2/8] Add workflow to download remote uploads * remote uploads directory * download content of uploads directory with `scp` * share uploads volume with backend container --- db-migration-worker/import.sh | 4 +++- docker-compose.override.yml | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/db-migration-worker/import.sh b/db-migration-worker/import.sh index ba07217c..cb7e82ce 100755 --- a/db-migration-worker/import.sh +++ b/db-migration-worker/import.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -for var in "SSH_USERNAME" "SSH_HOST" "MONGODB_USERNAME" "MONGODB_PASSWORD" "MONGODB_DATABASE" "MONGODB_AUTH_DB" +for var in "SSH_USERNAME" "SSH_HOST" "MONGODB_USERNAME" "MONGODB_PASSWORD" "MONGODB_DATABASE" "MONGODB_AUTH_DB" "UPLOADS_DIRECTORY" do if [[ -z "${!var}" ]]; then echo "${var} is undefined" @@ -14,6 +14,7 @@ echo "MONGODB_USERNAME ${MONGODB_USERNAME}" echo "MONGODB_PASSWORD ${MONGODB_PASSWORD}" echo "MONGODB_DATABASE ${MONGODB_DATABASE}" echo "MONGODB_AUTH_DB ${MONGODB_AUTH_DB}" +echo "UPLOADS_DIRECTORY ${UPLOADS_DIRECTORY}" echo "-------------------------------------------------" mongo ${MONGODB_DATABASE} --eval "db.dropDatabase();" @@ -21,6 +22,7 @@ rm -f /mongo-export/* ssh -4 -M -S my-ctrl-socket -fnNT -L 27018:localhost:27017 -l ${SSH_USERNAME} ${SSH_HOST} mongodump --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --gzip --archive | mongorestore --gzip --archive +scp -r ${SSH_USERNAME}@${SSH_HOST}:${UPLOADS_DIRECTORY}/* /uploads/ ssh -S my-ctrl-socket -O check -l ${SSH_USERNAME} ${SSH_HOST} ssh -S my-ctrl-socket -O exit -l ${SSH_USERNAME} ${SSH_HOST} diff --git a/docker-compose.override.yml b/docker-compose.override.yml index c5e7d5cf..0592b801 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -9,6 +9,7 @@ services: volumes: - .:/nitro-backend - /nitro-backend/node_modules + - uploads:/nitro-backend/public/uploads command: yarn run dev neo4j: volumes: @@ -24,6 +25,7 @@ services: context: db-migration-worker volumes: - mongo-export:/mongo-export + - uploads:/uploads - ./db-migration-worker/.ssh/:/root/.ssh/ networks: - hc-network @@ -34,7 +36,9 @@ services: - "MONGODB_PASSWORD=${MONGODB_PASSWORD}" - "MONGODB_AUTH_DB=${MONGODB_AUTH_DB}" - "MONGODB_DATABASE=${MONGODB_DATABASE}" + - "UPLOADS_DIRECTORY=${UPLOADS_DIRECTORY}" command: "--smallfiles --logpath=/dev/null" volumes: mongo-export: + uploads: From c9b8b23915fd7ee191ad2364705039ef157667fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 22:17:00 +0100 Subject: [PATCH 3/8] Keep public folder empty --- .dockerignore | 2 ++ .gitignore | 2 ++ public/.gitkeep | 0 3 files changed, 4 insertions(+) create mode 100644 public/.gitkeep diff --git a/.dockerignore b/.dockerignore index f5a08be3..161805c9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,3 +18,5 @@ dist/ db-migration-worker/ neo4j/ + +public/ diff --git a/.gitignore b/.gitignore index a5e98795..e34da736 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ yarn-error.log dist/* coverage.lcov .nyc_output/ +public/* +!.gitkeep diff --git a/public/.gitkeep b/public/.gitkeep new file mode 100644 index 00000000..e69de29b From 2cab6fe9cf13fa8582d33eda8c1a7c73b4992c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 22:33:32 +0100 Subject: [PATCH 4/8] Replace `scp` with `rsync` `rsync` is faster on multiple runs. The `--update` flag will only download newer images and does not overwrite existing files. Thus, it will only download missing images. --- db-migration-worker/Dockerfile | 2 +- db-migration-worker/import.sh | 3 ++- neo4j/import/todo | 7 ------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/db-migration-worker/Dockerfile b/db-migration-worker/Dockerfile index 92dff618..025be88a 100644 --- a/db-migration-worker/Dockerfile +++ b/db-migration-worker/Dockerfile @@ -1,7 +1,7 @@ FROM mongo:4 RUN apt-get update \ - && apt-get -y install --no-install-recommends openssh-client \ + && apt-get -y install --no-install-recommends openssh-client rsync \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* COPY .ssh /root/.ssh/ diff --git a/db-migration-worker/import.sh b/db-migration-worker/import.sh index cb7e82ce..0251a358 100755 --- a/db-migration-worker/import.sh +++ b/db-migration-worker/import.sh @@ -22,10 +22,11 @@ rm -f /mongo-export/* ssh -4 -M -S my-ctrl-socket -fnNT -L 27018:localhost:27017 -l ${SSH_USERNAME} ${SSH_HOST} mongodump --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --gzip --archive | mongorestore --gzip --archive -scp -r ${SSH_USERNAME}@${SSH_HOST}:${UPLOADS_DIRECTORY}/* /uploads/ ssh -S my-ctrl-socket -O check -l ${SSH_USERNAME} ${SSH_HOST} ssh -S my-ctrl-socket -O exit -l ${SSH_USERNAME} ${SSH_HOST} +rsync --archive --update --verbose ${SSH_USERNAME}@${SSH_HOST}:${UPLOADS_DIRECTORY}/* /uploads/ + for collection in "categories" "badges" "users" "contributions" "comments" "follows" "shouts" do mongoexport --db ${MONGODB_DATABASE} --collection $collection --out "/mongo-export/$collection.json" diff --git a/neo4j/import/todo b/neo4j/import/todo index 0b86c8bc..0e0f259f 100644 --- a/neo4j/import/todo +++ b/neo4j/import/todo @@ -4,7 +4,6 @@ ON CREATE SET c.name = category.title, c.slug = category.slug, c.icon = category.icon - CALL apoc.load.json('file:/mongo-export/badges.json') YIELD value as badge MERGE(b:Badge {id: badge._id["$oid"]}) ON CREATE SET b.key = badge.key, @@ -12,17 +11,11 @@ ON CREATE SET b.key = badge.key, b.icon = badge.image.path, b.status = badge.status - - - - - CALL apoc.load.json('file:/mongo-export/follows.json') YIELD value as follow MATCH (u1:User {id: follow.userId}), (u2:User {id: follow.foreignId}) MERGE (u1)-[:FOLLOWS]->(u2) - CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout MATCH (u:User {id: shout.userId}), (p:Post {id: shout.foreignId}) From f69a0daeefdab5e57af8d1d488a7de6d3529f706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 23:13:32 +0100 Subject: [PATCH 5/8] Import categories, manually assign correct icon Big fun :+1: --- neo4j/import/categories.cql | 89 +++++++++++++++++++++++++++++++++++++ neo4j/import/import.sh | 2 +- neo4j/import/todo | 6 --- 3 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 neo4j/import/categories.cql diff --git a/neo4j/import/categories.cql b/neo4j/import/categories.cql new file mode 100644 index 00000000..a2bf6a35 --- /dev/null +++ b/neo4j/import/categories.cql @@ -0,0 +1,89 @@ +CALL apoc.load.json('file:/mongo-export/categories.json') YIELD value as category +MERGE(c:Category {id: category._id["$oid"]}) +ON CREATE SET +c.name = category.title, +c.slug = category.slug, +c.icon = category.icon, +c.createdAt = category.createdAt.`$date`, +c.updatedAt = category.updatedAt.`$date` +; + +MATCH (c:Category) +WHERE (c.icon = "categories-justforfun") +SET c.icon = 'smile' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-luck") +SET c.icon = 'heart-o' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-health") +SET c.icon = 'medkit' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-environment") +SET c.icon = 'tree' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-animal-justice") +SET c.icon = 'paw' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-human-rights") +SET c.icon = 'balance-scale' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-education") +SET c.icon = 'graduation-cap' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-cooperation") +SET c.icon = 'users' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-politics") +SET c.icon = 'university' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-economy") +SET c.icon = 'money' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-technology") +SET c.icon = 'flash' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-internet") +SET c.icon = 'mouse-pointer' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-art") +SET c.icon = 'paint-brush' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-freedom-of-speech") +SET c.icon = 'bullhorn' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-sustainability") +SET c.icon = 'shopping-cart' +; + +MATCH (c:Category) +WHERE (c.icon = "categories-peace") +SET c.icon = 'angellist' +; diff --git a/neo4j/import/import.sh b/neo4j/import/import.sh index 319f1a59..7c457199 100755 --- a/neo4j/import/import.sh +++ b/neo4j/import/import.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;" | cypher-shell -for collection in "users" "contributions" "comments" +for collection in "categories" "users" "contributions" "comments" do echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql done diff --git a/neo4j/import/todo b/neo4j/import/todo index 0e0f259f..8ee1bb83 100644 --- a/neo4j/import/todo +++ b/neo4j/import/todo @@ -1,9 +1,3 @@ -CALL apoc.load.json('file:/mongo-export/categories.json') YIELD value as category -MERGE(c:Category {id: category._id["$oid"]}) -ON CREATE SET c.name = category.title, - c.slug = category.slug, - c.icon = category.icon - CALL apoc.load.json('file:/mongo-export/badges.json') YIELD value as badge MERGE(b:Badge {id: badge._id["$oid"]}) ON CREATE SET b.key = badge.key, From ce7ce4027265189dd2ed32f30bf1da44ea6c722d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 23:26:45 +0100 Subject: [PATCH 6/8] Import badges --- .dockerignore | 3 ++- .gitignore | 2 +- neo4j/import/badges.cql | 10 ++++++++++ neo4j/import/import.sh | 2 +- public/img/badges/fundraisingbox_de_airship.svg | 1 + public/img/badges/fundraisingbox_de_alienship.svg | 1 + public/img/badges/fundraisingbox_de_balloon.svg | 1 + public/img/badges/fundraisingbox_de_bigballoon.svg | 1 + public/img/badges/fundraisingbox_de_crane.svg | 1 + public/img/badges/fundraisingbox_de_glider.svg | 1 + public/img/badges/fundraisingbox_de_helicopter.svg | 1 + public/img/badges/fundraisingbox_de_starter.svg | 1 + public/img/badges/indiegogo_en_bear.svg | 1 + public/img/badges/indiegogo_en_panda.svg | 1 + public/img/badges/indiegogo_en_rabbit.svg | 1 + public/img/badges/indiegogo_en_racoon.svg | 1 + public/img/badges/indiegogo_en_rhino.svg | 1 + public/img/badges/indiegogo_en_tiger.svg | 1 + public/img/badges/indiegogo_en_turtle.svg | 1 + public/img/badges/indiegogo_en_whale.svg | 1 + public/img/badges/indiegogo_en_wolf.svg | 1 + public/img/badges/user_role_admin.svg | 1 + public/img/badges/user_role_developer.svg | 1 + public/img/badges/user_role_moderator.svg | 1 + public/img/badges/wooold_de_bee.svg | 1 + public/img/badges/wooold_de_butterfly.svg | 1 + public/img/badges/wooold_de_double_rainbow.svg | 1 + public/img/badges/wooold_de_end_of_rainbow.svg | 1 + public/img/badges/wooold_de_flower.svg | 1 + public/img/badges/wooold_de_lifetree.svg | 1 + public/img/badges/wooold_de_magic_rainbow.svg | 1 + public/img/badges/wooold_de_super_founder.svg | 1 + 32 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 neo4j/import/badges.cql create mode 100644 public/img/badges/fundraisingbox_de_airship.svg create mode 100644 public/img/badges/fundraisingbox_de_alienship.svg create mode 100644 public/img/badges/fundraisingbox_de_balloon.svg create mode 100644 public/img/badges/fundraisingbox_de_bigballoon.svg create mode 100644 public/img/badges/fundraisingbox_de_crane.svg create mode 100644 public/img/badges/fundraisingbox_de_glider.svg create mode 100644 public/img/badges/fundraisingbox_de_helicopter.svg create mode 100644 public/img/badges/fundraisingbox_de_starter.svg create mode 100644 public/img/badges/indiegogo_en_bear.svg create mode 100644 public/img/badges/indiegogo_en_panda.svg create mode 100644 public/img/badges/indiegogo_en_rabbit.svg create mode 100644 public/img/badges/indiegogo_en_racoon.svg create mode 100644 public/img/badges/indiegogo_en_rhino.svg create mode 100644 public/img/badges/indiegogo_en_tiger.svg create mode 100644 public/img/badges/indiegogo_en_turtle.svg create mode 100644 public/img/badges/indiegogo_en_whale.svg create mode 100644 public/img/badges/indiegogo_en_wolf.svg create mode 100644 public/img/badges/user_role_admin.svg create mode 100644 public/img/badges/user_role_developer.svg create mode 100644 public/img/badges/user_role_moderator.svg create mode 100644 public/img/badges/wooold_de_bee.svg create mode 100644 public/img/badges/wooold_de_butterfly.svg create mode 100644 public/img/badges/wooold_de_double_rainbow.svg create mode 100644 public/img/badges/wooold_de_end_of_rainbow.svg create mode 100644 public/img/badges/wooold_de_flower.svg create mode 100644 public/img/badges/wooold_de_lifetree.svg create mode 100644 public/img/badges/wooold_de_magic_rainbow.svg create mode 100644 public/img/badges/wooold_de_super_founder.svg diff --git a/.dockerignore b/.dockerignore index 161805c9..dba77200 100644 --- a/.dockerignore +++ b/.dockerignore @@ -19,4 +19,5 @@ dist/ db-migration-worker/ neo4j/ -public/ +public/uploads/* +!.gitkeep diff --git a/.gitignore b/.gitignore index e34da736..cbfa0b7c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ yarn-error.log dist/* coverage.lcov .nyc_output/ -public/* +public/uploads/* !.gitkeep diff --git a/neo4j/import/badges.cql b/neo4j/import/badges.cql new file mode 100644 index 00000000..90e4755b --- /dev/null +++ b/neo4j/import/badges.cql @@ -0,0 +1,10 @@ +CALL apoc.load.json('file:/mongo-export/badges.json') YIELD value as badge +MERGE(b:Badge {id: badge._id["$oid"]}) +ON CREATE SET +b.key = badge.key, +b.type = badge.type, +b.icon = badge.image.path, +b.status = badge.status, +b.createdAt = badge.createdAt.`$date`, +b.updatedAt = badge.updatedAt.`$date` +; diff --git a/neo4j/import/import.sh b/neo4j/import/import.sh index 7c457199..86224d24 100755 --- a/neo4j/import/import.sh +++ b/neo4j/import/import.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;" | cypher-shell -for collection in "categories" "users" "contributions" "comments" +for collection in "badges" "categories" "users" "contributions" "comments" do echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql done diff --git a/public/img/badges/fundraisingbox_de_airship.svg b/public/img/badges/fundraisingbox_de_airship.svg new file mode 100644 index 00000000..078dcf4f --- /dev/null +++ b/public/img/badges/fundraisingbox_de_airship.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_alienship.svg b/public/img/badges/fundraisingbox_de_alienship.svg new file mode 100644 index 00000000..e891c5fa --- /dev/null +++ b/public/img/badges/fundraisingbox_de_alienship.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_balloon.svg b/public/img/badges/fundraisingbox_de_balloon.svg new file mode 100644 index 00000000..6fc436d8 --- /dev/null +++ b/public/img/badges/fundraisingbox_de_balloon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_bigballoon.svg b/public/img/badges/fundraisingbox_de_bigballoon.svg new file mode 100644 index 00000000..e2650963 --- /dev/null +++ b/public/img/badges/fundraisingbox_de_bigballoon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_crane.svg b/public/img/badges/fundraisingbox_de_crane.svg new file mode 100644 index 00000000..4904c5ec --- /dev/null +++ b/public/img/badges/fundraisingbox_de_crane.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_glider.svg b/public/img/badges/fundraisingbox_de_glider.svg new file mode 100644 index 00000000..0c15955d --- /dev/null +++ b/public/img/badges/fundraisingbox_de_glider.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_helicopter.svg b/public/img/badges/fundraisingbox_de_helicopter.svg new file mode 100644 index 00000000..3a84e446 --- /dev/null +++ b/public/img/badges/fundraisingbox_de_helicopter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/fundraisingbox_de_starter.svg b/public/img/badges/fundraisingbox_de_starter.svg new file mode 100644 index 00000000..99980560 --- /dev/null +++ b/public/img/badges/fundraisingbox_de_starter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_bear.svg b/public/img/badges/indiegogo_en_bear.svg new file mode 100644 index 00000000..43465a0e --- /dev/null +++ b/public/img/badges/indiegogo_en_bear.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_panda.svg b/public/img/badges/indiegogo_en_panda.svg new file mode 100644 index 00000000..a2f211e8 --- /dev/null +++ b/public/img/badges/indiegogo_en_panda.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_rabbit.svg b/public/img/badges/indiegogo_en_rabbit.svg new file mode 100644 index 00000000..c8c0c972 --- /dev/null +++ b/public/img/badges/indiegogo_en_rabbit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_racoon.svg b/public/img/badges/indiegogo_en_racoon.svg new file mode 100644 index 00000000..619cb75f --- /dev/null +++ b/public/img/badges/indiegogo_en_racoon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_rhino.svg b/public/img/badges/indiegogo_en_rhino.svg new file mode 100644 index 00000000..71c0eb1a --- /dev/null +++ b/public/img/badges/indiegogo_en_rhino.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_tiger.svg b/public/img/badges/indiegogo_en_tiger.svg new file mode 100644 index 00000000..88583a47 --- /dev/null +++ b/public/img/badges/indiegogo_en_tiger.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_turtle.svg b/public/img/badges/indiegogo_en_turtle.svg new file mode 100644 index 00000000..6b5431c2 --- /dev/null +++ b/public/img/badges/indiegogo_en_turtle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_whale.svg b/public/img/badges/indiegogo_en_whale.svg new file mode 100644 index 00000000..458e03b6 --- /dev/null +++ b/public/img/badges/indiegogo_en_whale.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/indiegogo_en_wolf.svg b/public/img/badges/indiegogo_en_wolf.svg new file mode 100644 index 00000000..e4952d86 --- /dev/null +++ b/public/img/badges/indiegogo_en_wolf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/user_role_admin.svg b/public/img/badges/user_role_admin.svg new file mode 100644 index 00000000..101e7458 --- /dev/null +++ b/public/img/badges/user_role_admin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/user_role_developer.svg b/public/img/badges/user_role_developer.svg new file mode 100644 index 00000000..55d363c9 --- /dev/null +++ b/public/img/badges/user_role_developer.svg @@ -0,0 +1 @@ +</> \ No newline at end of file diff --git a/public/img/badges/user_role_moderator.svg b/public/img/badges/user_role_moderator.svg new file mode 100644 index 00000000..bb2e5fde --- /dev/null +++ b/public/img/badges/user_role_moderator.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_bee.svg b/public/img/badges/wooold_de_bee.svg new file mode 100644 index 00000000..e716c611 --- /dev/null +++ b/public/img/badges/wooold_de_bee.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_butterfly.svg b/public/img/badges/wooold_de_butterfly.svg new file mode 100644 index 00000000..6d2b83e3 --- /dev/null +++ b/public/img/badges/wooold_de_butterfly.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_double_rainbow.svg b/public/img/badges/wooold_de_double_rainbow.svg new file mode 100644 index 00000000..40600118 --- /dev/null +++ b/public/img/badges/wooold_de_double_rainbow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_end_of_rainbow.svg b/public/img/badges/wooold_de_end_of_rainbow.svg new file mode 100644 index 00000000..2ae24cb7 --- /dev/null +++ b/public/img/badges/wooold_de_end_of_rainbow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_flower.svg b/public/img/badges/wooold_de_flower.svg new file mode 100644 index 00000000..ffc4b3da --- /dev/null +++ b/public/img/badges/wooold_de_flower.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_lifetree.svg b/public/img/badges/wooold_de_lifetree.svg new file mode 100644 index 00000000..5a89fa5f --- /dev/null +++ b/public/img/badges/wooold_de_lifetree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_magic_rainbow.svg b/public/img/badges/wooold_de_magic_rainbow.svg new file mode 100644 index 00000000..74df9519 --- /dev/null +++ b/public/img/badges/wooold_de_magic_rainbow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/badges/wooold_de_super_founder.svg b/public/img/badges/wooold_de_super_founder.svg new file mode 100644 index 00000000..b437f638 --- /dev/null +++ b/public/img/badges/wooold_de_super_founder.svg @@ -0,0 +1 @@ + \ No newline at end of file From 932a593cfa3cbefff6aee3f0b4cdbfd2f601749a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 23:38:48 +0100 Subject: [PATCH 7/8] Import follows --- neo4j/import/follows.cql | 4 ++++ neo4j/import/import.sh | 2 +- neo4j/import/todo | 10 ---------- 3 files changed, 5 insertions(+), 11 deletions(-) create mode 100644 neo4j/import/follows.cql diff --git a/neo4j/import/follows.cql b/neo4j/import/follows.cql new file mode 100644 index 00000000..0dad6a43 --- /dev/null +++ b/neo4j/import/follows.cql @@ -0,0 +1,4 @@ +CALL apoc.load.json('file:/mongo-export/follows.json') YIELD value as follow +MATCH (u1:User {id: follow.userId}), (u2:User {id: follow.foreignId}) +MERGE (u1)-[:FOLLOWS]->(u2) +; diff --git a/neo4j/import/import.sh b/neo4j/import/import.sh index 86224d24..d712dea0 100755 --- a/neo4j/import/import.sh +++ b/neo4j/import/import.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;" | cypher-shell -for collection in "badges" "categories" "users" "contributions" "comments" +for collection in "badges" "categories" "users" "follows" "contributions" "comments" do echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql done diff --git a/neo4j/import/todo b/neo4j/import/todo index 8ee1bb83..73eae239 100644 --- a/neo4j/import/todo +++ b/neo4j/import/todo @@ -1,14 +1,4 @@ -CALL apoc.load.json('file:/mongo-export/badges.json') YIELD value as badge -MERGE(b:Badge {id: badge._id["$oid"]}) -ON CREATE SET b.key = badge.key, - b.type = badge.type, - b.icon = badge.image.path, - b.status = badge.status -CALL apoc.load.json('file:/mongo-export/follows.json') YIELD value as follow -MATCH (u1:User {id: follow.userId}), - (u2:User {id: follow.foreignId}) -MERGE (u1)-[:FOLLOWS]->(u2) CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout MATCH (u:User {id: shout.userId}), From 494748c4c459f886e78a491c6f022e2a0da96ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 21 Jan 2019 23:43:23 +0100 Subject: [PATCH 8/8] Import shouts --- neo4j/import/import.sh | 2 +- neo4j/import/shouts.cql | 4 ++++ neo4j/import/todo | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 neo4j/import/shouts.cql diff --git a/neo4j/import/import.sh b/neo4j/import/import.sh index d712dea0..80b6595f 100755 --- a/neo4j/import/import.sh +++ b/neo4j/import/import.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" echo "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r;" | cypher-shell -for collection in "badges" "categories" "users" "follows" "contributions" "comments" +for collection in "badges" "categories" "users" "follows" "contributions" "shouts" "comments" do echo "Import ${collection}..." && cypher-shell < $SCRIPT_DIRECTORY/$collection.cql done diff --git a/neo4j/import/shouts.cql b/neo4j/import/shouts.cql new file mode 100644 index 00000000..60aca50c --- /dev/null +++ b/neo4j/import/shouts.cql @@ -0,0 +1,4 @@ +CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout +MATCH (u:User {id: shout.userId}), (p:Post {id: shout.foreignId}) +MERGE (u)-[:SHOUTED]->(p) +; diff --git a/neo4j/import/todo b/neo4j/import/todo index 73eae239..139597f9 100644 --- a/neo4j/import/todo +++ b/neo4j/import/todo @@ -1,6 +1,2 @@ -CALL apoc.load.json('file:/mongo-export/shouts.json') YIELD value as shout -MATCH (u:User {id: shout.userId}), - (p:Post {id: shout.foreignId}) -MERGE (u)-[:SHOUTED]->(p)