Merge branch 'master' into chat-message-notification-e2e-tests
2
.github/workflows/check-documentation.yml
vendored
@ -54,7 +54,7 @@ jobs:
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
|
||||
- name: Setup Node 20
|
||||
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.0.3
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.0.3
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
|
||||
2
.github/workflows/deploy-documentation.yml
vendored
@ -30,7 +30,7 @@ jobs:
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
|
||||
- name: Setup Node 20
|
||||
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.0.3
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.0.3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
|
||||
2
.github/workflows/docker-push.yml
vendored
@ -81,7 +81,7 @@ jobs:
|
||||
type=sha
|
||||
- name: Build and push Docker images
|
||||
id: push
|
||||
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4
|
||||
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1
|
||||
with:
|
||||
context: ${{ matrix.app.context }}
|
||||
target: ${{ matrix.app.target }}
|
||||
|
||||
6
.github/workflows/publish.yml
vendored
@ -64,7 +64,7 @@ jobs:
|
||||
echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
|
||||
- run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
|
||||
#- name: Repository Dispatch
|
||||
# uses: peter-evans/repository-dispatch@7d980a9b9f8ecf8955ea90507b3ed89122f53215 # v3.0.0
|
||||
# uses: peter-evans/repository-dispatch@44966f0098fd4ab26380bb099e1edf6d57eb2c90 # v3.0.0
|
||||
# with:
|
||||
# token: ${{ github.token }}
|
||||
# event-type: trigger-ocelot-build-success
|
||||
@ -72,7 +72,7 @@ jobs:
|
||||
# client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "VERSION": "${VERSION}", "BUILD_DATE": "${BUILD_DATE}", "BUILD_COMMIT": "${BUILD_COMMIT}", "BUILD_VERSION": "${BUILD_VERSION}"}'
|
||||
|
||||
- name: Repository Dispatch stage.ocelot.social
|
||||
uses: peter-evans/repository-dispatch@7d980a9b9f8ecf8955ea90507b3ed89122f53215 # v3.0.0
|
||||
uses: peter-evans/repository-dispatch@44966f0098fd4ab26380bb099e1edf6d57eb2c90 # v3.0.0
|
||||
with:
|
||||
token: ${{ secrets.OCELOT_PUBLISH_EVENT_PAT }} # this token is required to access the other repository
|
||||
event-type: trigger-ocelot-build-success
|
||||
@ -80,7 +80,7 @@ jobs:
|
||||
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "GITHUB_RUN_NUMBER": "${{ env.GITHUB_RUN_NUMBER }}", "VERSION": "${VERSION}", "BUILD_DATE": "${BUILD_DATE}", "BUILD_COMMIT": "${BUILD_COMMIT}", "BUILD_VERSION": "${BUILD_VERSION}"}'
|
||||
|
||||
- name: Repository Dispatch stage.yunite.me
|
||||
uses: peter-evans/repository-dispatch@7d980a9b9f8ecf8955ea90507b3ed89122f53215 # v3.0.0
|
||||
uses: peter-evans/repository-dispatch@44966f0098fd4ab26380bb099e1edf6d57eb2c90 # v3.0.0
|
||||
with:
|
||||
token: ${{ secrets.OCELOT_PUBLISH_EVENT_PAT }} # this token is required to access the other repository
|
||||
event-type: trigger-ocelot-build-success
|
||||
|
||||
1
.gitignore
vendored
@ -10,6 +10,7 @@ yarn-error.log*
|
||||
kubeconfig.yaml
|
||||
backup-cron-job.log
|
||||
.vscode
|
||||
.nuxt
|
||||
|
||||
node_modules/
|
||||
cypress/videos
|
||||
|
||||
72
CHANGELOG.md
@ -4,8 +4,80 @@ All notable changes to this project will be documented in this file. Dates are d
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
#### [3.4.0](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/3.3.0...3.4.0)
|
||||
|
||||
- fix(webapp): fix badge focus [`#8452`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8452)
|
||||
- feat(backend): branding middlewares [`#8429`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8429)
|
||||
- refactor(webapp): make login, registration, password-reset layout brandable [`#8440`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8440)
|
||||
- fix(backend): fixes for branding [`#8449`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8449)
|
||||
- Replace edit link by pencil button [`#8453`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8453)
|
||||
- fix(webapp): refine little things [`#8382`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8382)
|
||||
- fix(webapp): fix admin badges settings [`#8438`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8438)
|
||||
- build(deps): bump peter-evans/repository-dispatch [`#8443`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8443)
|
||||
- build(deps-dev): bump nodemon from 3.1.9 to 3.1.10 in /backend [`#8447`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8447)
|
||||
- build(deps-dev): bump @types/node from 22.14.1 to 22.15.2 in /backend [`#8446`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8446)
|
||||
- build(deps): bump docker/build-push-action from 6.15.0 to 6.16.0 [`#8444`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8444)
|
||||
- build(deps-dev): bump cypress from 14.3.1 to 14.3.2 in the cypress group [`#8442`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8442)
|
||||
- build(deps-dev): bump eslint-import-resolver-typescript in /backend [`#8445`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8445)
|
||||
- build(deps-dev): bump eslint-config-prettier in /backend [`#8370`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8370)
|
||||
- revokeBadge also removes selection [`#8437`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8437)
|
||||
- feat(webapp): badges UI [`#8426`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8426)
|
||||
- feat(backend): lint - detect unused typescript disables [`#8425`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8425)
|
||||
- fix(docu): remove required but missing `frontend/.env` [`#8431`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8431)
|
||||
- refactor(backend): types for neo4j & neode [`#8409`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8409)
|
||||
- lint everything, disable some setup steps for jest [`#8423`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8423)
|
||||
- lint n/no-sync [`#8405`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8405)
|
||||
- fix(backend): fix notification emails with different name [`#8419`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8419)
|
||||
- refactor(backend): default badges, always return a badge [`#8430`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8430)
|
||||
- refactor(backend): allow to set selected badge-slot to null [`#8421`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8421)
|
||||
- chore(frontend): run npm install [`#8432`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8432)
|
||||
- refactor(webapp): refactor branding diverse v2 [`#8427`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8427)
|
||||
- feat(webapp): badges admin settings [`#8401`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8401)
|
||||
- move graphql types into graphql folder [`#8420`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8420)
|
||||
- fix faker image seed [`#8422`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8422)
|
||||
- build(deps-dev): bump @faker-js/faker from 9.6.0 to 9.7.0 in /webapp [`#8411`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8411)
|
||||
- build(deps-dev): bump @faker-js/faker from 9.6.0 to 9.7.0 [`#8414`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8414)
|
||||
- build(deps): bump sanitize-html from 2.15.0 to 2.16.0 in /backend [`#8418`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8418)
|
||||
- build(deps-dev): bump cypress from 14.3.0 to 14.3.1 in the cypress group [`#8413`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8413)
|
||||
- build(deps): bump actions/setup-node from 4.3.0 to 4.4.0 [`#8412`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8412)
|
||||
- refactor(backend): separate queries [`#8358`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8358)
|
||||
- refactor(backend): lint @typescript-eslint/strict [`#8408`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8408)
|
||||
- refactor(backend): lint @typescript-eslint/recommended-requiring-type-checking [`#8407`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8407)
|
||||
- lint @typescript-eslint/recommended [`#8406`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8406)
|
||||
- build(deps): bump nodemailer from 6.10.0 to 6.10.1 in /backend [`#8417`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8417)
|
||||
- build(deps-dev): bump @eslint-community/eslint-plugin-eslint-comments [`#8415`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8415)
|
||||
- feat(backend): badges [`#8391`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8391)
|
||||
- feat(backend): do not notify blocked or muted users [`#8403`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8403)
|
||||
- feat(backend): only one email is sent although more notifications are triggered [`#8400`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8400)
|
||||
- fix(backend): flaky notifications on mention in group unit test [`#8404`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8404)
|
||||
- refactor(webapp): refactor branding of post ribbons and chat etc. [`#8395`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8395)
|
||||
- downgrade sass to 1.77.6 [`#8399`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8399)
|
||||
- mentiioned users in posts and comments of groups [`#8392`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8392)
|
||||
- feat(backend): no notification mails to users online [`#8397`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8397)
|
||||
- Add .nuxt to gitignore [`#8393`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8393)
|
||||
- fix migrations [`#8390`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8390)
|
||||
- chore(frontend): add '.nvmrc' file to new frontend [`#7112`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/7112)
|
||||
- refactor(backend): fix is muted by me query [`#8365`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8365)
|
||||
- fix(backend): block/mute chat [`#8364`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8364)
|
||||
- build(deps): bump graphql-upload from 11.0.0 to 13.0.0 in /backend [`#8375`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8375)
|
||||
- build(deps-dev): bump the typescript group across 1 directory with 2 updates [`#8383`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8383)
|
||||
- Bump graphql from 14.7.0 to 15.10.1 in /webapp [`#8157`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8157)
|
||||
- fix(webapp): better settings ux [`#8347`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8347)
|
||||
- Bump bcryptjs from 2.4.3 to 3.0.2 [`#8218`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8218)
|
||||
- Bump bcryptjs from 2.4.3 to 3.0.2 in /backend [`#8224`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8224)
|
||||
- build(deps-dev): bump cypress from 14.2.1 to 14.3.0 in the cypress group [`#8366`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8366)
|
||||
- build(deps-dev): bump eslint-import-resolver-typescript in /backend [`#8369`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8369)
|
||||
- build(deps-dev): bump dotenv from 16.4.7 to 16.5.0 [`#8367`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8367)
|
||||
- build(deps): bump ioredis from 4.16.1 to 5.6.1 in /backend [`#8371`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8371)
|
||||
- build(deps): bump dotenv from 16.4.7 to 16.5.0 in /backend [`#8372`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8372)
|
||||
- build(deps-dev): bump eslint-config-prettier in /webapp [`#8377`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8377)
|
||||
- build(deps-dev): bump @types/node from 22.14.0 to 22.14.1 in /backend [`#8374`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8374)
|
||||
|
||||
#### [3.3.0](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/3.2.1...3.3.0)
|
||||
|
||||
> 12 April 2025
|
||||
|
||||
- v3.3.0 [`#8380`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8380)
|
||||
- fix(webapp): refine group muting locales [`#8378`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8378)
|
||||
- chore(backend): add e-mail setting for our new 'mailserver' to our backend .env.template [`#8359`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8359)
|
||||
- refactor(backend): set up smtp pooling for nodemailer [`#8167`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/8167)
|
||||
|
||||
@ -187,10 +187,6 @@ $ cp .env.template .env
|
||||
# in folder backend/
|
||||
$ cp .env.template .env
|
||||
|
||||
# in folder frontend/
|
||||
$ cp .env.template .env
|
||||
```
|
||||
|
||||
For Development:
|
||||
|
||||
```bash
|
||||
|
||||
3
backend/.eslintignore
Normal file
@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
build/
|
||||
coverage/
|
||||
@ -16,6 +16,7 @@ module.exports = {
|
||||
'plugin:promise/recommended',
|
||||
'plugin:security/recommended-legacy',
|
||||
'plugin:@eslint-community/eslint-comments/recommended',
|
||||
'prettier',
|
||||
],
|
||||
settings: {
|
||||
'import/parsers': {
|
||||
@ -114,7 +115,7 @@ module.exports = {
|
||||
'n/no-callback-literal': 'error',
|
||||
// 'n/no-deprecated-api': 'error', // part of n/recommended
|
||||
// 'n/no-exports-assign': 'error', // part of n/recommended
|
||||
'n/no-extraneous-import': 'off', // TODO // part of n/recommended
|
||||
'n/no-extraneous-import': 'off', // duplicate of import/no-extraneous-dependencies // part of n/recommended
|
||||
// 'n/no-extraneous-require': 'error', // part of n/recommended
|
||||
'n/no-hide-core-modules': 'error',
|
||||
'n/no-missing-import': 'off', // not compatible with typescript // part of n/recommended
|
||||
@ -126,7 +127,7 @@ module.exports = {
|
||||
// 'n/no-process-exit': 'error', // part of n/recommended
|
||||
'n/no-restricted-import': 'error',
|
||||
'n/no-restricted-require': 'error',
|
||||
// 'n/no-sync': 'error',
|
||||
'n/no-sync': 'error',
|
||||
// 'n/no-unpublished-bin': 'error', // part of n/recommended
|
||||
'n/no-unpublished-import': [
|
||||
'error',
|
||||
@ -178,9 +179,10 @@ module.exports = {
|
||||
{
|
||||
files: ['*.ts', '*.tsx'],
|
||||
extends: [
|
||||
// 'plugin:@typescript-eslint/recommended',
|
||||
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
// 'plugin:@typescript-eslint/strict',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
'plugin:@typescript-eslint/strict',
|
||||
'prettier',
|
||||
],
|
||||
rules: {
|
||||
// allow explicitly defined dangling promises
|
||||
@ -192,6 +194,11 @@ module.exports = {
|
||||
'import/unambiguous': 'off',
|
||||
// this is not compatible with typeorm, due to joined tables can be null, but are not defined as nullable
|
||||
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||
// respect underscore as acceptable unused variable
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
||||
],
|
||||
},
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
|
||||
@ -23,11 +23,14 @@ COPY . .
|
||||
ONBUILD COPY ./branding/constants/ src/config/tmp
|
||||
ONBUILD RUN tools/replace-constants.sh
|
||||
ONBUILD COPY ./branding/email/ src/middleware/helpers/email/
|
||||
ONBUILD COPY ./branding/middlewares/ src/middleware/branding/
|
||||
ONBUILD COPY ./branding/data/ src/db/data
|
||||
ONBUILD COPY ./branding/public/ public/
|
||||
ONBUILD RUN yarn install --production=false --frozen-lockfile --non-interactive
|
||||
ONBUILD RUN yarn run build
|
||||
ONBUILD RUN mkdir /build
|
||||
ONBUILD RUN cp -r ./build /build
|
||||
ONBUILD RUN cp -r ./public /build/build
|
||||
ONBUILD RUN cp -r ./public /build
|
||||
ONBUILD RUN cp -r ./package.json yarn.lock /build
|
||||
ONBUILD RUN cd /build && yarn install --production=true --frozen-lockfile --non-interactive
|
||||
|
||||
|
||||
@ -120,6 +120,20 @@ When using `CATEGORIES_ACTIVE=true` you also want to seed the categories with:
|
||||
yarn db:data:categories
|
||||
```
|
||||
|
||||
### Branding Data
|
||||
|
||||
You might need to seed some branding specific data into the database.
|
||||
|
||||
To do so, run:
|
||||
|
||||
```sh
|
||||
# in backend with database running (In docker or local)
|
||||
yarn db:data:branding
|
||||
|
||||
# for docker
|
||||
docker exec backend yarn db:data:branding
|
||||
```
|
||||
|
||||
### Seed Data
|
||||
|
||||
For a predefined set of test data you can seed the database with:
|
||||
|
||||
0
backend/branding/data/.gitkeep
Normal file
0
backend/branding/middlewares/.gitkeep
Normal file
0
backend/branding/public/.gitkeep
Normal file
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ocelot-social-backend",
|
||||
"version": "3.3.0",
|
||||
"version": "3.4.0",
|
||||
"description": "GraphQL Backend for ocelot.social",
|
||||
"repository": "https://github.com/Ocelot-Social-Community/Ocelot-Social",
|
||||
"author": "ocelot.social Community",
|
||||
@ -12,16 +12,19 @@
|
||||
"build": "tsc && tsc-alias && ./scripts/build.copy.files.sh",
|
||||
"dev": "nodemon --exec ts-node --require tsconfig-paths/register src/ -e js,ts,gql",
|
||||
"dev:debug": "nodemon --exec babel-node --inspect=0.0.0.0:9229 src/ -e js,ts,gql",
|
||||
"lint": "eslint --max-warnings=0 --ext .js,.ts ./src",
|
||||
"lint": "eslint --max-warnings=0 --report-unused-disable-directives --ext .js,.ts .",
|
||||
"test": "cross-env NODE_ENV=test NODE_OPTIONS=--max-old-space-size=8192 jest --runInBand --coverage --forceExit --detectOpenHandles",
|
||||
"db:reset": "ts-node --require tsconfig-paths/register src/db/reset.ts",
|
||||
"db:reset:withmigrations": "ts-node --require tsconfig-paths/register src/db/reset-with-migrations.ts",
|
||||
"db:seed": "ts-node --require tsconfig-paths/register src/db/seed.ts",
|
||||
"db:data:admin": "ts-node --require tsconfig-paths/register src/db/admin.ts",
|
||||
"db:data:badges": "ts-node --require tsconfig-paths/register src/db/badges.ts",
|
||||
"db:data:branding": "ts-node --require tsconfig-paths/register src/db/data-branding.ts",
|
||||
"db:data:categories": "ts-node --require tsconfig-paths/register src/db/categories.ts",
|
||||
"db:migrate": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --store ./src/db/migrate/store.ts",
|
||||
"db:migrate:create": "migrate --compiler 'ts:./src/db/compiler.ts' --migrations-dir ./src/db/migrations --template-file ./src/db/migrate/template.ts --date-format 'yyyymmddHHmmss' create",
|
||||
"prod:migrate": "migrate --migrations-dir ./build/src/db/migrations --store ./build/src/db/migrate/store.js"
|
||||
"prod:migrate": "migrate --migrations-dir ./build/src/db/migrations --store ./build/src/db/migrate/store.js",
|
||||
"prod:db:data:branding": "node build/src/db/data-branding.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/cli": "~7.27.0",
|
||||
@ -87,10 +90,10 @@
|
||||
"neo4j-graphql-js": "^2.11.5",
|
||||
"neode": "^0.4.9",
|
||||
"node-fetch": "^2.7.0",
|
||||
"nodemailer": "^6.10.0",
|
||||
"nodemailer": "^6.10.1",
|
||||
"nodemailer-html-to-text": "^3.2.0",
|
||||
"request": "~2.88.2",
|
||||
"sanitize-html": "~2.15.0",
|
||||
"sanitize-html": "~2.16.0",
|
||||
"slug": "~9.1.0",
|
||||
"subscriptions-transport-ws": "^0.9.19",
|
||||
"trunc-html": "~1.1.2",
|
||||
@ -99,17 +102,19 @@
|
||||
"xregexp": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
||||
"@faker-js/faker": "9.6.0",
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
||||
"@faker-js/faker": "9.7.0",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^22.14.1",
|
||||
"@types/lodash": "^4.17.16",
|
||||
"@types/node": "^22.15.2",
|
||||
"@types/uuid": "~9.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"apollo-server-testing": "~2.11.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^10.1.1",
|
||||
"eslint-config-prettier": "^10.1.2",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-import-resolver-typescript": "^4.3.2",
|
||||
"eslint-import-resolver-typescript": "^4.3.4",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-jest": "^28.11.0",
|
||||
"eslint-plugin-n": "^17.17.0",
|
||||
@ -118,7 +123,7 @@
|
||||
"eslint-plugin-promise": "^7.2.1",
|
||||
"eslint-plugin-security": "^3.0.1",
|
||||
"jest": "^29.7.0",
|
||||
"nodemon": "~3.1.9",
|
||||
"nodemon": "~3.1.10",
|
||||
"prettier": "^3.5.3",
|
||||
"require-json5": "^1.3.0",
|
||||
"rosie": "^2.1.1",
|
||||
|
||||
12
backend/public/img/badges/default_trophy.svg
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg width="400" height="346.67" version="1.1" viewBox="0 0 400 346.67" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<linearGradient id="linearGradient4" x1="708.76" x2="493.17" y1="280.91" y2="65.326" gradientTransform="translate(-404.06 .215)" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#c1c1c1" offset="0"/>
|
||||
<stop stop-color="#fcfcfc" offset="1"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path d="m-0.21505 173.98 100.65-173.76h198.71l101.08 173.76-99.785 172.04-201.29 0.43011z" fill="#bebebe"/>
|
||||
<path d="m22.482 173.91 89.236-154.07h176.18l89.617 154.07-88.473 152.54-178.47 0.38135z" fill="url(#linearGradient4)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 773 B |
28
backend/public/img/badges/default_verification.svg
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="513"
|
||||
height="444"
|
||||
version="1.1"
|
||||
id="svg3"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs3" />
|
||||
<g
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
id="g3">
|
||||
<path
|
||||
fill="#333"
|
||||
d="M384.5.297L512.325 221.9l-128 221.702-255.825.102L.675 222.1 128.675.4z"
|
||||
id="path1" />
|
||||
<g
|
||||
fill="#ffffff"
|
||||
id="g2"
|
||||
transform="translate(92)">
|
||||
<path
|
||||
d="m 35.01,367.726 c -0.08,-21.169 -0.205,-53.162 21.257,-71.332 3.817,-3.253 9.93,-7.497 17.321,-9.224 2.575,-0.523 4.956,-0.756 7.262,-0.979 4.438,-0.431 8.27,-0.804 12.054,-2.9 l 4.954,-2.846 c 9.87,-5.655 19.194,-10.996 28.226,-17.377 5.085,-3.632 6.726,-15.73 6.095,-25.428 -0.214,-2.792 -1.893,-5.7 -3.67,-8.777 -1.097,-1.901 -2.232,-3.867 -3.065,-5.916 l -0.073,-0.199 a 56.976,56.976 0 0 1 -0.422,-1.443 c -1.195,-4.205 -1.933,-6.378 -2.386,-7.476 -7.029,-0.944 -11.8,-8.647 -12.888,-21.006 l -0.031,-0.557 c -0.645,-12.785 0.808,-16.13 2.316,-17.716 0.24,-0.254 0.505,-0.475 0.783,-0.666 -1.754,-16.051 3.115,-32.521 13.358,-44.704 9.314,-11.079 21.955,-17.18 35.592,-17.18 3.73,0 7.55,0.458 11.355,1.362 25.63,6.228 41.679,30.27 40.062,59.227 0.53,0.251 1.018,0.61 1.44,1.066 2.752,2.964 2.47,10.97 2.22,14.276 l -0.024,0.41 c -0.335,5.236 -0.684,10.65 -3.052,15.73 -1.739,3.918 -4.405,6.242 -6.76,8.29 -2.396,2.089 -4.288,3.735 -5.294,6.885 -0.7,2.416 -1.645,4.866 -2.559,7.235 -1.752,4.538 -3.407,8.827 -3.54,13.244 -0.427,10.222 1.17,18.391 4.172,21.359 5.097,5.163 13.003,9.391 19.978,13.121 1.6,0.855 3.166,1.692 4.654,2.517 9.28,5.052 16.07,7.915 25.309,8.557 9.118,0.849 18.056,5.193 24.754,11.97 0.736,0.641 1.82,1.744 3.694,3.648 4.416,4.492 4.416,4.492 4.426,5.852 l 0.007,0.758 c 10.783,17.702 11.14,40.656 11.415,58.169 l 0.05,3.28 -3.278,0.028 c -42.05,0.363 -84.058,0.677 -126.058,0.993 -42.12,0.314 -84.232,0.632 -126.367,0.994 L 35.024,371 Z"
|
||||
id="path2" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 637 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 654 B After Width: | Height: | Size: 654 B |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@ -14,14 +14,14 @@ mkdir -p build/src/middleware/helpers/email/templates/de/
|
||||
cp -r src/middleware/helpers/email/templates/de/*.html build/src/middleware/helpers/email/templates/de/
|
||||
|
||||
# gql files
|
||||
mkdir -p build/src/schema/types/
|
||||
cp -r src/schema/types/*.gql build/src/schema/types/
|
||||
mkdir -p build/src/graphql/types/
|
||||
cp -r src/graphql/types/*.gql build/src/graphql/types/
|
||||
|
||||
mkdir -p build/src/schema/types/enum/
|
||||
cp -r src/schema/types/enum/*.gql build/src/schema/types/enum/
|
||||
mkdir -p build/src/graphql/types/enum/
|
||||
cp -r src/graphql/types/enum/*.gql build/src/graphql/types/enum/
|
||||
|
||||
mkdir -p build/src/schema/types/scalar/
|
||||
cp -r src/schema/types/scalar/*.gql build/src/schema/types/scalar/
|
||||
mkdir -p build/src/graphql/types/scalar/
|
||||
cp -r src/graphql/types/scalar/*.gql build/src/graphql/types/scalar/
|
||||
|
||||
mkdir -p build/src/schema/types/type/
|
||||
cp -r src/schema/types/type/*.gql build/src/schema/types/type/
|
||||
mkdir -p build/src/graphql/types/type/
|
||||
cp -r src/graphql/types/type/*.gql build/src/graphql/types/type/
|
||||
@ -1,26 +1,19 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable n/no-process-env */
|
||||
/* eslint-disable n/no-unpublished-require */
|
||||
/* eslint-disable n/no-missing-require */
|
||||
import { config } from 'dotenv'
|
||||
|
||||
import emails from './emails'
|
||||
import metadata from './metadata'
|
||||
|
||||
// Load env file
|
||||
if (require.resolve) {
|
||||
try {
|
||||
config({ path: require.resolve('../../.env') })
|
||||
} catch (error) {
|
||||
// This error is thrown when the .env is not found
|
||||
if (error.code !== 'MODULE_NOT_FOUND') {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
config()
|
||||
|
||||
// Use Cypress env or process.env
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
declare let Cypress: any | undefined
|
||||
const env = typeof Cypress !== 'undefined' ? Cypress.env() : process.env // eslint-disable-line no-undef
|
||||
const env = typeof Cypress !== 'undefined' ? Cypress.env() : process.env
|
||||
|
||||
const environment = {
|
||||
NODE_ENV: env.NODE_ENV || process.env.NODE_ENV,
|
||||
@ -29,7 +22,9 @@ const environment = {
|
||||
PRODUCTION: env.NODE_ENV === 'production',
|
||||
// used for staging enviroments if 'PRODUCTION=true' and 'PRODUCTION_DB_CLEAN_ALLOW=true'
|
||||
PRODUCTION_DB_CLEAN_ALLOW: env.PRODUCTION_DB_CLEAN_ALLOW === 'true' || false, // default = false
|
||||
DISABLED_MIDDLEWARES: (env.NODE_ENV !== 'production' && env.DISABLED_MIDDLEWARES) || false,
|
||||
DISABLED_MIDDLEWARES: ['test', 'development'].includes(env.NODE_ENV as string)
|
||||
? (env.DISABLED_MIDDLEWARES?.split(',') ?? [])
|
||||
: [],
|
||||
}
|
||||
|
||||
const required = {
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
// this file is duplicated in `backend/src/config/metadata` and `webapp/constants/metadata.js` and replaced on rebranding
|
||||
export default {
|
||||
APPLICATION_NAME: 'ocelot.social',
|
||||
APPLICATION_SHORT_NAME: 'ocelot',
|
||||
APPLICATION_SHORT_NAME: 'ocelot.social',
|
||||
APPLICATION_DESCRIPTION: 'ocelot.social Community Network',
|
||||
COOKIE_NAME: 'ocelot-social-token',
|
||||
ORGANIZATION_NAME: 'ocelot.social Community',
|
||||
ORGANIZATION_JURISDICTION: 'City of Angels',
|
||||
THEME_COLOR: 'rgb(23, 181, 63)', // $color-primary – as the main color in general. e.g. the color in the background of the app that is visible behind the transparent iPhone status bar to name one use case, or the current color of SVGs to name another use case
|
||||
}
|
||||
|
||||
2
backend/src/constants/badges.ts
Normal file
@ -0,0 +1,2 @@
|
||||
// this file is duplicated in `backend/src/constants/badges` and `webapp/constants/badges.js`
|
||||
export const TROPHY_BADGES_SELECTED_MAX = 9
|
||||
@ -1,5 +1,2 @@
|
||||
// this file is duplicated in `backend/src/config/metadata` and `webapp/constants/metadata.js`
|
||||
export default {
|
||||
NONCE_LENGTH: 5,
|
||||
INVITE_CODE_LENGTH: 6,
|
||||
}
|
||||
// this file is duplicated in `backend/src/config/registration.ts` and `webapp/constants/registration.js`
|
||||
export default {}
|
||||
|
||||
12
backend/src/constants/registrationBranded.ts
Normal file
@ -0,0 +1,12 @@
|
||||
// this file is duplicated in `backend/src/config/registrationBranded.ts` and `webapp/constants/registrationBranded.js`
|
||||
import { merge } from 'lodash'
|
||||
|
||||
import registration from '@constants/registration'
|
||||
|
||||
const defaultRegistration = {
|
||||
NONCE_LENGTH: 5,
|
||||
INVITE_CODE_LENGTH: 6,
|
||||
LAYOUT: 'no-header',
|
||||
}
|
||||
|
||||
export default merge(defaultRegistration, registration)
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
|
||||
import { hashSync } from 'bcryptjs'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
@ -5,6 +8,7 @@ import { getDriver } from './neo4j'
|
||||
|
||||
const defaultAdmin = {
|
||||
email: 'admin@example.org',
|
||||
// eslint-disable-next-line n/no-sync
|
||||
password: hashSync('1234', 10),
|
||||
name: 'admin',
|
||||
id: uuid(),
|
||||
|
||||
14
backend/src/db/badges.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
import { getNeode } from './neo4j'
|
||||
import { trophies, verification } from './seed/badges'
|
||||
|
||||
// eslint-disable-next-line import/newline-after-import
|
||||
;(async function () {
|
||||
const neode = getNeode()
|
||||
try {
|
||||
await trophies()
|
||||
await verification()
|
||||
} finally {
|
||||
neode.close()
|
||||
}
|
||||
})()
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
|
||||
import { categories } from '@constants/categories'
|
||||
|
||||
import { getDriver } from './neo4j'
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable import/no-commonjs */
|
||||
// eslint-disable-next-line n/no-unpublished-require
|
||||
// eslint-disable-next-line n/no-unpublished-require, @typescript-eslint/no-var-requires
|
||||
const tsNode = require('ts-node')
|
||||
// eslint-disable-next-line import/no-unassigned-import, import/no-extraneous-dependencies, n/no-unpublished-require
|
||||
// eslint-disable-next-line import/no-unassigned-import, n/no-unpublished-require
|
||||
require('tsconfig-paths/register')
|
||||
|
||||
module.exports = tsNode.register
|
||||
|
||||
27
backend/src/db/data-branding.ts
Normal file
@ -0,0 +1,27 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
import { readdir } from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
|
||||
import { getNeode } from './neo4j'
|
||||
|
||||
const dataFolder = path.join(__dirname, 'data/')
|
||||
const neode = getNeode()
|
||||
|
||||
;(async function () {
|
||||
const files = await readdir(dataFolder)
|
||||
for await (const file of files) {
|
||||
if (file.slice(0, -3).endsWith('-branding')) {
|
||||
const importedModule = await import(path.join(dataFolder, file))
|
||||
if (!importedModule.default) {
|
||||
throw new Error('Your data file must export a default function')
|
||||
}
|
||||
await importedModule.default()
|
||||
}
|
||||
}
|
||||
|
||||
// close database connection
|
||||
neode.close()
|
||||
})()
|
||||
0
backend/src/db/data/.gitkeep
Normal file
@ -1,10 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { faker } from '@faker-js/faker'
|
||||
import { hashSync } from 'bcryptjs'
|
||||
import { Factory } from 'rosie'
|
||||
import slugify from 'slug'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import CONFIG from '@config/index'
|
||||
import generateInviteCode from '@schema/resolvers/helpers/generateInviteCode'
|
||||
|
||||
import { getDriver, getNeode } from './neo4j'
|
||||
@ -12,7 +17,7 @@ import { getDriver, getNeode } from './neo4j'
|
||||
const neode = getNeode()
|
||||
|
||||
const uniqueImageUrl = (imageUrl) => {
|
||||
const newUrl = new URL(imageUrl, CONFIG.CLIENT_URI)
|
||||
const newUrl = new URL(imageUrl)
|
||||
newUrl.search = `random=${uuid()}`
|
||||
return newUrl.toString()
|
||||
}
|
||||
@ -32,7 +37,7 @@ export const cleanDatabase = async ({ withMigrations } = { withMigrations: false
|
||||
return transaction.run(clean)
|
||||
})
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,25 +45,34 @@ Factory.define('category')
|
||||
.attr('id', uuid)
|
||||
.attr('icon', 'globe')
|
||||
.attr('name', 'Global Peace & Nonviolence')
|
||||
.after((buildObject, options) => {
|
||||
.after((buildObject, _options) => {
|
||||
return neode.create('Category', buildObject)
|
||||
})
|
||||
|
||||
Factory.define('badge')
|
||||
.attr('type', 'crowdfunding')
|
||||
.attr('status', 'permanent')
|
||||
.after((buildObject, options) => {
|
||||
.after((buildObject, _options) => {
|
||||
return neode.create('Badge', buildObject)
|
||||
})
|
||||
|
||||
Factory.define('image')
|
||||
.attr('url', faker.image.url)
|
||||
.attr('aspectRatio', 1.3333333333333333)
|
||||
.attr('width', 400)
|
||||
.attr('height', 300)
|
||||
.attr('blur', 0)
|
||||
.attr('alt', faker.lorem.sentence)
|
||||
.attr('type', 'image/jpeg')
|
||||
.after((buildObject, options) => {
|
||||
const { url: imageUrl } = buildObject
|
||||
if (imageUrl) buildObject.url = uniqueImageUrl(imageUrl)
|
||||
.attr('url', null)
|
||||
.after((buildObject, _options) => {
|
||||
if (!buildObject.url) {
|
||||
buildObject.url = faker.image.urlPicsumPhotos({
|
||||
width: buildObject.width,
|
||||
height: buildObject.height,
|
||||
blur: buildObject.blur,
|
||||
})
|
||||
}
|
||||
buildObject.url = uniqueImageUrl(buildObject.url)
|
||||
buildObject.aspectRatio = buildObject.width / buildObject.height
|
||||
return neode.create('Image', buildObject)
|
||||
})
|
||||
|
||||
@ -79,27 +93,28 @@ Factory.define('basicUser')
|
||||
return slug || slugify(name, { lower: true })
|
||||
})
|
||||
.attr('encryptedPassword', ['password'], (password) => {
|
||||
// eslint-disable-next-line n/no-sync
|
||||
return hashSync(password, 10)
|
||||
})
|
||||
|
||||
Factory.define('userWithoutEmailAddress')
|
||||
.extend('basicUser')
|
||||
.option('about', faker.lorem.paragraph)
|
||||
.after(async (buildObject, options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('User', buildObject)
|
||||
})
|
||||
|
||||
Factory.define('userWithAboutNull')
|
||||
.extend('basicUser')
|
||||
.option('about', null)
|
||||
.after(async (buildObject, options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('User', buildObject)
|
||||
})
|
||||
|
||||
Factory.define('userWithAboutEmpty')
|
||||
.extend('basicUser')
|
||||
.option('about', '')
|
||||
.after(async (buildObject, options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('User', buildObject)
|
||||
})
|
||||
|
||||
@ -224,7 +239,7 @@ Factory.define('donations')
|
||||
.attr('showDonations', true)
|
||||
.attr('goal', 15000)
|
||||
.attr('progress', 7000)
|
||||
.after((buildObject, options) => {
|
||||
.after((buildObject, _options) => {
|
||||
return neode.create('Donations', buildObject)
|
||||
})
|
||||
|
||||
@ -235,13 +250,13 @@ const emailDefaults = {
|
||||
|
||||
Factory.define('emailAddress')
|
||||
.attrs(emailDefaults)
|
||||
.after((buildObject, options) => {
|
||||
.after((buildObject, _options) => {
|
||||
return neode.create('EmailAddress', buildObject)
|
||||
})
|
||||
|
||||
Factory.define('unverifiedEmailAddress')
|
||||
.attr(emailDefaults)
|
||||
.after((buildObject, options) => {
|
||||
.after((buildObject, _options) => {
|
||||
return neode.create('UnverifiedEmailAddress', buildObject)
|
||||
})
|
||||
|
||||
@ -281,11 +296,11 @@ Factory.define('location')
|
||||
id: 'country.10743216036480410',
|
||||
type: 'country',
|
||||
})
|
||||
.after((buildObject, options) => {
|
||||
.after((buildObject, _options) => {
|
||||
return neode.create('Location', buildObject)
|
||||
})
|
||||
|
||||
Factory.define('report').after((buildObject, options) => {
|
||||
Factory.define('report').after((buildObject, _options) => {
|
||||
return neode.create('Report', buildObject)
|
||||
})
|
||||
|
||||
@ -293,7 +308,7 @@ Factory.define('tag')
|
||||
.attrs({
|
||||
name: '#human-connection',
|
||||
})
|
||||
.after((buildObject, options) => {
|
||||
.after((buildObject, _options) => {
|
||||
return neode.create('Tag', buildObject)
|
||||
})
|
||||
|
||||
@ -301,7 +316,7 @@ Factory.define('socialMedia')
|
||||
.attrs({
|
||||
url: 'https://mastodon.social/@Gargron',
|
||||
})
|
||||
.after((buildObject, options) => {
|
||||
.after((buildObject, _options) => {
|
||||
return neode.create('SocialMedia', buildObject)
|
||||
})
|
||||
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { getDriver, getNeode } from '@db/neo4j'
|
||||
|
||||
class Store {
|
||||
async init(errFn) {
|
||||
const neode = getNeode()
|
||||
const session = neode.driver.session()
|
||||
const session = neode.session()
|
||||
const txFreshIndicesConstrains = session.writeTransaction(async (txc) => {
|
||||
// drop all indices and constraints
|
||||
await txc.run('CALL apoc.schema.assert({},{},true)')
|
||||
@ -30,6 +34,9 @@ class Store {
|
||||
// we need to have all constraints and indexes defined here. They can not be properly migrated
|
||||
await txFreshIndicesConstrains
|
||||
|
||||
// You have to wait for the schema to install, else the constraints will not be present.
|
||||
// This is a type error of the library
|
||||
// eslint-disable-next-line @typescript-eslint/await-thenable
|
||||
await getNeode().schema.install()
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Successfully created database indices and constraints!')
|
||||
@ -38,8 +45,8 @@ class Store {
|
||||
console.log(error) // eslint-disable-line no-console
|
||||
errFn(error)
|
||||
} finally {
|
||||
session.close()
|
||||
neode.driver.close()
|
||||
await session.close()
|
||||
neode.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +75,7 @@ class Store {
|
||||
console.log(error) // eslint-disable-line no-console
|
||||
next(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +111,7 @@ class Store {
|
||||
console.log(error) // eslint-disable-line no-console
|
||||
next(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = ''
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -11,7 +13,6 @@ export async function up(next) {
|
||||
// Implement your migration here.
|
||||
await transaction.run(``)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -20,11 +21,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -33,7 +34,6 @@ export async function down(next) {
|
||||
// Implement your migration here.
|
||||
await transaction.run(``)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -42,6 +42,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable promise/prefer-await-to-callbacks */
|
||||
import { throwError, concat } from 'rxjs'
|
||||
@ -17,16 +23,19 @@ export const description = `
|
||||
`
|
||||
export function up(next) {
|
||||
const driver = getDriver()
|
||||
const rxSession = driver.rxSession()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const rxSession = driver.rxSession() as any
|
||||
rxSession
|
||||
.beginTransaction()
|
||||
.pipe(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
flatMap((txc: any) =>
|
||||
concat(
|
||||
txc
|
||||
.run('MATCH (email:EmailAddress) RETURN email {.email}')
|
||||
.records()
|
||||
.pipe(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
map((record: any) => {
|
||||
const { email } = record.get('email')
|
||||
const normalizedEmail = normalizeEmail(email)
|
||||
@ -48,6 +57,7 @@ export function up(next) {
|
||||
)
|
||||
.records()
|
||||
.pipe(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
map((r: any) => ({
|
||||
oldEmail: email,
|
||||
email: r.get('email'),
|
||||
@ -61,7 +71,7 @@ export function up(next) {
|
||||
),
|
||||
)
|
||||
.subscribe({
|
||||
next: ({ user, email, oldUser, oldEmail }) =>
|
||||
next: ({ user, email, _oldUser, oldEmail }) =>
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`
|
||||
Merged:
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable promise/prefer-await-to-callbacks */
|
||||
import { throwError, concat } from 'rxjs'
|
||||
@ -11,10 +17,12 @@ export const description = `
|
||||
`
|
||||
export function up(next) {
|
||||
const driver = getDriver()
|
||||
const rxSession = driver.rxSession()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const rxSession = driver.rxSession() as any
|
||||
rxSession
|
||||
.beginTransaction()
|
||||
.pipe(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
flatMap((transaction: any) =>
|
||||
concat(
|
||||
transaction
|
||||
@ -26,6 +34,7 @@ export function up(next) {
|
||||
)
|
||||
.records()
|
||||
.pipe(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
map((record: any) => {
|
||||
const { id: locationId } = record.get('location')
|
||||
return { locationId }
|
||||
@ -43,6 +52,7 @@ export function up(next) {
|
||||
)
|
||||
.records()
|
||||
.pipe(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
map((record: any) => ({
|
||||
location: record.get('location'),
|
||||
updatedLocation: record.get('updatedLocation'),
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = `
|
||||
@ -8,7 +10,7 @@ export const description = `
|
||||
A blocked user will still be able to see your contributions, but will not be able to interact with them and vice versa.
|
||||
`
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -29,20 +31,20 @@ export async function up(next) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('rolled back')
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export function down(next) {
|
||||
export async function down(next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
try {
|
||||
// Rollback your migration here.
|
||||
next()
|
||||
// next()
|
||||
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||
} catch (err) {
|
||||
next(err)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = `
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description =
|
||||
@ -31,7 +35,7 @@ export async function up(next) {
|
||||
throw new Error(error)
|
||||
}
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +62,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = `
|
||||
@ -32,7 +36,7 @@ export async function up(next) {
|
||||
throw new Error(error)
|
||||
}
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,6 +60,6 @@ export async function down(next) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('rolled back')
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable security/detect-non-literal-fs-filename */
|
||||
import https from 'https'
|
||||
import { existsSync, createReadStream } from 'node:fs'
|
||||
@ -48,6 +53,7 @@ export async function up(next) {
|
||||
const { pathname } = new URL(url, 'http://example.org')
|
||||
const fileLocation = path.join(__dirname, `../../../public/${pathname}`)
|
||||
const s3Location = `original${pathname}`
|
||||
// eslint-disable-next-line n/no-sync
|
||||
if (existsSync(fileLocation)) {
|
||||
const mimeType = mime.lookup(fileLocation)
|
||||
const params = {
|
||||
@ -84,7 +90,7 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +112,6 @@ export async function down(next) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('rolled back')
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
|
||||
/* eslint-disable no-console */
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
@ -58,7 +61,7 @@ export async function up() {
|
||||
console.log('Created image nodes from all user avatars and post images.')
|
||||
printSummaries(stats)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,6 +99,6 @@ export async function down() {
|
||||
console.log('UNDO: Split images from users and posts.')
|
||||
printSummaries(stats)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description =
|
||||
@ -20,7 +25,7 @@ export async function up(next) {
|
||||
`)
|
||||
try {
|
||||
// Implement your migration here.
|
||||
const users = await updateDeletedUserAttributes.records.map((record) => record.get('user'))
|
||||
const users = updateDeletedUserAttributes.records.map((record) => record.get('user'))
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(users)
|
||||
await transaction.commit()
|
||||
@ -33,7 +38,7 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description =
|
||||
@ -22,7 +27,7 @@ export async function up(next) {
|
||||
`)
|
||||
try {
|
||||
// Implement your migration here.
|
||||
const posts = await updateDeletedPostsAttributes.records.map((record) => record.get('post'))
|
||||
const posts = updateDeletedPostsAttributes.records.map((record) => record.get('post'))
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(posts)
|
||||
await transaction.commit()
|
||||
@ -35,7 +40,7 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
|
||||
/* eslint-disable security/detect-non-literal-fs-filename */
|
||||
import { existsSync } from 'node:fs'
|
||||
|
||||
@ -26,6 +32,7 @@ export async function up(next) {
|
||||
const urls = records.map((record) => record.get('url'))
|
||||
const danglingUrls = urls.filter((url) => {
|
||||
const fileLocation = `public${url}`
|
||||
// eslint-disable-next-line n/no-sync
|
||||
return !existsSync(fileLocation)
|
||||
})
|
||||
await transaction.run(
|
||||
@ -54,7 +61,7 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
'use strict'
|
||||
|
||||
export async function up(next) {
|
||||
next()
|
||||
}
|
||||
export async function up(_next) {}
|
||||
|
||||
export async function down(next) {
|
||||
next()
|
||||
}
|
||||
export async function down(_next) {}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = `
|
||||
This migration adds the clickedCount property to all posts, setting it to 0.
|
||||
`
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -15,7 +17,6 @@ export async function up(next) {
|
||||
SET p.clickedCount = 0
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -24,11 +25,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -39,7 +40,6 @@ export async function down(next) {
|
||||
REMOVE p.clickedCount
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -48,6 +48,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = `
|
||||
This migration adds the viewedTeaserCount property to all posts, setting it to 0.
|
||||
`
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -15,7 +17,6 @@ export async function up(next) {
|
||||
SET p.viewedTeaserCount = 0
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -24,11 +25,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -39,7 +40,6 @@ export async function down(next) {
|
||||
REMOVE p.viewedTeaserCount
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -48,6 +48,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
@ -5,7 +7,7 @@ import { getDriver } from '@db/neo4j'
|
||||
export const description =
|
||||
'This migration adds a Donations node with default settings to the database.'
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -27,7 +29,6 @@ export async function up(next) {
|
||||
{ donationId },
|
||||
)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -36,11 +37,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -53,7 +54,6 @@ export async function down(next) {
|
||||
RETURN donationInfo
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -62,6 +62,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = ''
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -17,7 +19,6 @@ export async function up(next) {
|
||||
`,
|
||||
)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -26,11 +27,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -45,7 +46,6 @@ export async function down(next) {
|
||||
`,
|
||||
)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -54,6 +54,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = `
|
||||
@ -5,7 +7,7 @@ export const description = `
|
||||
Additional we like to have fulltext indices the keys 'name', 'slug', 'about', and 'description'.
|
||||
`
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -26,7 +28,6 @@ export async function up(next) {
|
||||
`)
|
||||
*/
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -35,11 +36,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -59,7 +60,6 @@ export async function down(next) {
|
||||
`)
|
||||
await transaction.commit()
|
||||
*/
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -68,6 +68,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = ''
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -34,7 +36,6 @@ export async function up(next) {
|
||||
)
|
||||
await transaction.commit()
|
||||
*/
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -43,11 +44,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -60,7 +61,6 @@ export async function down(next) {
|
||||
await transaction.run(`CALL db.index.fulltext.drop("tag_fulltext_search")`)
|
||||
await transaction.commit()
|
||||
*/
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -69,6 +69,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = 'Add to all existing posts the Article label'
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -14,7 +16,6 @@ export async function up(next) {
|
||||
RETURN post
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -23,11 +24,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -39,7 +40,6 @@ export async function down(next) {
|
||||
RETURN post
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -48,6 +48,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = 'Add postType property Article to all posts'
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -14,7 +16,6 @@ export async function up(next) {
|
||||
RETURN post
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -23,11 +24,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -39,7 +40,6 @@ export async function down(next) {
|
||||
RETURN post
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -48,6 +48,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-base-to-string */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = `
|
||||
@ -5,7 +9,7 @@ Transform event start and end date of format 'YYYY-MM-DD HH:MM:SS' in CEST
|
||||
to ISOString in UTC.
|
||||
`
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -18,11 +22,11 @@ export async function up(next) {
|
||||
`)
|
||||
for (const event of events.records) {
|
||||
let [id, eventStart, eventEnd] = event
|
||||
let date = new Date(eventStart)
|
||||
let date = new Date(eventStart as string)
|
||||
date.setHours(date.getHours() - 1)
|
||||
eventStart = date.toISOString()
|
||||
if (eventEnd) {
|
||||
date = new Date(eventEnd)
|
||||
date = new Date(eventEnd as string)
|
||||
date.setHours(date.getHours() - 1)
|
||||
eventEnd = date.toISOString()
|
||||
}
|
||||
@ -34,7 +38,6 @@ export async function up(next) {
|
||||
`)
|
||||
}
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -43,18 +46,17 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
|
||||
try {
|
||||
// No sense in running this down
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -63,6 +65,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = `
|
||||
All authors observe their posts.
|
||||
`
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -21,7 +23,6 @@ export async function up(next) {
|
||||
RETURN post
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -30,11 +31,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -47,7 +48,6 @@ export async function down(next) {
|
||||
RETURN p
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -56,6 +56,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = `
|
||||
All users commenting a post observe the post.
|
||||
`
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -21,7 +23,6 @@ export async function up(next) {
|
||||
RETURN post
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -30,11 +31,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -48,7 +49,6 @@ export async function down(next) {
|
||||
RETURN p
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -57,6 +57,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description =
|
||||
'Transforms the `sendNotificationEmails` property on User to a multi value system'
|
||||
|
||||
export async function up(next) {
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -22,7 +24,6 @@ export async function up(next) {
|
||||
REMOVE user.sendNotificationEmails
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -31,11 +32,11 @@ export async function up(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(next) {
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
@ -54,7 +55,6 @@ export async function down(next) {
|
||||
REMOVE user.emailNotificationsGroupMemberRoleChanged
|
||||
`)
|
||||
await transaction.commit()
|
||||
next()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
@ -63,6 +63,6 @@ export async function down(next) {
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
session.close()
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
import { getDriver } from '@db/neo4j'
|
||||
|
||||
export const description = ''
|
||||
|
||||
export async function up(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
|
||||
try {
|
||||
// Implement your migration here.
|
||||
await transaction.run(`
|
||||
MATCH (badge:Badge)
|
||||
DETACH DELETE badge
|
||||
`)
|
||||
await transaction.commit()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
await transaction.rollback()
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(_next) {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const transaction = session.beginTransaction()
|
||||
|
||||
try {
|
||||
// cannot be rolled back
|
||||
// Implement your migration here.
|
||||
// await transaction.run(``)
|
||||
// await transaction.commit()
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
await transaction.rollback()
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('rolled back')
|
||||
throw new Error(error)
|
||||
} finally {
|
||||
await session.close()
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable import/no-named-as-default-member */
|
||||
import neo4j from 'neo4j-driver'
|
||||
import neo4j, { Driver } from 'neo4j-driver'
|
||||
import Neode from 'neode'
|
||||
|
||||
import CONFIG from '@config/index'
|
||||
import models from '@models/index'
|
||||
|
||||
let driver
|
||||
let driver: Driver
|
||||
const defaultOptions = {
|
||||
uri: CONFIG.NEO4J_URI,
|
||||
username: CONFIG.NEO4J_USERNAME,
|
||||
@ -20,7 +23,7 @@ export function getDriver(options = {}) {
|
||||
return driver
|
||||
}
|
||||
|
||||
let neodeInstance
|
||||
let neodeInstance: Neode
|
||||
export function getNeode(options = {}) {
|
||||
if (!neodeInstance) {
|
||||
const { uri, username, password } = { ...defaultOptions, ...options }
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable n/no-process-exit */
|
||||
import CONFIG from '@config/index'
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable n/no-process-exit */
|
||||
import CONFIG from '@config/index'
|
||||
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable n/no-process-exit */
|
||||
import { faker } from '@faker-js/faker'
|
||||
import { createTestClient } from 'apollo-server-testing'
|
||||
@ -5,19 +9,18 @@ import sample from 'lodash/sample'
|
||||
|
||||
import CONFIG from '@config/index'
|
||||
import { categories } from '@constants/categories'
|
||||
import { createCommentMutation } from '@graphql/comments'
|
||||
import {
|
||||
createGroupMutation,
|
||||
joinGroupMutation,
|
||||
changeGroupMemberRoleMutation,
|
||||
} from '@graphql/groups'
|
||||
import { createMessageMutation } from '@graphql/messages'
|
||||
import { createPostMutation } from '@graphql/posts'
|
||||
import { createRoomMutation } from '@graphql/rooms'
|
||||
import { changeGroupMemberRoleMutation } from '@graphql/queries/changeGroupMemberRoleMutation'
|
||||
import { createCommentMutation } from '@graphql/queries/createCommentMutation'
|
||||
import { createGroupMutation } from '@graphql/queries/createGroupMutation'
|
||||
import { createMessageMutation } from '@graphql/queries/createMessageMutation'
|
||||
import { createPostMutation } from '@graphql/queries/createPostMutation'
|
||||
import { createRoomMutation } from '@graphql/queries/createRoomMutation'
|
||||
import { joinGroupMutation } from '@graphql/queries/joinGroupMutation'
|
||||
import createServer from '@src/server'
|
||||
|
||||
import Factory from './factories'
|
||||
import { getNeode, getDriver } from './neo4j'
|
||||
import { trophies, verification } from './seed/badges'
|
||||
|
||||
if (CONFIG.PRODUCTION && !CONFIG.PRODUCTION_DB_CLEAN_ALLOW) {
|
||||
throw new Error(`You cannot seed the database in a non-staging and real production environment!`)
|
||||
@ -25,7 +28,6 @@ if (CONFIG.PRODUCTION && !CONFIG.PRODUCTION_DB_CLEAN_ALLOW) {
|
||||
|
||||
const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
|
||||
/* eslint-disable no-multi-spaces */
|
||||
;(async function () {
|
||||
let authenticatedUser = null
|
||||
const driver = getDriver()
|
||||
@ -124,32 +126,28 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
await Hamburg.relateTo(Germany, 'isIn')
|
||||
await Paris.relateTo(France, 'isIn')
|
||||
|
||||
// badges
|
||||
const racoon = await Factory.build('badge', {
|
||||
id: 'indiegogo_en_racoon',
|
||||
icon: '/img/badges/indiegogo_en_racoon.svg',
|
||||
})
|
||||
const rabbit = await Factory.build('badge', {
|
||||
id: 'indiegogo_en_rabbit',
|
||||
icon: '/img/badges/indiegogo_en_rabbit.svg',
|
||||
})
|
||||
const wolf = await Factory.build('badge', {
|
||||
id: 'indiegogo_en_wolf',
|
||||
icon: '/img/badges/indiegogo_en_wolf.svg',
|
||||
})
|
||||
const bear = await Factory.build('badge', {
|
||||
id: 'indiegogo_en_bear',
|
||||
icon: '/img/badges/indiegogo_en_bear.svg',
|
||||
})
|
||||
const turtle = await Factory.build('badge', {
|
||||
id: 'indiegogo_en_turtle',
|
||||
icon: '/img/badges/indiegogo_en_turtle.svg',
|
||||
})
|
||||
const rhino = await Factory.build('badge', {
|
||||
id: 'indiegogo_en_rhino',
|
||||
icon: '/img/badges/indiegogo_en_rhino.svg',
|
||||
})
|
||||
const {
|
||||
trophyAirship,
|
||||
trophyBee,
|
||||
trophyStarter,
|
||||
trophyFlower,
|
||||
trophyPanda,
|
||||
trophyTiger,
|
||||
trophyAlienship,
|
||||
trophyBalloon,
|
||||
trophyMagicrainbow,
|
||||
trophySuperfounder,
|
||||
trophyBigballoon,
|
||||
trophyLifetree,
|
||||
trophyRacoon,
|
||||
trophyRhino,
|
||||
trophyWolf,
|
||||
trophyTurtle,
|
||||
trophyBear,
|
||||
trophyRabbit,
|
||||
} = await trophies()
|
||||
|
||||
const { verificationAdmin, verificationModerator, verificationDeveloper } = await verification()
|
||||
// users
|
||||
const peterLustig = await Factory.build(
|
||||
'user',
|
||||
@ -243,14 +241,50 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
await jennyRostock.relateTo(Paris, 'isIn')
|
||||
await huey.relateTo(Paris, 'isIn')
|
||||
|
||||
await peterLustig.relateTo(racoon, 'rewarded')
|
||||
await peterLustig.relateTo(rhino, 'rewarded')
|
||||
await peterLustig.relateTo(wolf, 'rewarded')
|
||||
await bobDerBaumeister.relateTo(racoon, 'rewarded')
|
||||
await bobDerBaumeister.relateTo(turtle, 'rewarded')
|
||||
await jennyRostock.relateTo(bear, 'rewarded')
|
||||
await dagobert.relateTo(rabbit, 'rewarded')
|
||||
// badges
|
||||
await peterLustig.relateTo(trophyRacoon, 'rewarded')
|
||||
await peterLustig.relateTo(trophyRhino, 'rewarded')
|
||||
await peterLustig.relateTo(trophyWolf, 'rewarded')
|
||||
await peterLustig.relateTo(trophyAirship, 'rewarded')
|
||||
await peterLustig.relateTo(verificationAdmin, 'verifies')
|
||||
await peterLustig.relateTo(trophyRacoon, 'selected', { slot: 0 })
|
||||
await peterLustig.relateTo(trophyRhino, 'selected', { slot: 1 })
|
||||
await peterLustig.relateTo(trophyAirship, 'selected', { slot: 5 })
|
||||
|
||||
await bobDerBaumeister.relateTo(trophyRacoon, 'rewarded')
|
||||
await bobDerBaumeister.relateTo(trophyTurtle, 'rewarded')
|
||||
await bobDerBaumeister.relateTo(trophyBee, 'rewarded')
|
||||
await bobDerBaumeister.relateTo(verificationModerator, 'verifies')
|
||||
await bobDerBaumeister.relateTo(trophyRacoon, 'selected', { slot: 1 })
|
||||
await bobDerBaumeister.relateTo(trophyTurtle, 'selected', { slot: 2 })
|
||||
|
||||
await jennyRostock.relateTo(trophyBear, 'rewarded')
|
||||
await jennyRostock.relateTo(trophyStarter, 'rewarded')
|
||||
await jennyRostock.relateTo(trophyFlower, 'rewarded')
|
||||
await jennyRostock.relateTo(trophyBear, 'selected', { slot: 0 })
|
||||
await jennyRostock.relateTo(trophyStarter, 'selected', { slot: 1 })
|
||||
await jennyRostock.relateTo(trophyFlower, 'selected', { slot: 2 })
|
||||
|
||||
await huey.relateTo(trophyPanda, 'rewarded')
|
||||
await huey.relateTo(trophyTiger, 'rewarded')
|
||||
await huey.relateTo(trophyAlienship, 'rewarded')
|
||||
await huey.relateTo(trophyBalloon, 'rewarded')
|
||||
await huey.relateTo(trophyMagicrainbow, 'rewarded')
|
||||
await huey.relateTo(trophySuperfounder, 'rewarded')
|
||||
await huey.relateTo(verificationDeveloper, 'verifies')
|
||||
await huey.relateTo(trophyPanda, 'selected', { slot: 0 })
|
||||
await huey.relateTo(trophyTiger, 'selected', { slot: 1 })
|
||||
await huey.relateTo(trophyAlienship, 'selected', { slot: 2 })
|
||||
|
||||
await dewey.relateTo(trophyBigballoon, 'rewarded')
|
||||
await dewey.relateTo(trophyLifetree, 'rewarded')
|
||||
await dewey.relateTo(trophyBigballoon, 'selected', { slot: 7 })
|
||||
await dewey.relateTo(trophyLifetree, 'selected', { slot: 8 })
|
||||
|
||||
await louie.relateTo(trophyRabbit, 'rewarded')
|
||||
await louie.relateTo(trophyRabbit, 'selected', { slot: 4 })
|
||||
|
||||
// Friends
|
||||
await peterLustig.relateTo(bobDerBaumeister, 'friends')
|
||||
await peterLustig.relateTo(jennyRostock, 'friends')
|
||||
await bobDerBaumeister.relateTo(jennyRostock, 'friends')
|
||||
@ -635,9 +669,9 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
categoryIds: ['cat16'],
|
||||
author: peterLustig,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'food', width: 300, height: 169 }),
|
||||
width: 300,
|
||||
height: 169,
|
||||
sensitive: true,
|
||||
aspectRatio: 300 / 169,
|
||||
}),
|
||||
},
|
||||
)
|
||||
@ -651,8 +685,8 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
categoryIds: ['cat1'],
|
||||
author: bobDerBaumeister,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'technics', width: 300, height: 1500 }),
|
||||
aspectRatio: 300 / 1500,
|
||||
width: 300,
|
||||
height: 1500,
|
||||
}),
|
||||
},
|
||||
)
|
||||
@ -699,8 +733,8 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
categoryIds: ['cat6'],
|
||||
author: peterLustig,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'city', width: 300, height: 857 }),
|
||||
aspectRatio: 300 / 857,
|
||||
width: 300,
|
||||
height: 857,
|
||||
}),
|
||||
},
|
||||
)
|
||||
@ -738,8 +772,8 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
categoryIds: ['cat11'],
|
||||
author: louie,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'people', width: 300, height: 901 }),
|
||||
aspectRatio: 300 / 901,
|
||||
width: 300,
|
||||
height: 901,
|
||||
}),
|
||||
},
|
||||
)
|
||||
@ -764,8 +798,8 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
categoryIds: ['cat14'],
|
||||
author: jennyRostock,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'abstract', width: 300, height: 200 }),
|
||||
aspectRatio: 300 / 450,
|
||||
width: 300,
|
||||
height: 200,
|
||||
}),
|
||||
},
|
||||
)
|
||||
@ -824,7 +858,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
mutation: createPostMutation(),
|
||||
variables: {
|
||||
id: 'p8',
|
||||
image: faker.image.urlLoremFlickr({ category: 'nature' }),
|
||||
title: `Quantum Flow Theory explains Quantum Gravity`,
|
||||
content: hashtagAndMention1,
|
||||
categoryIds: ['cat8'],
|
||||
@ -878,6 +911,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
|
||||
authenticatedUser = null
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const comments: any[] = []
|
||||
comments.push(
|
||||
await Factory.build(
|
||||
@ -1052,6 +1086,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
await huey.relateTo(p9, 'shouted')
|
||||
await louie.relateTo(p10, 'shouted')
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const reports: any[] = []
|
||||
reports.push(
|
||||
await Factory.build('report'),
|
||||
@ -1159,6 +1194,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
closed: true,
|
||||
})
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const additionalUsers: any[] = []
|
||||
for (let i = 0; i < 30; i++) {
|
||||
const user = await Factory.build('user')
|
||||
@ -1180,9 +1216,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
{
|
||||
categoryIds: ['cat1'],
|
||||
author: jennyRostock,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'abstract' }),
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -1231,9 +1264,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
{
|
||||
categoryIds: ['cat1'],
|
||||
author: peterLustig,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'city' }),
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -1282,9 +1312,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
{
|
||||
categoryIds: ['cat1'],
|
||||
author: dewey,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'food' }),
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -1333,9 +1360,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
{
|
||||
categoryIds: ['cat1'],
|
||||
author: louie,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'technics' }),
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -1384,9 +1408,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
{
|
||||
categoryIds: ['cat1'],
|
||||
author: bobDerBaumeister,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'people' }),
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -1435,9 +1456,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
{
|
||||
categoryIds: ['cat1'],
|
||||
author: huey,
|
||||
image: Factory.build('image', {
|
||||
url: faker.image.urlLoremFlickr({ category: 'nature' }),
|
||||
}),
|
||||
},
|
||||
)
|
||||
}
|
||||
@ -1566,7 +1584,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.log('Seeded Data...')
|
||||
await driver.close()
|
||||
await neode.close()
|
||||
neode.close()
|
||||
process.exit(0)
|
||||
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||
} catch (err) {
|
||||
@ -1575,4 +1593,3 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
process.exit(1)
|
||||
}
|
||||
})()
|
||||
/* eslint-enable no-multi-spaces */
|
||||
|
||||
188
backend/src/db/seed/badges.ts
Normal file
@ -0,0 +1,188 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import Factory from '@db/factories'
|
||||
|
||||
export const trophies = async () => {
|
||||
return {
|
||||
// Blue Animals
|
||||
trophyBear: await Factory.build('badge', {
|
||||
id: 'trophy_bear',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Bear',
|
||||
icon: '/img/badges/trophy_blue_bear.svg',
|
||||
}),
|
||||
trophyPanda: await Factory.build('badge', {
|
||||
id: 'trophy_panda',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Panda',
|
||||
icon: '/img/badges/trophy_blue_panda.svg',
|
||||
}),
|
||||
trophyRabbit: await Factory.build('badge', {
|
||||
id: 'trophy_rabbit',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Rabbit',
|
||||
icon: '/img/badges/trophy_blue_rabbit.svg',
|
||||
}),
|
||||
trophyRacoon: await Factory.build('badge', {
|
||||
id: 'trophy_racoon',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Racoon',
|
||||
icon: '/img/badges/trophy_blue_racoon.svg',
|
||||
}),
|
||||
trophyRhino: await Factory.build('badge', {
|
||||
id: 'trophy_rhino',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Rhino',
|
||||
icon: '/img/badges/trophy_blue_rhino.svg',
|
||||
}),
|
||||
trophyTiger: await Factory.build('badge', {
|
||||
id: 'trophy_tiger',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Tiger',
|
||||
icon: '/img/badges/trophy_blue_tiger.svg',
|
||||
}),
|
||||
trophyTurtle: await Factory.build('badge', {
|
||||
id: 'trophy_turtle',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Turtle',
|
||||
icon: '/img/badges/trophy_blue_turtle.svg',
|
||||
}),
|
||||
trophyWhale: await Factory.build('badge', {
|
||||
id: 'trophy_whale',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Whale',
|
||||
icon: '/img/badges/trophy_blue_whale.svg',
|
||||
}),
|
||||
trophyWolf: await Factory.build('badge', {
|
||||
id: 'trophy_wolf',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Wolf',
|
||||
icon: '/img/badges/trophy_blue_wolf.svg',
|
||||
}),
|
||||
// Green Transports
|
||||
trophyAirship: await Factory.build('badge', {
|
||||
id: 'trophy_airship',
|
||||
type: 'trophy',
|
||||
description: 'You earned an Airship',
|
||||
icon: '/img/badges/trophy_green_airship.svg',
|
||||
}),
|
||||
trophyAlienship: await Factory.build('badge', {
|
||||
id: 'trophy_alienship',
|
||||
type: 'trophy',
|
||||
description: 'You earned an Alienship',
|
||||
icon: '/img/badges/trophy_green_alienship.svg',
|
||||
}),
|
||||
trophyBalloon: await Factory.build('badge', {
|
||||
id: 'trophy_balloon',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Balloon',
|
||||
icon: '/img/badges/trophy_green_balloon.svg',
|
||||
}),
|
||||
trophyBigballoon: await Factory.build('badge', {
|
||||
id: 'trophy_bigballoon',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Big Balloon',
|
||||
icon: '/img/badges/trophy_green_bigballoon.svg',
|
||||
}),
|
||||
trophyCrane: await Factory.build('badge', {
|
||||
id: 'trophy_crane',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Crane',
|
||||
icon: '/img/badges/trophy_green_crane.svg',
|
||||
}),
|
||||
trophyGlider: await Factory.build('badge', {
|
||||
id: 'trophy_glider',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Glider',
|
||||
icon: '/img/badges/trophy_green_glider.svg',
|
||||
}),
|
||||
trophyHelicopter: await Factory.build('badge', {
|
||||
id: 'trophy_helicopter',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Helicopter',
|
||||
icon: '/img/badges/trophy_green_helicopter.svg',
|
||||
}),
|
||||
// Green Animals
|
||||
trophyBee: await Factory.build('badge', {
|
||||
id: 'trophy_bee',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Bee',
|
||||
icon: '/img/badges/trophy_green_bee.svg',
|
||||
}),
|
||||
trophyButterfly: await Factory.build('badge', {
|
||||
id: 'trophy_butterfly',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Butterfly',
|
||||
icon: '/img/badges/trophy_green_butterfly.svg',
|
||||
}),
|
||||
// Green Plants
|
||||
trophyFlower: await Factory.build('badge', {
|
||||
id: 'trophy_flower',
|
||||
type: 'trophy',
|
||||
description: 'You earned a Flower',
|
||||
icon: '/img/badges/trophy_green_flower.svg',
|
||||
}),
|
||||
trophyLifetree: await Factory.build('badge', {
|
||||
id: 'trophy_lifetree',
|
||||
type: 'trophy',
|
||||
description: 'You earned the tree of life',
|
||||
icon: '/img/badges/trophy_green_lifetree.svg',
|
||||
}),
|
||||
// Green Misc
|
||||
trophyDoublerainbow: await Factory.build('badge', {
|
||||
id: 'trophy_doublerainbow',
|
||||
type: 'trophy',
|
||||
description: 'You earned the Double Rainbow',
|
||||
icon: '/img/badges/trophy_green_doublerainbow.svg',
|
||||
}),
|
||||
trophyEndrainbow: await Factory.build('badge', {
|
||||
id: 'trophy_endrainbow',
|
||||
type: 'trophy',
|
||||
description: 'You earned the End of the Rainbow',
|
||||
icon: '/img/badges/trophy_green_endrainbow.svg',
|
||||
}),
|
||||
trophyMagicrainbow: await Factory.build('badge', {
|
||||
id: 'trophy_magicrainbow',
|
||||
type: 'trophy',
|
||||
description: 'You earned the Magic Rainbow',
|
||||
icon: '/img/badges/trophy_green_magicrainbow.svg',
|
||||
}),
|
||||
trophyStarter: await Factory.build('badge', {
|
||||
id: 'trophy_starter',
|
||||
type: 'trophy',
|
||||
description: 'You earned the Starter Badge',
|
||||
icon: '/img/badges/trophy_green_starter.svg',
|
||||
}),
|
||||
trophySuperfounder: await Factory.build('badge', {
|
||||
id: 'trophy_superfounder',
|
||||
type: 'trophy',
|
||||
description: 'You earned the Super Founder Badge',
|
||||
icon: '/img/badges/trophy_green_superfounder.svg',
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
export const verification = async () => {
|
||||
return {
|
||||
// Red Role
|
||||
verificationModerator: await Factory.build('badge', {
|
||||
id: 'verification_moderator',
|
||||
type: 'verification',
|
||||
description: 'You are a Moderator',
|
||||
icon: '/img/badges/verification_red_moderator.svg',
|
||||
}),
|
||||
verificationAdmin: await Factory.build('badge', {
|
||||
id: 'verification_admin',
|
||||
type: 'verification',
|
||||
description: 'You are an Administrator',
|
||||
icon: '/img/badges/verification_red_admin.svg',
|
||||
}),
|
||||
verificationDeveloper: await Factory.build('badge', {
|
||||
id: 'verification_developer',
|
||||
type: 'verification',
|
||||
description: 'You are a Developer',
|
||||
icon: '/img/badges/verification_red_developer.svg',
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -1,216 +0,0 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
// ------ mutations
|
||||
|
||||
export const createGroupMutation = () => {
|
||||
return gql`
|
||||
mutation (
|
||||
$id: ID
|
||||
$name: String!
|
||||
$slug: String
|
||||
$about: String
|
||||
$description: String!
|
||||
$groupType: GroupType!
|
||||
$actionRadius: GroupActionRadius!
|
||||
$categoryIds: [ID]
|
||||
$locationName: String # empty string '' sets it to null
|
||||
) {
|
||||
CreateGroup(
|
||||
id: $id
|
||||
name: $name
|
||||
slug: $slug
|
||||
about: $about
|
||||
description: $description
|
||||
groupType: $groupType
|
||||
actionRadius: $actionRadius
|
||||
categoryIds: $categoryIds
|
||||
locationName: $locationName
|
||||
) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
createdAt
|
||||
updatedAt
|
||||
disabled
|
||||
deleted
|
||||
about
|
||||
description
|
||||
descriptionExcerpt
|
||||
groupType
|
||||
actionRadius
|
||||
categories {
|
||||
id
|
||||
slug
|
||||
name
|
||||
icon
|
||||
}
|
||||
locationName
|
||||
location {
|
||||
name
|
||||
nameDE
|
||||
nameEN
|
||||
}
|
||||
myRole
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const updateGroupMutation = () => {
|
||||
return gql`
|
||||
mutation (
|
||||
$id: ID!
|
||||
$name: String
|
||||
$slug: String
|
||||
$about: String
|
||||
$description: String
|
||||
$actionRadius: GroupActionRadius
|
||||
$categoryIds: [ID]
|
||||
$avatar: ImageInput
|
||||
$locationName: String # empty string '' sets it to null
|
||||
) {
|
||||
UpdateGroup(
|
||||
id: $id
|
||||
name: $name
|
||||
slug: $slug
|
||||
about: $about
|
||||
description: $description
|
||||
actionRadius: $actionRadius
|
||||
categoryIds: $categoryIds
|
||||
avatar: $avatar
|
||||
locationName: $locationName
|
||||
) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
createdAt
|
||||
updatedAt
|
||||
disabled
|
||||
deleted
|
||||
about
|
||||
description
|
||||
descriptionExcerpt
|
||||
groupType
|
||||
actionRadius
|
||||
categories {
|
||||
id
|
||||
slug
|
||||
name
|
||||
icon
|
||||
}
|
||||
# avatar # test this as result
|
||||
locationName
|
||||
location {
|
||||
name
|
||||
nameDE
|
||||
nameEN
|
||||
}
|
||||
myRole
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const joinGroupMutation = () => {
|
||||
return gql`
|
||||
mutation ($groupId: ID!, $userId: ID!) {
|
||||
JoinGroup(groupId: $groupId, userId: $userId) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
myRoleInGroup
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const leaveGroupMutation = () => {
|
||||
return gql`
|
||||
mutation ($groupId: ID!, $userId: ID!) {
|
||||
LeaveGroup(groupId: $groupId, userId: $userId) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
myRoleInGroup
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const changeGroupMemberRoleMutation = () => {
|
||||
return gql`
|
||||
mutation ($groupId: ID!, $userId: ID!, $roleInGroup: GroupMemberRole!) {
|
||||
ChangeGroupMemberRole(groupId: $groupId, userId: $userId, roleInGroup: $roleInGroup) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
myRoleInGroup
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const removeUserFromGroupMutation = () => {
|
||||
return gql`
|
||||
mutation ($groupId: ID!, $userId: ID!) {
|
||||
RemoveUserFromGroup(groupId: $groupId, userId: $userId) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
myRoleInGroup
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
// ------ queries
|
||||
|
||||
export const groupQuery = () => {
|
||||
return gql`
|
||||
query ($isMember: Boolean, $id: ID, $slug: String) {
|
||||
Group(isMember: $isMember, id: $id, slug: $slug) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
createdAt
|
||||
updatedAt
|
||||
disabled
|
||||
deleted
|
||||
about
|
||||
description
|
||||
descriptionExcerpt
|
||||
groupType
|
||||
actionRadius
|
||||
categories {
|
||||
id
|
||||
slug
|
||||
name
|
||||
icon
|
||||
}
|
||||
avatar {
|
||||
url
|
||||
}
|
||||
locationName
|
||||
location {
|
||||
name
|
||||
nameDE
|
||||
nameEN
|
||||
}
|
||||
myRole
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const groupMembersQuery = () => {
|
||||
return gql`
|
||||
query ($id: ID!) {
|
||||
GroupMembers(id: $id) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
myRoleInGroup
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const createMessageMutation = () => {
|
||||
return gql`
|
||||
mutation ($roomId: ID!, $content: String!) {
|
||||
CreateMessage(roomId: $roomId, content: $content) {
|
||||
id
|
||||
content
|
||||
senderId
|
||||
username
|
||||
avatar
|
||||
date
|
||||
saved
|
||||
distributed
|
||||
seen
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const messageQuery = () => {
|
||||
return gql`
|
||||
query ($roomId: ID!, $first: Int, $offset: Int) {
|
||||
Message(roomId: $roomId, first: $first, offset: $offset, orderBy: indexId_desc) {
|
||||
_id
|
||||
id
|
||||
indexId
|
||||
content
|
||||
senderId
|
||||
author {
|
||||
id
|
||||
}
|
||||
username
|
||||
avatar
|
||||
date
|
||||
saved
|
||||
distributed
|
||||
seen
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const markMessagesAsSeen = () => {
|
||||
return gql`
|
||||
mutation ($messageIds: [String!]) {
|
||||
MarkMessagesAsSeen(messageIds: $messageIds)
|
||||
}
|
||||
`
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
// ------ mutations
|
||||
|
||||
export const markAsReadMutation = () => {
|
||||
return gql`
|
||||
mutation ($id: ID!) {
|
||||
markAsRead(id: $id) {
|
||||
from {
|
||||
__typename
|
||||
... on Post {
|
||||
content
|
||||
}
|
||||
... on Comment {
|
||||
content
|
||||
}
|
||||
}
|
||||
read
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const markAllAsReadMutation = () => {
|
||||
return gql`
|
||||
mutation {
|
||||
markAllAsRead {
|
||||
from {
|
||||
__typename
|
||||
... on Post {
|
||||
content
|
||||
}
|
||||
... on Comment {
|
||||
content
|
||||
}
|
||||
}
|
||||
read
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
// ------ queries
|
||||
|
||||
export const notificationQuery = () => {
|
||||
return gql`
|
||||
query ($read: Boolean, $orderBy: NotificationOrdering) {
|
||||
notifications(read: $read, orderBy: $orderBy) {
|
||||
from {
|
||||
__typename
|
||||
... on Post {
|
||||
content
|
||||
}
|
||||
... on Comment {
|
||||
content
|
||||
}
|
||||
}
|
||||
read
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
@ -1,113 +0,0 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
// ------ mutations
|
||||
|
||||
export const createPostMutation = () => {
|
||||
return gql`
|
||||
mutation (
|
||||
$id: ID
|
||||
$title: String!
|
||||
$slug: String
|
||||
$content: String!
|
||||
$categoryIds: [ID]
|
||||
$groupId: ID
|
||||
$postType: PostType
|
||||
$eventInput: _EventInput
|
||||
) {
|
||||
CreatePost(
|
||||
id: $id
|
||||
title: $title
|
||||
slug: $slug
|
||||
content: $content
|
||||
categoryIds: $categoryIds
|
||||
groupId: $groupId
|
||||
postType: $postType
|
||||
eventInput: $eventInput
|
||||
) {
|
||||
id
|
||||
slug
|
||||
title
|
||||
content
|
||||
disabled
|
||||
deleted
|
||||
postType
|
||||
author {
|
||||
name
|
||||
}
|
||||
categories {
|
||||
id
|
||||
}
|
||||
eventStart
|
||||
eventEnd
|
||||
eventLocationName
|
||||
eventVenue
|
||||
eventIsOnline
|
||||
eventLocation {
|
||||
lng
|
||||
lat
|
||||
}
|
||||
isObservedByMe
|
||||
observingUsersCount
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
// ------ queries
|
||||
|
||||
export const postQuery = () => {
|
||||
return gql`
|
||||
query Post($id: ID!) {
|
||||
Post(id: $id) {
|
||||
id
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const filterPosts = () => {
|
||||
return gql`
|
||||
query Post($filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) {
|
||||
Post(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
|
||||
id
|
||||
title
|
||||
content
|
||||
eventStart
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const profilePagePosts = () => {
|
||||
return gql`
|
||||
query profilePagePosts(
|
||||
$filter: _PostFilter
|
||||
$first: Int
|
||||
$offset: Int
|
||||
$orderBy: [_PostOrdering]
|
||||
) {
|
||||
profilePagePosts(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
|
||||
id
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
export const searchPosts = () => {
|
||||
return gql`
|
||||
query ($query: String!, $firstPosts: Int, $postsOffset: Int) {
|
||||
searchPosts(query: $query, firstPosts: $firstPosts, postsOffset: $postsOffset) {
|
||||
postCount
|
||||
posts {
|
||||
id
|
||||
title
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
14
backend/src/graphql/queries/changeGroupMemberRoleMutation.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const changeGroupMemberRoleMutation = () => {
|
||||
return gql`
|
||||
mutation ($groupId: ID!, $userId: ID!, $roleInGroup: GroupMemberRole!) {
|
||||
ChangeGroupMemberRole(groupId: $groupId, userId: $userId, roleInGroup: $roleInGroup) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
myRoleInGroup
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
@ -1,7 +1,5 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
// ------ mutations
|
||||
|
||||
export const createCommentMutation = gql`
|
||||
mutation ($id: ID, $postId: ID!, $content: String!) {
|
||||
CreateComment(id: $id, postId: $postId, content: $content) {
|
||||
@ -9,7 +7,3 @@ export const createCommentMutation = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
// ------ queries
|
||||
|
||||
// fill queries in here
|
||||
55
backend/src/graphql/queries/createGroupMutation.ts
Normal file
@ -0,0 +1,55 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const createGroupMutation = () => {
|
||||
return gql`
|
||||
mutation (
|
||||
$id: ID
|
||||
$name: String!
|
||||
$slug: String
|
||||
$about: String
|
||||
$description: String!
|
||||
$groupType: GroupType!
|
||||
$actionRadius: GroupActionRadius!
|
||||
$categoryIds: [ID]
|
||||
$locationName: String # empty string '' sets it to null
|
||||
) {
|
||||
CreateGroup(
|
||||
id: $id
|
||||
name: $name
|
||||
slug: $slug
|
||||
about: $about
|
||||
description: $description
|
||||
groupType: $groupType
|
||||
actionRadius: $actionRadius
|
||||
categoryIds: $categoryIds
|
||||
locationName: $locationName
|
||||
) {
|
||||
id
|
||||
name
|
||||
slug
|
||||
createdAt
|
||||
updatedAt
|
||||
disabled
|
||||
deleted
|
||||
about
|
||||
description
|
||||
descriptionExcerpt
|
||||
groupType
|
||||
actionRadius
|
||||
categories {
|
||||
id
|
||||
slug
|
||||
name
|
||||
icon
|
||||
}
|
||||
locationName
|
||||
location {
|
||||
name
|
||||
nameDE
|
||||
nameEN
|
||||
}
|
||||
myRole
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
19
backend/src/graphql/queries/createMessageMutation.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const createMessageMutation = () => {
|
||||
return gql`
|
||||
mutation ($roomId: ID!, $content: String!) {
|
||||
CreateMessage(roomId: $roomId, content: $content) {
|
||||
id
|
||||
content
|
||||
senderId
|
||||
username
|
||||
avatar
|
||||
date
|
||||
saved
|
||||
distributed
|
||||
seen
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
52
backend/src/graphql/queries/createPostMutation.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const createPostMutation = () => {
|
||||
return gql`
|
||||
mutation (
|
||||
$id: ID
|
||||
$title: String!
|
||||
$slug: String
|
||||
$content: String!
|
||||
$categoryIds: [ID]
|
||||
$groupId: ID
|
||||
$postType: PostType
|
||||
$eventInput: _EventInput
|
||||
) {
|
||||
CreatePost(
|
||||
id: $id
|
||||
title: $title
|
||||
slug: $slug
|
||||
content: $content
|
||||
categoryIds: $categoryIds
|
||||
groupId: $groupId
|
||||
postType: $postType
|
||||
eventInput: $eventInput
|
||||
) {
|
||||
id
|
||||
slug
|
||||
title
|
||||
content
|
||||
disabled
|
||||
deleted
|
||||
postType
|
||||
author {
|
||||
name
|
||||
}
|
||||
categories {
|
||||
id
|
||||
}
|
||||
eventStart
|
||||
eventEnd
|
||||
eventLocationName
|
||||
eventVenue
|
||||
eventIsOnline
|
||||
eventLocation {
|
||||
lng
|
||||
lat
|
||||
}
|
||||
isObservedByMe
|
||||
observingUsersCount
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
24
backend/src/graphql/queries/createRoomMutation.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const createRoomMutation = () => {
|
||||
return gql`
|
||||
mutation ($userId: ID!) {
|
||||
CreateRoom(userId: $userId) {
|
||||
id
|
||||
roomId
|
||||
roomName
|
||||
lastMessageAt
|
||||
unreadCount
|
||||
#avatar
|
||||
users {
|
||||
_id
|
||||
id
|
||||
name
|
||||
avatar {
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||