Merge branch 'master' of github.com:Ocelot-Social-Community/Ocelot-Social into brand-reformer-network-first-step

This commit is contained in:
Wolfgang Huß 2025-04-23 11:02:16 +02:00
commit 8d3eb981bc
345 changed files with 6709 additions and 1802 deletions

View File

@ -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'

View File

@ -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

1
.gitignore vendored
View File

@ -10,6 +10,7 @@ yarn-error.log*
kubeconfig.yaml
backup-cron-job.log
.vscode
.nuxt
node_modules/
cypress/videos

View File

@ -16,6 +16,7 @@ module.exports = {
'plugin:promise/recommended',
'plugin:security/recommended-legacy',
'plugin:@eslint-community/eslint-comments/recommended',
'prettier',
],
settings: {
'import/parsers': {
@ -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,

View File

@ -23,6 +23,7 @@ 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/data/ src/db/data
ONBUILD RUN yarn install --production=false --frozen-lockfile --non-interactive
ONBUILD RUN yarn run build
ONBUILD RUN mkdir /build

View File

@ -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:

View File

View File

@ -18,6 +18,8 @@
"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-production.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",
@ -42,7 +44,7 @@
"babel-eslint": "~10.1.0",
"babel-jest": "~29.7.0",
"babel-plugin-transform-runtime": "^6.23.0",
"bcryptjs": "~2.4.3",
"bcryptjs": "~3.0.2",
"body-parser": "^1.20.3",
"cheerio": "~1.0.0",
"cors": "~2.8.5",
@ -56,9 +58,9 @@
"graphql-shield": "~7.2.2",
"graphql-subscriptions": "^1.1.0",
"graphql-tag": "~2.10.3",
"graphql-upload": "^11.0.0",
"graphql-upload": "^13.0.0",
"helmet": "~8.1.0",
"ioredis": "^4.16.1",
"ioredis": "^5.6.1",
"jsonwebtoken": "~8.5.1",
"languagedetect": "^2.0.0",
"linkify-html": "^4.2.0",
@ -87,10 +89,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,8 +101,8 @@
"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",
"@typescript-eslint/eslint-plugin": "^5.62.0",
@ -109,7 +111,7 @@
"eslint": "^8.57.1",
"eslint-config-prettier": "^10.1.1",
"eslint-config-standard": "^17.1.0",
"eslint-import-resolver-typescript": "^4.3.1",
"eslint-import-resolver-typescript": "^4.3.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-n": "^17.17.0",
@ -122,9 +124,9 @@
"prettier": "^3.5.3",
"require-json5": "^1.3.0",
"rosie": "^2.1.1",
"ts-jest": "^29.3.1",
"ts-jest": "^29.3.2",
"ts-node": "^10.9.2",
"tsc-alias": "^1.8.14",
"tsc-alias": "^1.8.15",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.8.3"
},

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 637 B

After

Width:  |  Height:  |  Size: 637 B

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 654 B

After

Width:  |  Height:  |  Size: 654 B

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -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/

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
/* eslint-disable n/no-process-env */
/* eslint-disable n/no-unpublished-require */
/* eslint-disable n/no-missing-require */
@ -19,6 +27,7 @@ if (require.resolve) {
}
// 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

View 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

View File

@ -1,3 +1,9 @@
/* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable @typescript-eslint/require-await */
/* 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/restrict-template-expressions */
import { hashSync } from 'bcryptjs'
import { v4 as uuid } from 'uuid'

17
backend/src/db/badges.ts Normal file
View File

@ -0,0 +1,17 @@
/* 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 { 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 {
await neode.close()
}
})()

View File

@ -1,3 +1,9 @@
/* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/require-await */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { categories } from '@constants/categories'
import { getDriver } from './neo4j'

View File

@ -1,5 +1,7 @@
/* 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
require('tsconfig-paths/register')

View File

@ -0,0 +1,22 @@
/* 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-misused-promises */
/* eslint-disable @typescript-eslint/no-floating-promises */
import { readdir } from 'node:fs/promises'
import path from 'node:path'
const dataFolder = path.join(__dirname, 'data/')
;(async function () {
const files = await readdir(dataFolder)
files.forEach(async (file) => {
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()
}
})
})()

View File

View File

