mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-03-01 12:44:37 +00:00
refactor(backend): graphql lint + query gql files (#9293)
This commit is contained in:
parent
cef1cceea4
commit
b4db6dc8d8
@ -1,73 +1,62 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
import comments from 'eslint-config-it4c/modules/comments'
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
import eslint from 'eslint-config-it4c/modules/eslint'
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
import importX from 'eslint-config-it4c/modules/import-x'
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
|
import config from 'eslint-config-it4c'
|
||||||
|
import graphql from 'eslint-config-it4c/modules/graphql'
|
||||||
import jest from 'eslint-config-it4c/modules/jest'
|
import jest from 'eslint-config-it4c/modules/jest'
|
||||||
import json from 'eslint-config-it4c/modules/json'
|
|
||||||
import node from 'eslint-config-it4c/modules/node'
|
|
||||||
import prettier from 'eslint-config-it4c/modules/prettier'
|
|
||||||
import promise from 'eslint-config-it4c/modules/promise'
|
|
||||||
import security from 'eslint-config-it4c/modules/security'
|
|
||||||
import typescript from 'eslint-config-it4c/modules/typescript'
|
|
||||||
import yaml from 'eslint-config-it4c/modules/yaml'
|
|
||||||
|
|
||||||
// TODO: GraphQL linting is disabled because @graphql-eslint/eslint-plugin v4
|
|
||||||
// (bundled with eslint-config-it4c) requires graphql@^16, but the backend
|
|
||||||
// uses graphql@^14 (required by apollo-server v2). Re-enable when upgrading graphql.
|
|
||||||
// import graphql from 'eslint-config-it4c/modules/graphql'
|
|
||||||
//
|
|
||||||
// ...graphql.map((c) => ({
|
|
||||||
// ...c,
|
|
||||||
// files: ['**/*.graphql', '**/*.gql'],
|
|
||||||
// })),
|
|
||||||
// {
|
|
||||||
// files: ['**/*.graphql', '**/*.gql'],
|
|
||||||
// languageOptions: {
|
|
||||||
// parserOptions: {
|
|
||||||
// schema: './src/graphql/types/**/*.gql',
|
|
||||||
// assumeValid: true,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// rules: {
|
|
||||||
// '@graphql-eslint/require-description': 'off',
|
|
||||||
// '@graphql-eslint/naming-convention': 'off',
|
|
||||||
// '@graphql-eslint/strict-id-in-types': 'off',
|
|
||||||
// '@graphql-eslint/no-typename-prefix': 'off',
|
|
||||||
// '@graphql-eslint/known-directives': 'off',
|
|
||||||
// '@graphql-eslint/known-argument-names': 'off',
|
|
||||||
// '@graphql-eslint/known-type-names': 'off',
|
|
||||||
// '@graphql-eslint/lone-schema-definition': 'off',
|
|
||||||
// '@graphql-eslint/provided-required-arguments': 'off',
|
|
||||||
// '@graphql-eslint/unique-directive-names': 'off',
|
|
||||||
// '@graphql-eslint/unique-directive-names-per-location': 'off',
|
|
||||||
// '@graphql-eslint/unique-field-definition-names': 'off',
|
|
||||||
// '@graphql-eslint/unique-operation-types': 'off',
|
|
||||||
// '@graphql-eslint/unique-type-names': 'off',
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
ignores: ['node_modules/', 'build/', 'coverage/'],
|
ignores: ['node_modules/', 'build/', 'coverage/'],
|
||||||
},
|
},
|
||||||
...eslint,
|
...config,
|
||||||
...typescript,
|
|
||||||
...importX,
|
|
||||||
...node,
|
|
||||||
...promise,
|
|
||||||
...security,
|
|
||||||
...comments,
|
|
||||||
...json,
|
|
||||||
...yaml,
|
|
||||||
...prettier,
|
|
||||||
...jest,
|
...jest,
|
||||||
|
// GraphQL schema linting (extend file pattern to include .gql)
|
||||||
|
...graphql.map((c) => ({
|
||||||
|
...c,
|
||||||
|
files: ['**/*.graphql', '**/*.gql'],
|
||||||
|
})),
|
||||||
|
{
|
||||||
|
files: ['**/*.graphql', '**/*.gql'],
|
||||||
|
// TODO: Parser must be set explicitly because the it4c module only provides
|
||||||
|
// plugins and rules, not languageOptions. Without this, ESLint uses the JS
|
||||||
|
// parser for .gql files. Remove when fixed in eslint-config-it4c.
|
||||||
|
languageOptions: {
|
||||||
|
parser: graphql[0].plugins['@graphql-eslint'].parser,
|
||||||
|
parserOptions: {
|
||||||
|
graphQLConfig: {
|
||||||
|
schema: './src/graphql/types/**/*.gql',
|
||||||
|
documents: './src/graphql/queries/**/*.gql',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// Would require descriptions on every type/field/input — too noisy for now
|
||||||
|
'@graphql-eslint/require-description': 'off',
|
||||||
|
// camelCase operation names and _id/_ne underscores conflict with existing schema
|
||||||
|
'@graphql-eslint/naming-convention': 'off',
|
||||||
|
// Many types (Image, File, InviteCode, etc.) intentionally lack id: ID!
|
||||||
|
'@graphql-eslint/strict-id-in-types': 'off',
|
||||||
|
// Fields like groupType, queryLocations match parent type name by coincidence
|
||||||
|
'@graphql-eslint/no-typename-prefix': 'off',
|
||||||
|
// neo4j-graphql-js adds arguments (first, offset) at runtime not present in static schema
|
||||||
|
'@graphql-eslint/known-argument-names': 'off',
|
||||||
|
// TODO: operations-recommended rules must be disabled because the it4c
|
||||||
|
// graphql module bundles both schema and operations configs together.
|
||||||
|
// Remove when eslint-config-it4c exports them separately (e.g. graphql/schema).
|
||||||
|
'@graphql-eslint/executable-definitions': 'off',
|
||||||
|
// neo4j-graphql-js adds fields at runtime (_id, relations) not present in static schema
|
||||||
|
'@graphql-eslint/fields-on-correct-type': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// Backend-specific TypeScript overrides
|
// Backend-specific TypeScript overrides
|
||||||
files: ['**/*.ts'],
|
files: ['**/*.ts'],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
projectService: {
|
projectService: {
|
||||||
allowDefaultProject: ['eslint.config.ts'],
|
allowDefaultProject: ['eslint.config.ts', 'jest.config.ts', 'prettier.config.ts'],
|
||||||
},
|
},
|
||||||
tsconfigRootDir: import.meta.dirname,
|
tsconfigRootDir: import.meta.dirname,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
/* eslint-disable import-x/no-commonjs */
|
|
||||||
const requireJSON5 = require('require-json5')
|
|
||||||
const { pathsToModuleNameMapper } = require('ts-jest')
|
|
||||||
|
|
||||||
const { compilerOptions } = requireJSON5('./tsconfig.json')
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
verbose: true,
|
|
||||||
preset: 'ts-jest',
|
|
||||||
collectCoverage: true,
|
|
||||||
collectCoverageFrom: [
|
|
||||||
'**/*.ts',
|
|
||||||
'!**/node_modules/**',
|
|
||||||
'!**/test/**',
|
|
||||||
'!**/build/**',
|
|
||||||
'!**/src/**/?(*.)+(spec|test).ts?(x)',
|
|
||||||
'!**/src/db/**',
|
|
||||||
'!eslint.config.ts',
|
|
||||||
],
|
|
||||||
coverageThreshold: {
|
|
||||||
global: {
|
|
||||||
lines: 93,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
testMatch: ['**/src/**/?(*.)+(spec|test).ts?(x)'],
|
|
||||||
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
|
|
||||||
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
|
|
||||||
}
|
|
||||||
40
backend/jest.config.ts
Normal file
40
backend/jest.config.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { readFileSync } from 'node:fs'
|
||||||
|
|
||||||
|
import { pathsToModuleNameMapper } from 'ts-jest'
|
||||||
|
import { parseConfigFileTextToJson } from 'typescript'
|
||||||
|
|
||||||
|
// eslint-disable-next-line n/no-sync -- config files are synchronous by nature
|
||||||
|
const tsconfigText = readFileSync('./tsconfig.json', 'utf-8')
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- parseConfigFileTextToJson returns untyped config
|
||||||
|
const { config } = parseConfigFileTextToJson('tsconfig.json', tsconfigText)
|
||||||
|
const paths = (config as { compilerOptions: { paths: Record<string, string[]> } }).compilerOptions
|
||||||
|
.paths
|
||||||
|
|
||||||
|
export default {
|
||||||
|
verbose: true,
|
||||||
|
preset: 'ts-jest',
|
||||||
|
collectCoverage: true,
|
||||||
|
collectCoverageFrom: [
|
||||||
|
'**/*.ts',
|
||||||
|
'!**/node_modules/**',
|
||||||
|
'!**/test/**',
|
||||||
|
'!**/build/**',
|
||||||
|
'!**/src/**/?(*.)+(spec|test).ts?(x)',
|
||||||
|
'!**/src/db/**',
|
||||||
|
'!*.config.ts',
|
||||||
|
'!**/*.d.ts',
|
||||||
|
'!**/gql-register.ts',
|
||||||
|
],
|
||||||
|
coverageThreshold: {
|
||||||
|
global: {
|
||||||
|
lines: 93,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
testMatch: ['**/src/**/?(*.)+(spec|test).ts?(x)'],
|
||||||
|
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
|
||||||
|
transform: {
|
||||||
|
'\\.gql$': '<rootDir>/test/graphqlTransform.ts',
|
||||||
|
'\\.tsx?$': 'ts-jest',
|
||||||
|
},
|
||||||
|
moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: '<rootDir>/' }),
|
||||||
|
}
|
||||||
@ -10,20 +10,20 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node build/src/",
|
"start": "node build/src/",
|
||||||
"build": "tsc && tsc-alias && ./scripts/build.copy.files.sh",
|
"build": "tsc && tsc-alias && ./scripts/build.copy.files.sh",
|
||||||
"dev": "nodemon --exec ts-node --require tsconfig-paths/register src/index.ts -e js,ts,gql",
|
"dev": "nodemon --exec tsx src/index.ts -e js,ts,gql",
|
||||||
"dev:debug": "nodemon --exec node --inspect=0.0.0.0:9229 build/src/index.js -e js,ts,gql",
|
"dev:debug": "nodemon --exec node --inspect=0.0.0.0:9229 build/src/index.js -e js,ts,gql",
|
||||||
"lint": "eslint --max-warnings 0 .",
|
"lint": "eslint --max-warnings 0 .",
|
||||||
"test": "cross-env NODE_ENV=test NODE_OPTIONS=--max-old-space-size=8192 jest --runInBand --coverage --forceExit --detectOpenHandles",
|
"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": "tsx src/db/reset.ts",
|
||||||
"db:reset:withmigrations": "ts-node --require tsconfig-paths/register src/db/reset-with-migrations.ts",
|
"db:reset:withmigrations": "tsx src/db/reset-with-migrations.ts",
|
||||||
"db:seed": "ts-node --require tsconfig-paths/register src/db/seed.ts",
|
"db:seed": "tsx --require ./src/graphql/gql-register.ts src/db/seed.ts",
|
||||||
"db:data:admin": "ts-node --require tsconfig-paths/register src/db/admin.ts",
|
"db:data:admin": "tsx src/db/admin.ts",
|
||||||
"db:data:badges": "ts-node --require tsconfig-paths/register src/db/badges.ts",
|
"db:data:badges": "tsx src/db/badges.ts",
|
||||||
"db:data:branding": "ts-node --require tsconfig-paths/register src/db/data-branding.ts",
|
"db:data:branding": "tsx src/db/data-branding.ts",
|
||||||
"db:data:categories": "ts-node --require tsconfig-paths/register src/db/categories.ts",
|
"db:data:categories": "tsx 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": "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",
|
"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",
|
||||||
"db:func:disable:notifications": "ts-node --require tsconfig-paths/register src/db/disable-notifications.ts",
|
"db:func:disable:notifications": "tsx src/db/disable-notifications.ts",
|
||||||
"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",
|
"prod:db:data:branding": "node build/src/db/data-branding.js",
|
||||||
"prod:db:data:categories": "node build/src/db/categories.js",
|
"prod:db:data:categories": "node build/src/db/categories.js",
|
||||||
@ -31,11 +31,13 @@
|
|||||||
"prod:db:func:disable:notifications": "node build/src/db/disable-notifications.js"
|
"prod:db:func:disable:notifications": "node build/src/db/disable-notifications.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@apollo/server": "^4.11.3",
|
||||||
"@aws-sdk/client-s3": "^3.995.0",
|
"@aws-sdk/client-s3": "^3.995.0",
|
||||||
"@aws-sdk/lib-storage": "^3.990.0",
|
"@aws-sdk/lib-storage": "^3.990.0",
|
||||||
|
"@graphql-tools/load-files": "^7.0.0",
|
||||||
|
"@graphql-tools/merge": "^9.0.0",
|
||||||
"@sentry/node": "^5.30.0",
|
"@sentry/node": "^5.30.0",
|
||||||
"@types/mime-types": "^3.0.1",
|
"@types/mime-types": "^3.0.1",
|
||||||
"@apollo/server": "^4.11.3",
|
|
||||||
"bcryptjs": "~3.0.3",
|
"bcryptjs": "~3.0.3",
|
||||||
"body-parser": "^1.20.3",
|
"body-parser": "^1.20.3",
|
||||||
"cheerio": "~1.2.0",
|
"cheerio": "~1.2.0",
|
||||||
@ -44,13 +46,12 @@
|
|||||||
"email-templates": "^13.0.1",
|
"email-templates": "^13.0.1",
|
||||||
"express": "^4.22.1",
|
"express": "^4.22.1",
|
||||||
"graphql": "^16.11.0",
|
"graphql": "^16.11.0",
|
||||||
"graphql-ws": "^5.16.2",
|
|
||||||
"graphql-middleware": "~6.1.35",
|
"graphql-middleware": "~6.1.35",
|
||||||
"graphql-redis-subscriptions": "^2.7.0",
|
"graphql-redis-subscriptions": "^2.7.0",
|
||||||
"graphql-shield": "^7.6.5",
|
"graphql-shield": "^7.6.5",
|
||||||
"graphql-subscriptions": "^2.0.0",
|
"graphql-subscriptions": "^2.0.0",
|
||||||
"graphql-tag": "^2.12.6",
|
|
||||||
"graphql-upload": "^13.0.0",
|
"graphql-upload": "^13.0.0",
|
||||||
|
"graphql-ws": "^5.16.2",
|
||||||
"helmet": "~8.1.0",
|
"helmet": "~8.1.0",
|
||||||
"ioredis": "^5.9.3",
|
"ioredis": "^5.9.3",
|
||||||
"jsonwebtoken": "~8.5.1",
|
"jsonwebtoken": "~8.5.1",
|
||||||
@ -58,8 +59,6 @@
|
|||||||
"linkify-html": "^4.3.2",
|
"linkify-html": "^4.3.2",
|
||||||
"linkifyjs": "^4.3.2",
|
"linkifyjs": "^4.3.2",
|
||||||
"lodash": "~4.17.23",
|
"lodash": "~4.17.23",
|
||||||
"@graphql-tools/load-files": "^7.0.0",
|
|
||||||
"@graphql-tools/merge": "^9.0.0",
|
|
||||||
"metascraper": "^5.49.24",
|
"metascraper": "^5.49.24",
|
||||||
"metascraper-author": "^5.49.24",
|
"metascraper-author": "^5.49.24",
|
||||||
"metascraper-date": "^5.49.24",
|
"metascraper-date": "^5.49.24",
|
||||||
@ -88,11 +87,11 @@
|
|||||||
"pug": "^3.0.3",
|
"pug": "^3.0.3",
|
||||||
"sanitize-html": "~2.17.1",
|
"sanitize-html": "~2.17.1",
|
||||||
"slugify": "^1.6.6",
|
"slugify": "^1.6.6",
|
||||||
|
"subscriptions-transport-ws": "^0.11.0",
|
||||||
"trunc-html": "~1.1.2",
|
"trunc-html": "~1.1.2",
|
||||||
"tslog": "^4.10.2",
|
"tslog": "^4.10.2",
|
||||||
"uuid": "~9.0.1",
|
"uuid": "~9.0.1",
|
||||||
"validator": "^13.15.26",
|
"validator": "^13.15.26",
|
||||||
"subscriptions-transport-ws": "^0.11.0",
|
|
||||||
"ws": "^8.18.2",
|
"ws": "^8.18.2",
|
||||||
"xregexp": "^5.1.2"
|
"xregexp": "^5.1.2"
|
||||||
},
|
},
|
||||||
@ -112,12 +111,10 @@
|
|||||||
"jest": "^30.2.0",
|
"jest": "^30.2.0",
|
||||||
"nodemon": "~3.1.14",
|
"nodemon": "~3.1.14",
|
||||||
"prettier": "^3.8.1",
|
"prettier": "^3.8.1",
|
||||||
"require-json5": "^1.3.0",
|
|
||||||
"rosie": "^2.1.1",
|
"rosie": "^2.1.1",
|
||||||
"ts-jest": "^29.4.6",
|
"ts-jest": "^29.4.6",
|
||||||
"ts-node": "^10.9.2",
|
|
||||||
"tsc-alias": "^1.8.16",
|
"tsc-alias": "^1.8.16",
|
||||||
"tsconfig-paths": "^4.2.0",
|
"tsx": "^4.21.0",
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
/* eslint-disable import-x/no-commonjs */
|
/* eslint-disable import-x/no-commonjs */
|
||||||
// eslint-disable-next-line n/no-unpublished-require
|
// eslint-disable-next-line n/no-unpublished-require
|
||||||
const tsNode = require('ts-node')
|
const tsx = require('tsx/cjs/api')
|
||||||
// eslint-disable-next-line import-x/no-unassigned-import, n/no-unpublished-require
|
|
||||||
require('tsconfig-paths/register')
|
|
||||||
|
|
||||||
module.exports = tsNode.register
|
module.exports = tsx.register
|
||||||
|
|||||||
@ -11,13 +11,13 @@ import sample from 'lodash/sample'
|
|||||||
|
|
||||||
import CONFIG from '@config/index'
|
import CONFIG from '@config/index'
|
||||||
import { categories } from '@constants/categories'
|
import { categories } from '@constants/categories'
|
||||||
import { ChangeGroupMemberRole } from '@graphql/queries/ChangeGroupMemberRole'
|
import CreateComment from '@graphql/queries/comments/CreateComment.gql'
|
||||||
import { CreateComment } from '@graphql/queries/CreateComment'
|
import ChangeGroupMemberRole from '@graphql/queries/groups/ChangeGroupMemberRole.gql'
|
||||||
import { CreateGroup } from '@graphql/queries/CreateGroup'
|
import CreateGroup from '@graphql/queries/groups/CreateGroup.gql'
|
||||||
import { CreateMessage } from '@graphql/queries/CreateMessage'
|
import JoinGroup from '@graphql/queries/groups/JoinGroup.gql'
|
||||||
import { CreatePost } from '@graphql/queries/CreatePost'
|
import CreateMessage from '@graphql/queries/messaging/CreateMessage.gql'
|
||||||
import { CreateRoom } from '@graphql/queries/CreateRoom'
|
import CreateRoom from '@graphql/queries/messaging/CreateRoom.gql'
|
||||||
import { JoinGroup } from '@graphql/queries/JoinGroup'
|
import CreatePost from '@graphql/queries/posts/CreatePost.gql'
|
||||||
import { createApolloTestSetup } from '@root/test/helpers'
|
import { createApolloTestSetup } from '@root/test/helpers'
|
||||||
|
|
||||||
import Factory from './factories'
|
import Factory from './factories'
|
||||||
|
|||||||
6
backend/src/graphql.d.ts
vendored
Normal file
6
backend/src/graphql.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
declare module '*.gql' {
|
||||||
|
import type { DocumentNode } from 'graphql'
|
||||||
|
|
||||||
|
const value: DocumentNode
|
||||||
|
export default value
|
||||||
|
}
|
||||||
21
backend/src/graphql/gql-register.ts
Normal file
21
backend/src/graphql/gql-register.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* eslint-disable n/no-sync, security/detect-non-literal-fs-filename */
|
||||||
|
// Register a require hook for .gql files so they can be imported at runtime.
|
||||||
|
// Jest uses its own graphqlTransform.ts for this; this hook covers tsx/node usage
|
||||||
|
// (e.g. db:seed).
|
||||||
|
import { readFileSync } from 'node:fs'
|
||||||
|
import Module from 'node:module'
|
||||||
|
|
||||||
|
import { parse } from 'graphql'
|
||||||
|
|
||||||
|
// @ts-expect-error -- require.extensions is deprecated but still functional for CJS hooks
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||||
|
Module._extensions['.gql'] = function (_module: typeof module, filename: string) {
|
||||||
|
const content = readFileSync(filename, 'utf-8')
|
||||||
|
try {
|
||||||
|
_module.exports = parse(content)
|
||||||
|
} catch (error: unknown) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to parse ${filename}: ${error instanceof Error ? error.message : String(error)}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const AddEmailAddress = gql`
|
|
||||||
mutation ($email: String!) {
|
|
||||||
AddEmailAddress(email: $email) {
|
|
||||||
email
|
|
||||||
verifiedAt
|
|
||||||
createdAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const AddPostEmotions = gql`
|
|
||||||
mutation ($to: _PostInput!, $data: _EMOTEDInput!) {
|
|
||||||
AddPostEmotions(to: $to, data: $data) {
|
|
||||||
from {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
emotion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
8
backend/src/graphql/queries/Category.gql
Normal file
8
backend/src/graphql/queries/Category.gql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
query Category {
|
||||||
|
Category {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
name
|
||||||
|
icon
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const Category = gql`
|
|
||||||
query {
|
|
||||||
Category {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
name
|
|
||||||
icon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const ChangeGroupMemberRole = gql`
|
|
||||||
mutation ($groupId: ID!, $userId: ID!, $roleInGroup: GroupMemberRole!) {
|
|
||||||
ChangeGroupMemberRole(groupId: $groupId, userId: $userId, roleInGroup: $roleInGroup) {
|
|
||||||
user {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
membership {
|
|
||||||
role
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const CreateComment = gql`
|
|
||||||
mutation ($id: ID, $postId: ID!, $content: String!) {
|
|
||||||
CreateComment(id: $id, postId: $postId, content: $content) {
|
|
||||||
id
|
|
||||||
content
|
|
||||||
author {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
isPostObservedByMe
|
|
||||||
postObservingUsersCount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const CreateGroup = 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const CreateMessage = gql`
|
|
||||||
mutation ($roomId: ID!, $content: String!, $files: [FileInput]) {
|
|
||||||
CreateMessage(roomId: $roomId, content: $content, files: $files) {
|
|
||||||
id
|
|
||||||
content
|
|
||||||
senderId
|
|
||||||
username
|
|
||||||
avatar
|
|
||||||
date
|
|
||||||
saved
|
|
||||||
distributed
|
|
||||||
seen
|
|
||||||
files {
|
|
||||||
url
|
|
||||||
name
|
|
||||||
type
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const CreatePost = 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
|
|
||||||
language
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const CreateRoom = gql`
|
|
||||||
mutation ($userId: ID!) {
|
|
||||||
CreateRoom(userId: $userId) {
|
|
||||||
id
|
|
||||||
roomId
|
|
||||||
roomName
|
|
||||||
lastMessageAt
|
|
||||||
unreadCount
|
|
||||||
#avatar
|
|
||||||
users {
|
|
||||||
_id
|
|
||||||
id
|
|
||||||
name
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const CreateSocialMedia = gql`
|
|
||||||
mutation ($url: String!) {
|
|
||||||
CreateSocialMedia(url: $url) {
|
|
||||||
id
|
|
||||||
url
|
|
||||||
ownedBy {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const DeleteComment = gql`
|
|
||||||
mutation ($id: ID!) {
|
|
||||||
DeleteComment(id: $id) {
|
|
||||||
id
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
deleted
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const DeletePost = gql`
|
|
||||||
mutation ($id: ID!) {
|
|
||||||
DeletePost(id: $id) {
|
|
||||||
id
|
|
||||||
deleted
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
image {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
comments {
|
|
||||||
deleted
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const DeleteSocialMedia = gql`
|
|
||||||
mutation ($id: ID!) {
|
|
||||||
DeleteSocialMedia(id: $id) {
|
|
||||||
id
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const DeleteUser = gql`
|
|
||||||
mutation ($id: ID!, $resource: [Deletable]) {
|
|
||||||
DeleteUser(id: $id, resource: $resource) {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
about
|
|
||||||
deleted
|
|
||||||
contributions {
|
|
||||||
id
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
deleted
|
|
||||||
comments {
|
|
||||||
id
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
deleted
|
|
||||||
}
|
|
||||||
}
|
|
||||||
comments {
|
|
||||||
id
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
deleted
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const Donations = gql`
|
|
||||||
query {
|
|
||||||
Donations {
|
|
||||||
id
|
|
||||||
showDonations
|
|
||||||
goal
|
|
||||||
progress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const Group = gql`
|
|
||||||
query Group($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
|
|
||||||
inviteCodes {
|
|
||||||
code
|
|
||||||
redeemedByCount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const GroupMembers = gql`
|
|
||||||
query GroupMembers($id: ID!) {
|
|
||||||
GroupMembers(id: $id) {
|
|
||||||
user {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
membership {
|
|
||||||
role
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const JoinGroup = gql`
|
|
||||||
mutation ($groupId: ID!, $userId: ID!) {
|
|
||||||
JoinGroup(groupId: $groupId, userId: $userId) {
|
|
||||||
user {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
membership {
|
|
||||||
role
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const LeaveGroup = gql`
|
|
||||||
mutation ($groupId: ID!, $userId: ID!) {
|
|
||||||
LeaveGroup(groupId: $groupId, userId: $userId) {
|
|
||||||
user {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
membership {
|
|
||||||
role
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const MarkMessagesAsSeen = gql`
|
|
||||||
mutation ($messageIds: [String!]) {
|
|
||||||
MarkMessagesAsSeen(messageIds: $messageIds)
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const Message = 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
|
|
||||||
files {
|
|
||||||
url
|
|
||||||
name
|
|
||||||
type
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const Post = gql`
|
|
||||||
query ($id: ID, $filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) {
|
|
||||||
Post(id: $id, filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
|
|
||||||
id
|
|
||||||
title
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
eventStart
|
|
||||||
pinned
|
|
||||||
createdAt
|
|
||||||
pinnedAt
|
|
||||||
isObservedByMe
|
|
||||||
observingUsersCount
|
|
||||||
clickedCount
|
|
||||||
emotionsCount
|
|
||||||
emotions {
|
|
||||||
emotion
|
|
||||||
User {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
author {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
}
|
|
||||||
shoutedBy {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
tags {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
comments {
|
|
||||||
content
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const PostsEmotionsByCurrentUser = gql`
|
|
||||||
query ($postId: ID!) {
|
|
||||||
PostsEmotionsByCurrentUser(postId: $postId)
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const PostsEmotionsCountByEmotion = gql`
|
|
||||||
query ($postId: ID!, $data: _EMOTEDInput!) {
|
|
||||||
PostsEmotionsCountByEmotion(postId: $postId, data: $data)
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const RemovePostEmotions = gql`
|
|
||||||
mutation ($to: _PostInput!, $data: _EMOTEDInput!) {
|
|
||||||
RemovePostEmotions(to: $to, data: $data) {
|
|
||||||
from {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
emotion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const RemoveUserFromGroup = gql`
|
|
||||||
mutation ($groupId: ID!, $userId: ID!) {
|
|
||||||
RemoveUserFromGroup(groupId: $groupId, userId: $userId) {
|
|
||||||
user {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
membership {
|
|
||||||
role
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const Room = gql`
|
|
||||||
query Room($first: Int, $offset: Int, $id: ID) {
|
|
||||||
Room(first: $first, offset: $offset, id: $id, orderBy: lastMessageAt_desc) {
|
|
||||||
id
|
|
||||||
roomId
|
|
||||||
roomName
|
|
||||||
avatar
|
|
||||||
lastMessageAt
|
|
||||||
unreadCount
|
|
||||||
lastMessage {
|
|
||||||
_id
|
|
||||||
id
|
|
||||||
content
|
|
||||||
senderId
|
|
||||||
username
|
|
||||||
avatar
|
|
||||||
date
|
|
||||||
saved
|
|
||||||
distributed
|
|
||||||
seen
|
|
||||||
}
|
|
||||||
users {
|
|
||||||
_id
|
|
||||||
id
|
|
||||||
name
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const Signup = gql`
|
|
||||||
mutation ($email: String!, $locale: String!, $inviteCode: String) {
|
|
||||||
Signup(email: $email, locale: $locale, inviteCode: $inviteCode) {
|
|
||||||
email
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const SignupVerification = gql`
|
|
||||||
mutation (
|
|
||||||
$password: String!
|
|
||||||
$email: String!
|
|
||||||
$name: String!
|
|
||||||
$slug: String
|
|
||||||
$nonce: String!
|
|
||||||
$termsAndConditionsAgreedVersion: String!
|
|
||||||
$about: String
|
|
||||||
$locale: String
|
|
||||||
) {
|
|
||||||
SignupVerification(
|
|
||||||
email: $email
|
|
||||||
password: $password
|
|
||||||
name: $name
|
|
||||||
slug: $slug
|
|
||||||
nonce: $nonce
|
|
||||||
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
|
||||||
about: $about
|
|
||||||
locale: $locale
|
|
||||||
) {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
termsAndConditionsAgreedVersion
|
|
||||||
termsAndConditionsAgreedAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const UnreadRooms = gql`
|
|
||||||
query {
|
|
||||||
UnreadRooms
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const UpdateComment = gql`
|
|
||||||
mutation ($content: String!, $id: ID!) {
|
|
||||||
UpdateComment(content: $content, id: $id) {
|
|
||||||
id
|
|
||||||
content
|
|
||||||
createdAt
|
|
||||||
updatedAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const UpdateDonations = gql`
|
|
||||||
mutation ($showDonations: Boolean, $goal: Int, $progress: Int) {
|
|
||||||
UpdateDonations(showDonations: $showDonations, goal: $goal, progress: $progress) {
|
|
||||||
id
|
|
||||||
showDonations
|
|
||||||
goal
|
|
||||||
progress
|
|
||||||
createdAt
|
|
||||||
updatedAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const UpdateGroup = 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const UpdatePost = gql`
|
|
||||||
mutation (
|
|
||||||
$id: ID!
|
|
||||||
$title: String!
|
|
||||||
$content: String!
|
|
||||||
$image: ImageInput
|
|
||||||
$categoryIds: [ID]
|
|
||||||
$postType: PostType
|
|
||||||
$eventInput: _EventInput
|
|
||||||
) {
|
|
||||||
UpdatePost(
|
|
||||||
id: $id
|
|
||||||
title: $title
|
|
||||||
content: $content
|
|
||||||
image: $image
|
|
||||||
categoryIds: $categoryIds
|
|
||||||
postType: $postType
|
|
||||||
eventInput: $eventInput
|
|
||||||
) {
|
|
||||||
id
|
|
||||||
title
|
|
||||||
content
|
|
||||||
author {
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
createdAt
|
|
||||||
updatedAt
|
|
||||||
categories {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
postType
|
|
||||||
eventStart
|
|
||||||
eventLocationName
|
|
||||||
eventVenue
|
|
||||||
eventLocation {
|
|
||||||
lng
|
|
||||||
lat
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const UpdateSocialMedia = gql`
|
|
||||||
mutation ($id: ID!, $url: String!) {
|
|
||||||
UpdateSocialMedia(id: $id, url: $url) {
|
|
||||||
id
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const UpdateUser = gql`
|
|
||||||
mutation (
|
|
||||||
$id: ID!
|
|
||||||
$slug: String
|
|
||||||
$name: String
|
|
||||||
$about: String
|
|
||||||
$allowEmbedIframes: Boolean
|
|
||||||
$showShoutsPublicly: Boolean
|
|
||||||
$emailNotificationSettings: [EmailNotificationSettingsInput]
|
|
||||||
$termsAndConditionsAgreedVersion: String
|
|
||||||
$avatar: ImageInput
|
|
||||||
$locationName: String # empty string '' sets it to null
|
|
||||||
$locale: String
|
|
||||||
) {
|
|
||||||
UpdateUser(
|
|
||||||
id: $id
|
|
||||||
slug: $slug
|
|
||||||
name: $name
|
|
||||||
about: $about
|
|
||||||
allowEmbedIframes: $allowEmbedIframes
|
|
||||||
showShoutsPublicly: $showShoutsPublicly
|
|
||||||
emailNotificationSettings: $emailNotificationSettings
|
|
||||||
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
|
||||||
avatar: $avatar
|
|
||||||
locationName: $locationName
|
|
||||||
locale: $locale
|
|
||||||
) {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
name
|
|
||||||
about
|
|
||||||
allowEmbedIframes
|
|
||||||
showShoutsPublicly
|
|
||||||
termsAndConditionsAgreedVersion
|
|
||||||
termsAndConditionsAgreedAt
|
|
||||||
locationName
|
|
||||||
locale
|
|
||||||
location {
|
|
||||||
name
|
|
||||||
nameDE
|
|
||||||
nameEN
|
|
||||||
nameRU
|
|
||||||
}
|
|
||||||
emailNotificationSettings {
|
|
||||||
type
|
|
||||||
settings {
|
|
||||||
name
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
alt
|
|
||||||
sensitive
|
|
||||||
aspectRatio
|
|
||||||
type
|
|
||||||
}
|
|
||||||
badgeVerification {
|
|
||||||
id
|
|
||||||
description
|
|
||||||
icon
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,165 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const User = gql`
|
|
||||||
query ($id: ID, $name: String, $email: String) {
|
|
||||||
User(id: $id, name: $name, email: $email) {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
badgeTrophiesCount
|
|
||||||
badgeTrophies {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
badgeVerification {
|
|
||||||
id
|
|
||||||
isDefault
|
|
||||||
}
|
|
||||||
badgeTrophiesSelected {
|
|
||||||
id
|
|
||||||
isDefault
|
|
||||||
}
|
|
||||||
followedBy {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
followedByCurrentUser
|
|
||||||
following {
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
about
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
comments {
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
}
|
|
||||||
contributions {
|
|
||||||
title
|
|
||||||
slug
|
|
||||||
image {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
isMuted
|
|
||||||
isBlocked
|
|
||||||
location {
|
|
||||||
distanceToMe
|
|
||||||
}
|
|
||||||
activeCategories
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
export const UserEmailNotificationSettings = gql`
|
|
||||||
query ($id: ID, $name: String, $email: String) {
|
|
||||||
User(id: $id, name: $name, email: $email) {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
badgeTrophiesCount
|
|
||||||
badgeTrophies {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
badgeVerification {
|
|
||||||
id
|
|
||||||
isDefault
|
|
||||||
}
|
|
||||||
badgeTrophiesSelected {
|
|
||||||
id
|
|
||||||
isDefault
|
|
||||||
}
|
|
||||||
followedBy {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
followedByCurrentUser
|
|
||||||
following {
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
about
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
comments {
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
}
|
|
||||||
contributions {
|
|
||||||
title
|
|
||||||
slug
|
|
||||||
image {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
isMuted
|
|
||||||
isBlocked
|
|
||||||
location {
|
|
||||||
distanceToMe
|
|
||||||
}
|
|
||||||
emailNotificationSettings {
|
|
||||||
type
|
|
||||||
settings {
|
|
||||||
name
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
activeCategories
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
export const UserEmail = gql`
|
|
||||||
query ($id: ID, $name: String, $email: String) {
|
|
||||||
User(id: $id, name: $name, email: $email) {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
email
|
|
||||||
badgeTrophiesCount
|
|
||||||
badgeTrophies {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
badgeVerification {
|
|
||||||
id
|
|
||||||
isDefault
|
|
||||||
}
|
|
||||||
badgeTrophiesSelected {
|
|
||||||
id
|
|
||||||
isDefault
|
|
||||||
}
|
|
||||||
followedBy {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
followedByCurrentUser
|
|
||||||
following {
|
|
||||||
name
|
|
||||||
slug
|
|
||||||
about
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
comments {
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
}
|
|
||||||
contributions {
|
|
||||||
title
|
|
||||||
slug
|
|
||||||
image {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
content
|
|
||||||
contentExcerpt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
isMuted
|
|
||||||
isBlocked
|
|
||||||
location {
|
|
||||||
distanceToMe
|
|
||||||
}
|
|
||||||
activeCategories
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const VerifyEmailAddress = gql`
|
|
||||||
mutation ($email: String!, $nonce: String!) {
|
|
||||||
VerifyEmailAddress(email: $email, nonce: $nonce) {
|
|
||||||
email
|
|
||||||
createdAt
|
|
||||||
verifiedAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const VerifyNonce = gql`
|
|
||||||
query ($email: String!, $nonce: String!) {
|
|
||||||
VerifyNonce(email: $email, nonce: $nonce)
|
|
||||||
}
|
|
||||||
`
|
|
||||||
5
backend/src/graphql/queries/auth/Signup.gql
Normal file
5
backend/src/graphql/queries/auth/Signup.gql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
mutation Signup($email: String!, $locale: String!, $inviteCode: String) {
|
||||||
|
Signup(email: $email, locale: $locale, inviteCode: $inviteCode) {
|
||||||
|
email
|
||||||
|
}
|
||||||
|
}
|
||||||
26
backend/src/graphql/queries/auth/SignupVerification.gql
Normal file
26
backend/src/graphql/queries/auth/SignupVerification.gql
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
mutation SignupVerification(
|
||||||
|
$password: String!
|
||||||
|
$email: String!
|
||||||
|
$name: String!
|
||||||
|
$slug: String
|
||||||
|
$nonce: String!
|
||||||
|
$termsAndConditionsAgreedVersion: String!
|
||||||
|
$about: String
|
||||||
|
$locale: String
|
||||||
|
) {
|
||||||
|
SignupVerification(
|
||||||
|
email: $email
|
||||||
|
password: $password
|
||||||
|
name: $name
|
||||||
|
slug: $slug
|
||||||
|
nonce: $nonce
|
||||||
|
termsAndConditionsAgreedVersion: $termsAndConditionsAgreedVersion
|
||||||
|
about: $about
|
||||||
|
locale: $locale
|
||||||
|
) {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
termsAndConditionsAgreedVersion
|
||||||
|
termsAndConditionsAgreedAt
|
||||||
|
}
|
||||||
|
}
|
||||||
3
backend/src/graphql/queries/auth/VerifyNonce.gql
Normal file
3
backend/src/graphql/queries/auth/VerifyNonce.gql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
query VerifyNonce($email: String!, $nonce: String!) {
|
||||||
|
VerifyNonce(email: $email, nonce: $nonce)
|
||||||
|
}
|
||||||
3
backend/src/graphql/queries/auth/changePassword.gql
Normal file
3
backend/src/graphql/queries/auth/changePassword.gql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
mutation changePassword($oldPassword: String!, $newPassword: String!) {
|
||||||
|
changePassword(oldPassword: $oldPassword, newPassword: $newPassword)
|
||||||
|
}
|
||||||
21
backend/src/graphql/queries/auth/currentUser.gql
Normal file
21
backend/src/graphql/queries/auth/currentUser.gql
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
query currentUser {
|
||||||
|
currentUser {
|
||||||
|
id
|
||||||
|
slug
|
||||||
|
name
|
||||||
|
avatar {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
email
|
||||||
|
role
|
||||||
|
activeCategories
|
||||||
|
following {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
inviteCodes {
|
||||||
|
code
|
||||||
|
redeemedByCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
backend/src/graphql/queries/auth/login.gql
Normal file
3
backend/src/graphql/queries/auth/login.gql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
mutation login($email: String!, $password: String!) {
|
||||||
|
login(email: $email, password: $password)
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
mutation requestPasswordReset($email: String!, $locale: String!) {
|
||||||
|
requestPasswordReset(email: $email, locale: $locale)
|
||||||
|
}
|
||||||
3
backend/src/graphql/queries/auth/resetPassword.gql
Normal file
3
backend/src/graphql/queries/auth/resetPassword.gql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
mutation resetPassword($nonce: String!, $email: String!, $newPassword: String!) {
|
||||||
|
resetPassword(nonce: $nonce, email: $email, newPassword: $newPassword)
|
||||||
|
}
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const availableRoles = gql`
|
|
||||||
query {
|
|
||||||
availableRoles
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
mutation resetTrophyBadgesSelected {
|
||||||
|
resetTrophyBadgesSelected {
|
||||||
|
id
|
||||||
|
badgeTrophiesCount
|
||||||
|
badgeTrophiesSelected {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
badgeTrophiesUnused {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
badgeTrophiesUnusedCount
|
||||||
|
}
|
||||||
|
}
|
||||||
16
backend/src/graphql/queries/badges/revokeBadge.gql
Normal file
16
backend/src/graphql/queries/badges/revokeBadge.gql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
mutation revokeBadge($badgeId: ID!, $userId: ID!) {
|
||||||
|
revokeBadge(badgeId: $badgeId, userId: $userId) {
|
||||||
|
id
|
||||||
|
badgeTrophies {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
badgeVerification {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
badgeTrophiesSelected {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
backend/src/graphql/queries/badges/rewardTrophyBadge.gql
Normal file
16
backend/src/graphql/queries/badges/rewardTrophyBadge.gql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
mutation rewardTrophyBadge($badgeId: ID!, $userId: ID!) {
|
||||||
|
rewardTrophyBadge(badgeId: $badgeId, userId: $userId) {
|
||||||
|
id
|
||||||
|
badgeVerification {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
badgeTrophiesCount
|
||||||
|
badgeTrophies {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
badgeTrophiesSelected {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
mutation setTrophyBadgeSelected($slot: Int!, $badgeId: ID) {
|
||||||
|
setTrophyBadgeSelected(slot: $slot, badgeId: $badgeId) {
|
||||||
|
id
|
||||||
|
badgeTrophiesCount
|
||||||
|
badgeTrophiesSelected {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
badgeTrophiesUnused {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
badgeTrophiesUnusedCount
|
||||||
|
}
|
||||||
|
}
|
||||||
12
backend/src/graphql/queries/badges/setVerificationBadge.gql
Normal file
12
backend/src/graphql/queries/badges/setVerificationBadge.gql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
mutation setVerificationBadge($badgeId: ID!, $userId: ID!) {
|
||||||
|
setVerificationBadge(badgeId: $badgeId, userId: $userId) {
|
||||||
|
id
|
||||||
|
badgeVerification {
|
||||||
|
id
|
||||||
|
isDefault
|
||||||
|
}
|
||||||
|
badgeTrophies {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const blockUser = gql`
|
|
||||||
mutation ($id: ID!) {
|
|
||||||
blockUser(id: $id) {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
isBlocked
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const blockedUsers = gql`
|
|
||||||
query {
|
|
||||||
blockedUsers {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
isBlocked
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const changePassword = gql`
|
|
||||||
mutation ($oldPassword: String!, $newPassword: String!) {
|
|
||||||
changePassword(oldPassword: $oldPassword, newPassword: $newPassword)
|
|
||||||
}
|
|
||||||
`
|
|
||||||
12
backend/src/graphql/queries/comments/CreateComment.gql
Normal file
12
backend/src/graphql/queries/comments/CreateComment.gql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
mutation CreateComment($id: ID, $postId: ID!, $content: String!) {
|
||||||
|
CreateComment(id: $id, postId: $postId, content: $content) {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
author {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
isPostObservedByMe
|
||||||
|
postObservingUsersCount
|
||||||
|
}
|
||||||
|
}
|
||||||
8
backend/src/graphql/queries/comments/DeleteComment.gql
Normal file
8
backend/src/graphql/queries/comments/DeleteComment.gql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
mutation DeleteComment($id: ID!) {
|
||||||
|
DeleteComment(id: $id) {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
contentExcerpt
|
||||||
|
deleted
|
||||||
|
}
|
||||||
|
}
|
||||||
8
backend/src/graphql/queries/comments/UpdateComment.gql
Normal file
8
backend/src/graphql/queries/comments/UpdateComment.gql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
mutation UpdateComment($content: String!, $id: ID!) {
|
||||||
|
UpdateComment(content: $content, id: $id) {
|
||||||
|
id
|
||||||
|
content
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,24 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const currentUser = gql`
|
|
||||||
query currentUser {
|
|
||||||
currentUser {
|
|
||||||
id
|
|
||||||
slug
|
|
||||||
name
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
email
|
|
||||||
role
|
|
||||||
activeCategories
|
|
||||||
following {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
inviteCodes {
|
|
||||||
code
|
|
||||||
redeemedByCount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
8
backend/src/graphql/queries/donations/Donations.gql
Normal file
8
backend/src/graphql/queries/donations/Donations.gql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
query Donations {
|
||||||
|
Donations {
|
||||||
|
id
|
||||||
|
showDonations
|
||||||
|
goal
|
||||||
|
progress
|
||||||
|
}
|
||||||
|
}
|
||||||
10
backend/src/graphql/queries/donations/UpdateDonations.gql
Normal file
10
backend/src/graphql/queries/donations/UpdateDonations.gql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
mutation UpdateDonations($showDonations: Boolean, $goal: Int, $progress: Int) {
|
||||||
|
UpdateDonations(showDonations: $showDonations, goal: $goal, progress: $progress) {
|
||||||
|
id
|
||||||
|
showDonations
|
||||||
|
goal
|
||||||
|
progress
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
}
|
||||||
|
}
|
||||||
17
backend/src/graphql/queries/embed.gql
Normal file
17
backend/src/graphql/queries/embed.gql
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
query embed($url: String!) {
|
||||||
|
embed(url: $url) {
|
||||||
|
type
|
||||||
|
title
|
||||||
|
author
|
||||||
|
publisher
|
||||||
|
date
|
||||||
|
description
|
||||||
|
url
|
||||||
|
image
|
||||||
|
audio
|
||||||
|
video
|
||||||
|
lang
|
||||||
|
sources
|
||||||
|
html
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,21 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const embed = gql`
|
|
||||||
query ($url: String!) {
|
|
||||||
embed(url: $url) {
|
|
||||||
type
|
|
||||||
title
|
|
||||||
author
|
|
||||||
publisher
|
|
||||||
date
|
|
||||||
description
|
|
||||||
url
|
|
||||||
image
|
|
||||||
audio
|
|
||||||
video
|
|
||||||
lang
|
|
||||||
sources
|
|
||||||
html
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
11
backend/src/graphql/queries/emotions/AddPostEmotions.gql
Normal file
11
backend/src/graphql/queries/emotions/AddPostEmotions.gql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
mutation AddPostEmotions($to: _PostInput!, $data: _EMOTEDInput!) {
|
||||||
|
AddPostEmotions(to: $to, data: $data) {
|
||||||
|
from {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
emotion
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
query PostsEmotionsByCurrentUser($postId: ID!) {
|
||||||
|
PostsEmotionsByCurrentUser(postId: $postId)
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
query PostsEmotionsCountByEmotion($postId: ID!, $data: _EMOTEDInput!) {
|
||||||
|
PostsEmotionsCountByEmotion(postId: $postId, data: $data)
|
||||||
|
}
|
||||||
11
backend/src/graphql/queries/emotions/RemovePostEmotions.gql
Normal file
11
backend/src/graphql/queries/emotions/RemovePostEmotions.gql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
mutation RemovePostEmotions($to: _PostInput!, $data: _EMOTEDInput!) {
|
||||||
|
RemovePostEmotions(to: $to, data: $data) {
|
||||||
|
from {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
emotion
|
||||||
|
}
|
||||||
|
}
|
||||||
3
backend/src/graphql/queries/emotions/shout.gql
Normal file
3
backend/src/graphql/queries/emotions/shout.gql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
mutation shout($id: ID!) {
|
||||||
|
shout(id: $id, type: Post)
|
||||||
|
}
|
||||||
3
backend/src/graphql/queries/emotions/unshout.gql
Normal file
3
backend/src/graphql/queries/emotions/unshout.gql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
mutation unshout($id: ID!) {
|
||||||
|
unshout(id: $id, type: Post)
|
||||||
|
}
|
||||||
@ -1,28 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const fileReport = gql`
|
|
||||||
mutation ($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) {
|
|
||||||
fileReport(
|
|
||||||
resourceId: $resourceId
|
|
||||||
reasonCategory: $reasonCategory
|
|
||||||
reasonDescription: $reasonDescription
|
|
||||||
) {
|
|
||||||
createdAt
|
|
||||||
reasonCategory
|
|
||||||
reasonDescription
|
|
||||||
reportId
|
|
||||||
resource {
|
|
||||||
__typename
|
|
||||||
... on User {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
... on Post {
|
|
||||||
title
|
|
||||||
}
|
|
||||||
... on Comment {
|
|
||||||
content
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const followUser = gql`
|
|
||||||
mutation ($id: ID!) {
|
|
||||||
followUser(id: $id) {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
followedBy {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
}
|
|
||||||
followedByCurrentUser
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const generateGroupInviteCode = gql`
|
|
||||||
mutation generateGroupInviteCode($groupId: ID!, $expiresAt: String, $comment: String) {
|
|
||||||
generateGroupInviteCode(groupId: $groupId, expiresAt: $expiresAt, comment: $comment) {
|
|
||||||
code
|
|
||||||
createdAt
|
|
||||||
generatedBy {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
redeemedBy {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
expiresAt
|
|
||||||
comment
|
|
||||||
invitedTo {
|
|
||||||
id
|
|
||||||
groupType
|
|
||||||
name
|
|
||||||
about
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
isValid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
import { gql } from 'graphql-tag'
|
|
||||||
|
|
||||||
export const generatePersonalInviteCode = gql`
|
|
||||||
mutation generatePersonalInviteCode($expiresAt: String, $comment: String) {
|
|
||||||
generatePersonalInviteCode(expiresAt: $expiresAt, comment: $comment) {
|
|
||||||
code
|
|
||||||
createdAt
|
|
||||||
generatedBy {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
redeemedBy {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
expiresAt
|
|
||||||
comment
|
|
||||||
invitedTo {
|
|
||||||
id
|
|
||||||
groupType
|
|
||||||
name
|
|
||||||
about
|
|
||||||
avatar {
|
|
||||||
url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
isValid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
12
backend/src/graphql/queries/groups/ChangeGroupMemberRole.gql
Normal file
12
backend/src/graphql/queries/groups/ChangeGroupMemberRole.gql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
mutation ChangeGroupMemberRole($groupId: ID!, $userId: ID!, $roleInGroup: GroupMemberRole!) {
|
||||||
|
ChangeGroupMemberRole(groupId: $groupId, userId: $userId, roleInGroup: $roleInGroup) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
backend/src/graphql/queries/groups/CreateGroup.gql
Normal file
50
backend/src/graphql/queries/groups/CreateGroup.gql
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
mutation CreateGroup(
|
||||||
|
$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 {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
nameDE
|
||||||
|
nameEN
|
||||||
|
}
|
||||||
|
myRole
|
||||||
|
}
|
||||||
|
}
|
||||||
37
backend/src/graphql/queries/groups/Group.gql
Normal file
37
backend/src/graphql/queries/groups/Group.gql
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
query Group($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 {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
nameDE
|
||||||
|
nameEN
|
||||||
|
}
|
||||||
|
myRole
|
||||||
|
inviteCodes {
|
||||||
|
code
|
||||||
|
redeemedByCount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
backend/src/graphql/queries/groups/GroupMembers.gql
Normal file
12
backend/src/graphql/queries/groups/GroupMembers.gql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
query GroupMembers($id: ID!) {
|
||||||
|
GroupMembers(id: $id) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
backend/src/graphql/queries/groups/JoinGroup.gql
Normal file
12
backend/src/graphql/queries/groups/JoinGroup.gql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
mutation JoinGroup($groupId: ID!, $userId: ID!) {
|
||||||
|
JoinGroup(groupId: $groupId, userId: $userId) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
backend/src/graphql/queries/groups/LeaveGroup.gql
Normal file
12
backend/src/graphql/queries/groups/LeaveGroup.gql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
mutation LeaveGroup($groupId: ID!, $userId: ID!) {
|
||||||
|
LeaveGroup(groupId: $groupId, userId: $userId) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
backend/src/graphql/queries/groups/RemoveUserFromGroup.gql
Normal file
12
backend/src/graphql/queries/groups/RemoveUserFromGroup.gql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
mutation RemoveUserFromGroup($groupId: ID!, $userId: ID!) {
|
||||||
|
RemoveUserFromGroup(groupId: $groupId, userId: $userId) {
|
||||||
|
user {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
membership {
|
||||||
|
role
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
51
backend/src/graphql/queries/groups/UpdateGroup.gql
Normal file
51
backend/src/graphql/queries/groups/UpdateGroup.gql
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
mutation UpdateGroup(
|
||||||
|
$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 {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
nameDE
|
||||||
|
nameEN
|
||||||
|
}
|
||||||
|
myRole
|
||||||
|
}
|
||||||
|
}
|
||||||
6
backend/src/graphql/queries/groups/muteGroup.gql
Normal file
6
backend/src/graphql/queries/groups/muteGroup.gql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
mutation muteGroup($groupId: ID!) {
|
||||||
|
muteGroup(groupId: $groupId) {
|
||||||
|
id
|
||||||
|
isMutedByMe
|
||||||
|
}
|
||||||
|
}
|
||||||
22
backend/src/graphql/queries/groups/pinGroupPost.gql
Normal file
22
backend/src/graphql/queries/groups/pinGroupPost.gql
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
mutation pinGroupPost($id: ID!) {
|
||||||
|
pinGroupPost(id: $id) {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
content
|
||||||
|
author {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
pinnedBy {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
role
|
||||||
|
}
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
pinnedAt
|
||||||
|
pinned
|
||||||
|
groupPinned
|
||||||
|
}
|
||||||
|
}
|
||||||
6
backend/src/graphql/queries/groups/unmuteGroup.gql
Normal file
6
backend/src/graphql/queries/groups/unmuteGroup.gql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
mutation unmuteGroup($groupId: ID!) {
|
||||||
|
unmuteGroup(groupId: $groupId) {
|
||||||
|
id
|
||||||
|
isMutedByMe
|
||||||
|
}
|
||||||
|
}
|
||||||
22
backend/src/graphql/queries/groups/unpinGroupPost.gql
Normal file
22
backend/src/graphql/queries/groups/unpinGroupPost.gql
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
mutation unpinGroupPost($id: ID!) {
|
||||||
|
unpinGroupPost(id: $id) {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
content
|
||||||
|
author {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
pinnedBy {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
role
|
||||||
|
}
|
||||||
|
createdAt
|
||||||
|
updatedAt
|
||||||
|
pinned
|
||||||
|
pinnedAt
|
||||||
|
groupPinned
|
||||||
|
}
|
||||||
|
}
|
||||||
7
backend/src/graphql/queries/interactions/blockUser.gql
Normal file
7
backend/src/graphql/queries/interactions/blockUser.gql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
mutation blockUser($id: ID!) {
|
||||||
|
blockUser(id: $id) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
isBlocked
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
query blockedUsers {
|
||||||
|
blockedUsers {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
isBlocked
|
||||||
|
}
|
||||||
|
}
|
||||||
11
backend/src/graphql/queries/interactions/followUser.gql
Normal file
11
backend/src/graphql/queries/interactions/followUser.gql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
mutation followUser($id: ID!) {
|
||||||
|
followUser(id: $id) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
followedBy {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
followedByCurrentUser
|
||||||
|
}
|
||||||
|
}
|
||||||
7
backend/src/graphql/queries/interactions/muteUser.gql
Normal file
7
backend/src/graphql/queries/interactions/muteUser.gql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
mutation muteUser($id: ID!) {
|
||||||
|
muteUser(id: $id) {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
isMuted
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user