@ -1,10 +1,17 @@
/* eslint-disable @typescript-eslint/require-await */
/* 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 */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
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 +19,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()
}
@ -40,25 +47,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)
})
@ -85,21 +101,21 @@ Factory.define('basicUser')
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 +240,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 +251,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 +297,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 +309,7 @@ Factory.define('tag')
.attrs({
name: '#human-connection',
})
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('Tag', buildObject)
})
@ -301,7 +317,7 @@ Factory.define('socialMedia')
.attrs({
url: 'https://mastodon.social/@Gargron',
})
.after((buildObject, options) => {
.after((buildObject, _options) => {
return neode.create('SocialMedia', buildObject)
})

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { getDriver, getNeode } from '@db/neo4j'
class Store {

View File

@ -1,8 +1,16 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
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 +19,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)
@ -24,7 +31,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -33,7 +40,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)

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable promise/prefer-await-to-callbacks */
import { throwError, concat } from 'rxjs'
@ -21,12 +29,14 @@ export function up(next) {
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 +58,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 +72,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:

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable promise/prefer-await-to-callbacks */
import { throwError, concat } from 'rxjs'
@ -15,6 +23,7 @@ export function up(next) {
rxSession
.beginTransaction()
.pipe(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
flatMap((transaction: any) =>
concat(
transaction
@ -26,6 +35,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 +53,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'),

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { getDriver } from '@db/neo4j'
export const description = `
@ -8,7 +16,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()

View File

@ -1,3 +1,12 @@
/* eslint-disable @typescript-eslint/no-floating-promises */
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { getDriver } from '@db/neo4j'
export const description = `

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { getDriver } from '@db/neo4j'
export const description =

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { getDriver } from '@db/neo4j'
export const description = `

View File

@ -1,3 +1,10 @@
/* 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 @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'

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
/* eslint-disable no-console */
import { getDriver } from '@db/neo4j'

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { getDriver } from '@db/neo4j'
export const description =

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { getDriver } from '@db/neo4j'
export const description =

View File

@ -1,3 +1,10 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { existsSync } from 'node:fs'

View File

@ -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) {}

View File

@ -1,10 +1,14 @@
/* 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 = `
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 +19,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)
@ -28,7 +31,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -39,7 +42,6 @@ export async function down(next) {
REMOVE p.clickedCount
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -1,10 +1,14 @@
/* 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 = `
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 +19,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)
@ -28,7 +31,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -39,7 +42,6 @@ export async function down(next) {
REMOVE p.viewedTeaserCount
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { v4 as uuid } from 'uuid'
import { getDriver } from '@db/neo4j'
@ -5,7 +13,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 +35,6 @@ export async function up(next) {
{ donationId },
)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -40,7 +47,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -53,7 +60,6 @@ export async function down(next) {
RETURN donationInfo
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -1,8 +1,16 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
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 +25,6 @@ export async function up(next) {
`,
)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -30,7 +37,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -45,7 +52,6 @@ export async function down(next) {
`,
)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { getDriver } from '@db/neo4j'
export const description = `
@ -5,7 +13,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 +34,6 @@ export async function up(next) {
`)
*/
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -39,7 +46,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -59,7 +66,6 @@ export async function down(next) {
`)
await transaction.commit()
*/
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -1,8 +1,16 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
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 +42,6 @@ export async function up(next) {
)
await transaction.commit()
*/
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -47,7 +54,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -60,7 +67,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)

View File

@ -1,8 +1,16 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
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 +22,6 @@ export async function up(next) {
RETURN post
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -27,7 +34,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -39,7 +46,6 @@ export async function down(next) {
RETURN post
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -1,8 +1,16 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
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 +22,6 @@ export async function up(next) {
RETURN post
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -27,7 +34,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -39,7 +46,6 @@ export async function down(next) {
RETURN post
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -1,3 +1,11 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
import { getDriver } from '@db/neo4j'
export const description = `
@ -5,7 +13,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()
@ -34,7 +42,6 @@ export async function up(next) {
`)
}
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -47,14 +54,13 @@ export async function up(next) {
}
}
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)

View File

@ -1,10 +1,18 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
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 +29,6 @@ export async function up(next) {
RETURN post
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -34,7 +41,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -47,7 +54,6 @@ export async function down(next) {
RETURN p
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -1,10 +1,18 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
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 +29,6 @@ export async function up(next) {
RETURN post
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -34,7 +41,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -48,7 +55,6 @@ export async function down(next) {
RETURN p
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -1,9 +1,17 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
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 +30,6 @@ export async function up(next) {
REMOVE user.sendNotificationEmails
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)
@ -35,7 +42,7 @@ export async function up(next) {
}
}
export async function down(next) {
export async function down(_next) {
const driver = getDriver()
const session = driver.session()
const transaction = session.beginTransaction()
@ -54,7 +61,6 @@ export async function down(next) {
REMOVE user.emailNotificationsGroupMemberRoleChanged
`)
await transaction.commit()
next()
} catch (error) {
// eslint-disable-next-line no-console
console.log(error)

View File

@ -0,0 +1,57 @@
/* 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 @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable security/detect-non-literal-fs-filename */
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 {
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 {
session.close()
}
}

View File

@ -1,3 +1,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable import/no-named-as-default-member */
import neo4j from 'neo4j-driver'
import Neode from 'neode'

View File

@ -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'

View File

@ -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'

View File

@ -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!`)
@ -124,32 +127,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 +242,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 +670,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 +686,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 +734,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 +773,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 +799,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 +859,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 +912,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 +1087,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 +1195,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 +1217,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 +1265,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 +1313,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 +1361,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 +1409,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 +1457,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
{
categoryIds: ['cat1'],
author: huey,
image: Factory.build('image', {
url: faker.image.urlLoremFlickr({ category: 'nature' }),
}),
},
)
}

View 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',
}),
}
}

View File

@ -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
}
}
`
}

View File

@ -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)
}
`
}

View File

@ -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
}
}
`
}

View File

@ -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
}
}
}
`
}

View 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
}
}
`
}

View File

@ -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

View 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
}
}
`
}

View 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
}
}
`
}

View 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
}
}
`
}

View 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
}
}
}
}
`
}

View File

@ -0,0 +1,14 @@
import gql from 'graphql-tag'
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
}
}
`
}

View File

@ -0,0 +1,14 @@
import gql from 'graphql-tag'
export const groupMembersQuery = () => {
return gql`
query ($id: ID!) {
GroupMembers(id: $id) {
id
name
slug
myRoleInGroup
}
}
`
}

View File

@ -0,0 +1,38 @@
import gql from 'graphql-tag'
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
}
}
`
}

View File

@ -0,0 +1,14 @@
import gql from 'graphql-tag'
export const joinGroupMutation = () => {
return gql`
mutation ($groupId: ID!, $userId: ID!) {
JoinGroup(groupId: $groupId, userId: $userId) {
id
name
slug
myRoleInGroup
}
}
`
}

View File

@ -0,0 +1,14 @@
import gql from 'graphql-tag'
export const leaveGroupMutation = () => {
return gql`
mutation ($groupId: ID!, $userId: ID!) {
LeaveGroup(groupId: $groupId, userId: $userId) {
id
name
slug
myRoleInGroup
}
}
`
}

View File

@ -1,13 +1,7 @@
import gql from 'graphql-tag'
// ------ mutations
export const loginMutation = gql`
mutation ($email: String!, $password: String!) {
login(email: $email, password: $password)
}
`
// ------ queries
// fill queries in here

View File

@ -0,0 +1,21 @@
import gql from 'graphql-tag'
export const markAllAsReadMutation = () => {
return gql`
mutation {
markAllAsRead {
from {
__typename
... on Post {
content
}
... on Comment {
content
}
}
read
createdAt
}
}
`
}

View File

@ -0,0 +1,21 @@
import gql from 'graphql-tag'
export const markAsReadMutation = () => {
return gql`
mutation ($id: ID!) {
markAsRead(id: $id) {
from {
__typename
... on Post {
content
}
... on Comment {
content
}
}
read
createdAt
}
}
`
}

View File

@ -0,0 +1,9 @@
import gql from 'graphql-tag'
export const markMessagesAsSeen = () => {
return gql`
mutation ($messageIds: [String!]) {
MarkMessagesAsSeen(messageIds: $messageIds)
}
`
}

View File

@ -0,0 +1,24 @@
import gql from 'graphql-tag'
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
}
}
`
}

View File

@ -0,0 +1,21 @@
import gql from 'graphql-tag'
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
}
}
`
}

View File

@ -0,0 +1,13 @@
import gql from 'graphql-tag'
export const postQuery = () => {
return gql`
query Post($id: ID!) {
Post(id: $id) {
id
title
content
}
}
`
}

Some files were not shown because too many files have changed in this diff Show More