mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-03-01 12:44:37 +00:00
refactor(backend): use eslint config it4c (#9290)
This commit is contained in:
parent
703cbbc1dc
commit
fc4e15c217
@ -1,3 +0,0 @@
|
||||
node_modules/
|
||||
build/
|
||||
coverage/
|
||||
@ -1,263 +0,0 @@
|
||||
// eslint-disable-next-line import/no-commonjs
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['prettier', '@typescript-eslint', 'import', 'n', 'promise', 'security', 'no-catch-all'],
|
||||
extends: [
|
||||
'standard',
|
||||
'eslint:recommended',
|
||||
'plugin:n/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
'plugin:import/recommended',
|
||||
'plugin:import/typescript',
|
||||
'plugin:promise/recommended',
|
||||
'plugin:@eslint-community/eslint-comments/recommended',
|
||||
'prettier',
|
||||
],
|
||||
settings: {
|
||||
'import/parsers': {
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||
},
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
project: ['./tsconfig.json', './backend/tsconfig.json'],
|
||||
},
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-catch-all/no-catch-all': 'error',
|
||||
'no-console': 'error',
|
||||
camelcase: 'error',
|
||||
'no-debugger': 'error',
|
||||
'prettier/prettier': [
|
||||
'error',
|
||||
{
|
||||
htmlWhitespaceSensitivity: 'ignore',
|
||||
},
|
||||
],
|
||||
// import
|
||||
'import/export': 'error',
|
||||
// 'import/no-deprecated': 'error',
|
||||
'import/no-empty-named-blocks': 'error',
|
||||
'import/no-extraneous-dependencies': 'error',
|
||||
'import/no-mutable-exports': 'error',
|
||||
'import/no-unused-modules': 'error',
|
||||
'import/no-named-as-default': 'error',
|
||||
'import/no-named-as-default-member': 'error',
|
||||
'import/no-amd': 'error',
|
||||
'import/no-commonjs': 'error',
|
||||
'import/no-import-module-exports': 'error',
|
||||
'import/no-nodejs-modules': 'off',
|
||||
'import/unambiguous': 'off', // not compatible with .eslintrc.cjs
|
||||
'import/default': 'error',
|
||||
'import/named': 'off', // has false positives
|
||||
'import/namespace': 'error',
|
||||
'import/no-absolute-path': 'error',
|
||||
'import/no-cycle': 'error',
|
||||
'import/no-dynamic-require': 'error',
|
||||
'import/no-internal-modules': 'off',
|
||||
'import/no-relative-packages': 'error',
|
||||
'import/no-relative-parent-imports': ['error', { ignore: ['@/*'] }],
|
||||
'import/no-self-import': 'error',
|
||||
'import/no-unresolved': 'error',
|
||||
'import/no-useless-path-segments': 'error',
|
||||
'import/no-webpack-loader-syntax': 'error',
|
||||
'import/consistent-type-specifier-style': 'error',
|
||||
'import/exports-last': 'off',
|
||||
'import/extensions': 'error',
|
||||
'import/first': 'error',
|
||||
'import/group-exports': 'off',
|
||||
'import/newline-after-import': 'error',
|
||||
'import/no-anonymous-default-export': 'off', // not compatible with neode
|
||||
'import/no-default-export': 'off', // not compatible with neode
|
||||
'import/no-duplicates': 'error',
|
||||
'import/no-named-default': 'error',
|
||||
'import/no-namespace': 'error',
|
||||
'import/no-unassigned-import': 'error',
|
||||
'import/order': [
|
||||
'error',
|
||||
{
|
||||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
||||
'newlines-between': 'always',
|
||||
pathGroups: [
|
||||
{
|
||||
pattern: '@?*/**',
|
||||
group: 'external',
|
||||
position: 'after',
|
||||
},
|
||||
{
|
||||
pattern: '@/**',
|
||||
group: 'external',
|
||||
position: 'after',
|
||||
},
|
||||
],
|
||||
alphabetize: {
|
||||
order: 'asc' /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */,
|
||||
caseInsensitive: true /* ignore case. Options: [true, false] */,
|
||||
},
|
||||
distinctGroup: true,
|
||||
},
|
||||
],
|
||||
'import/prefer-default-export': 'off',
|
||||
|
||||
// n
|
||||
// 'n/callback-return': 'error',
|
||||
'n/exports-style': 'error',
|
||||
'n/file-extension-in-import': ['error', 'never'],
|
||||
'n/global-require': 'error',
|
||||
'n/handle-callback-err': 'error',
|
||||
// 'n/hashbang': 'error', // part of n/recommended
|
||||
'n/no-callback-literal': 'error',
|
||||
// 'n/no-deprecated-api': 'error', // part of n/recommended
|
||||
// 'n/no-exports-assign': 'error', // part of n/recommended
|
||||
'n/no-extraneous-import': 'off', // duplicate of import/no-extraneous-dependencies // part of n/recommended
|
||||
// 'n/no-extraneous-require': 'error', // part of n/recommended
|
||||
'n/no-hide-core-modules': 'error',
|
||||
'n/no-missing-import': 'off', // not compatible with typescript // part of n/recommended
|
||||
// 'n/no-missing-require': 'error', // part of n/recommended
|
||||
'n/no-mixed-requires': 'error',
|
||||
'n/no-new-require': 'error',
|
||||
'n/no-path-concat': 'error',
|
||||
'n/no-process-env': 'error',
|
||||
// 'n/no-process-exit': 'error', // part of n/recommended
|
||||
'n/no-restricted-import': 'error',
|
||||
'n/no-restricted-require': 'error',
|
||||
'n/no-sync': 'error',
|
||||
// 'n/no-unpublished-bin': 'error', // part of n/recommended
|
||||
'n/no-unpublished-import': [
|
||||
'error',
|
||||
{ allowModules: ['apollo-server-testing', 'rosie', '@faker-js/faker', 'ts-jest'] },
|
||||
], // part of n/recommended
|
||||
'n/no-unpublished-require': ['error', { allowModules: ['ts-jest', 'require-json5'] }], // part of n/recommended
|
||||
// 'n/no-unsupported-features/es-builtins': 'error', // part of n/recommended
|
||||
// 'n/no-unsupported-features/es-syntax': 'error', // part of n/recommended
|
||||
// 'n/no-unsupported-features/node-builtins': 'error', // part of n/recommended
|
||||
'n/prefer-global/buffer': 'error',
|
||||
'n/prefer-global/console': 'error',
|
||||
'n/prefer-global/process': 'error',
|
||||
'n/prefer-global/text-decoder': 'error',
|
||||
'n/prefer-global/text-encoder': 'error',
|
||||
'n/prefer-global/url': 'error',
|
||||
'n/prefer-global/url-search-params': 'error',
|
||||
'n/prefer-node-protocol': 'error',
|
||||
'n/prefer-promises/dns': 'error',
|
||||
'n/prefer-promises/fs': 'error',
|
||||
// 'n/process-exit-as-throw': 'error', // part of n/recommended
|
||||
'n/shebang': 'error',
|
||||
|
||||
// promise
|
||||
// 'promise/always-return': 'error', // part of promise/recommended
|
||||
'promise/avoid-new': 'error',
|
||||
// 'promise/catch-or-return': 'error', // part of promise/recommended
|
||||
// 'promise/no-callback-in-promise': 'warn', // part of promise/recommended
|
||||
'promise/no-multiple-resolved': 'error',
|
||||
'promise/no-native': 'off', // ES5 only
|
||||
// 'promise/no-nesting': 'warn', // part of promise/recommended
|
||||
// 'promise/no-new-statics': 'error', // part of promise/recommended
|
||||
// 'promise/no-promise-in-callback': 'warn', // part of promise/recommended
|
||||
// 'promise/no-return-in-finally': 'warn', // part of promise/recommended
|
||||
// 'promise/no-return-wrap': 'error', // part of promise/recommended
|
||||
// 'promise/param-names': 'error', // part of promise/recommended
|
||||
'promise/prefer-await-to-callbacks': 'error',
|
||||
'promise/prefer-catch': 'error',
|
||||
'promise/spec-only': 'error',
|
||||
// 'promise/valid-params': 'error', // part of promise/recommended
|
||||
|
||||
// eslint comments
|
||||
'@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
|
||||
'@eslint-community/eslint-comments/no-restricted-disable': 'error',
|
||||
'@eslint-community/eslint-comments/no-use': 'off',
|
||||
'@eslint-community/eslint-comments/require-description': 'off',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.js', '*.cjs', '*.ts', '*.tsx'],
|
||||
extends: ['plugin:security/recommended-legacy'],
|
||||
},
|
||||
// only for ts files
|
||||
{
|
||||
files: ['*.ts', '*.tsx'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
'plugin:@typescript-eslint/strict',
|
||||
'prettier',
|
||||
],
|
||||
rules: {
|
||||
// allow explicitly defined dangling promises
|
||||
// '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
|
||||
'no-void': ['error', { allowAsStatement: true }],
|
||||
// ignore prefer-regexp-exec rule to allow string.match(regex)
|
||||
'@typescript-eslint/prefer-regexp-exec': 'off',
|
||||
// this should not run on ts files: https://github.com/import-js/eslint-plugin-import/issues/2215#issuecomment-911245486
|
||||
'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,
|
||||
project: ['./tsconfig.json'],
|
||||
// this is to properly reference the referenced project database without requirement of compiling it
|
||||
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.spec.ts'],
|
||||
plugins: ['jest'],
|
||||
env: {
|
||||
jest: true,
|
||||
},
|
||||
rules: {
|
||||
'jest/no-disabled-tests': 'error',
|
||||
'jest/no-focused-tests': 'error',
|
||||
'jest/no-identical-title': 'error',
|
||||
'jest/prefer-to-have-length': 'error',
|
||||
'jest/valid-expect': 'error',
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
'jest/unbound-method': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
extends: ['plugin:jsonc/recommended-with-jsonc'],
|
||||
files: ['*.json', '*.json5', '*.jsonc'],
|
||||
parser: 'jsonc-eslint-parser',
|
||||
},
|
||||
{
|
||||
files: ['*.graphql', '*.gql'],
|
||||
parser: '@graphql-eslint/eslint-plugin',
|
||||
plugins: ['@graphql-eslint'],
|
||||
extends: ['plugin:@graphql-eslint/schema-recommended'],
|
||||
rules: {
|
||||
'@graphql-eslint/description-style': ['error', { style: 'inline' }],
|
||||
'@graphql-eslint/require-description': 'off',
|
||||
'@graphql-eslint/naming-convention': 'off',
|
||||
'@graphql-eslint/strict-id-in-types': 'off',
|
||||
'@graphql-eslint/no-typename-prefix': 'off',
|
||||
// incompatible: `depends on a GraphQL validation rule "XXX" but it's not available in the "graphql" version you are using. Skipping…`
|
||||
'@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',
|
||||
},
|
||||
parserOptions: {
|
||||
schema: './src/graphql/types/**/*.gql',
|
||||
assumeValid: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
|
||||
module.exports = {
|
||||
semi: false,
|
||||
printWidth: 100,
|
||||
singleQuote: true,
|
||||
trailingComma: "all",
|
||||
tabWidth: 2,
|
||||
bracketSpacing: true
|
||||
};
|
||||
100
backend/eslint.config.ts
Normal file
100
backend/eslint.config.ts
Normal file
@ -0,0 +1,100 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import comments from 'eslint-config-it4c/modules/comments'
|
||||
import eslint from 'eslint-config-it4c/modules/eslint'
|
||||
import importX from 'eslint-config-it4c/modules/import-x'
|
||||
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 [
|
||||
{
|
||||
ignores: ['node_modules/', 'build/', 'coverage/'],
|
||||
},
|
||||
...eslint,
|
||||
...typescript,
|
||||
...importX,
|
||||
...node,
|
||||
...promise,
|
||||
...security,
|
||||
...comments,
|
||||
...json,
|
||||
...yaml,
|
||||
...prettier,
|
||||
...jest,
|
||||
{
|
||||
// Backend-specific TypeScript overrides
|
||||
files: ['**/*.ts'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: {
|
||||
allowDefaultProject: ['eslint.config.ts'],
|
||||
},
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
// TypeORM compatibility: joined tables can be null but are not defined as nullable
|
||||
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||
// Allow string.match(regex) instead of regex.exec(string)
|
||||
'@typescript-eslint/prefer-regexp-exec': 'off',
|
||||
// TODO: gradually add return types to exported functions, then remove this override
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
// Allow @/* path aliases in relative parent imports
|
||||
'import-x/no-relative-parent-imports': ['error', { ignore: ['@/*'] }],
|
||||
},
|
||||
},
|
||||
{
|
||||
// Jest test file overrides
|
||||
files: ['**/*.spec.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
// Config files: allow require() of devDependencies
|
||||
files: ['*.config.{js,mjs,cjs,ts,mts,cts}'],
|
||||
rules: {
|
||||
'n/no-unpublished-require': 'off',
|
||||
},
|
||||
},
|
||||
]
|
||||
@ -1,4 +1,4 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
/* eslint-disable import-x/no-commonjs */
|
||||
const requireJSON5 = require('require-json5')
|
||||
const { pathsToModuleNameMapper } = require('ts-jest')
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
"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:debug": "nodemon --exec node --inspect=0.0.0.0:9229 build/src/index.js -e js,ts,gql",
|
||||
"lint": "eslint --max-warnings=0 --report-unused-disable-directives --ext .js,.ts,.cjs,.json,.json5,.jsonc,.graphql,.gql .",
|
||||
"lint": "eslint --max-warnings 0 .",
|
||||
"test": "cross-env NODE_ENV=test NODE_OPTIONS=--max-old-space-size=8192 jest --runInBand --coverage --forceExit --detectOpenHandles",
|
||||
"db:reset": "ts-node --require tsconfig-paths/register src/db/reset.ts",
|
||||
"db:reset:withmigrations": "ts-node --require tsconfig-paths/register src/db/reset-with-migrations.ts",
|
||||
@ -95,9 +95,7 @@
|
||||
"xregexp": "^5.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
|
||||
"@faker-js/faker": "9.9.0",
|
||||
"@graphql-eslint/eslint-plugin": "^3.20.1",
|
||||
"@types/email-templates": "^10.0.4",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/jsonwebtoken": "~8.5.1",
|
||||
@ -106,21 +104,9 @@
|
||||
"@types/request": "^2.48.13",
|
||||
"@types/slug": "^5.0.9",
|
||||
"@types/uuid": "~9.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"apollo-server-testing": "~2.11.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jest": "^29.15.0",
|
||||
"eslint-plugin-jsonc": "^2.21.1",
|
||||
"eslint-plugin-n": "^17.23.2",
|
||||
"eslint-plugin-no-catch-all": "^1.1.0",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"eslint-plugin-promise": "^7.2.1",
|
||||
"eslint-plugin-security": "^3.0.1",
|
||||
"eslint": "^9.27.0",
|
||||
"eslint-config-it4c": "^0.12.0",
|
||||
"jest": "^30.2.0",
|
||||
"nodemon": "~3.1.11",
|
||||
"prettier": "^3.8.1",
|
||||
|
||||
1
backend/prettier.config.mjs
Normal file
1
backend/prettier.config.mjs
Normal file
@ -0,0 +1 @@
|
||||
export { default } from 'eslint-config-it4c/prettier'
|
||||
@ -1,14 +1,17 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable import-x/no-namespace */
|
||||
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
|
||||
/* eslint-disable n/no-process-env */
|
||||
import { config } from 'dotenv'
|
||||
// eslint-disable-next-line import/no-namespace
|
||||
import * as SMTPTransport from 'nodemailer/lib/smtp-pool'
|
||||
|
||||
import emails from './emails'
|
||||
import metadata from './metadata'
|
||||
|
||||
import type * as SMTPTransport from 'nodemailer/lib/smtp-pool'
|
||||
|
||||
// Load env file
|
||||
config()
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import { getDriver, getNeode } from '@db/neo4j'
|
||||
|
||||
import type { Driver } from 'neo4j-driver'
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
import databaseContext from '@context/database'
|
||||
import pubsubContext from '@context/pubsub'
|
||||
import CONFIG from '@src/config'
|
||||
import type { DecodedUser } from '@src/jwt/decode'
|
||||
import { decode } from '@src/jwt/decode'
|
||||
import ocelotLogger from '@src/logger'
|
||||
import type OcelotLogger from '@src/logger'
|
||||
|
||||
import type { DecodedUser } from '@src/jwt/decode'
|
||||
import type OcelotLogger from '@src/logger'
|
||||
import type { ApolloServerExpressConfig } from 'apollo-server-express'
|
||||
|
||||
const serverDatabase = databaseContext()
|
||||
@ -25,7 +25,7 @@ export const getContext =
|
||||
const {
|
||||
database = serverDatabase,
|
||||
pubsub = serverPubsub,
|
||||
authenticatedUser = undefined,
|
||||
authenticatedUser,
|
||||
logger = ocelotLogger,
|
||||
config = CONFIG,
|
||||
} = opts ?? {}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import { getNeode } from './neo4j'
|
||||
import { trophies, verification } from './seed/badges'
|
||||
|
||||
// eslint-disable-next-line import/newline-after-import
|
||||
// eslint-disable-next-line import-x/newline-after-import
|
||||
;(async function () {
|
||||
const neode = getNeode()
|
||||
try {
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
/* 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, @typescript-eslint/no-var-requires
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
/* eslint-disable import-x/no-commonjs */
|
||||
// eslint-disable-next-line n/no-unpublished-require
|
||||
const tsNode = require('ts-node')
|
||||
// eslint-disable-next-line import/no-unassigned-import, n/no-unpublished-require
|
||||
// eslint-disable-next-line import-x/no-unassigned-import, n/no-unpublished-require
|
||||
require('tsconfig-paths/register')
|
||||
|
||||
module.exports = tsNode.register
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/await-thenable */
|
||||
import { readdir } from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ const run = async () => {
|
||||
if (args.length !== 1) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Usage: yarn run db:func:disable-notifications <email>')
|
||||
// eslint-disable-next-line n/no-process-exit
|
||||
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ const run = async () => {
|
||||
if (!emailRegex.test(email)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Error: Invalid email address format')
|
||||
// eslint-disable-next-line n/no-process-exit
|
||||
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
@ -46,13 +46,13 @@ const run = async () => {
|
||||
if (result !== '1') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(`User with email address ${email} not found`)
|
||||
// eslint-disable-next-line n/no-process-exit
|
||||
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Notifications for User with email address ${email} disabled`)
|
||||
// eslint-disable-next-line n/no-process-exit
|
||||
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable n/no-unpublished-import */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import { faker } from '@faker-js/faker'
|
||||
import { hashSync } from 'bcryptjs'
|
||||
import { Factory } from 'rosie'
|
||||
@ -13,10 +15,11 @@ import { v4 as uuid } from 'uuid'
|
||||
import { generateInviteCode } from '@graphql/resolvers/inviteCodes'
|
||||
import { isUniqueFor } from '@middleware/sluggifyMiddleware'
|
||||
import uniqueSlug from '@middleware/slugify/uniqueSlug'
|
||||
import { Context } from '@src/context'
|
||||
|
||||
import { getDriver, getNeode } from './neo4j'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
const uniqueImageUrl = (imageUrl) => {
|
||||
@ -49,14 +52,14 @@ Factory.define('category')
|
||||
.attr('id', uuid)
|
||||
.attr('icon', 'globe')
|
||||
.attr('name', 'Global Peace & Nonviolence')
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('Category', buildObject)
|
||||
})
|
||||
|
||||
Factory.define('badge')
|
||||
.attr('type', 'crowdfunding')
|
||||
.attr('status', 'permanent')
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('Badge', buildObject)
|
||||
})
|
||||
|
||||
@ -67,7 +70,7 @@ Factory.define('image')
|
||||
.attr('alt', faker.lorem.sentence)
|
||||
.attr('type', 'image/jpeg')
|
||||
.attr('url', null)
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
if (!buildObject.url) {
|
||||
buildObject.url = faker.image.urlPicsumPhotos({
|
||||
width: buildObject.width,
|
||||
@ -84,7 +87,7 @@ Factory.define('file')
|
||||
.attr('name', faker.lorem.slug)
|
||||
.attr('type', 'image/jpeg')
|
||||
.attr('url', null)
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
if (!buildObject.url) {
|
||||
buildObject.url = faker.image.urlPicsumPhotos()
|
||||
}
|
||||
@ -171,8 +174,8 @@ Factory.define('post')
|
||||
return Promise.all([Factory.build('category')])
|
||||
}) */
|
||||
.option('tagIds', [])
|
||||
.option('tags', ['tagIds'], (tagIds) => {
|
||||
return Promise.all(tagIds.map((id) => neode.find('Tag', id)))
|
||||
.option('tags', ['tagIds'], async (tagIds) => {
|
||||
return Promise.all(tagIds.map(async (id) => neode.find('Tag', id)))
|
||||
})
|
||||
.option('authorId', null)
|
||||
.option('author', ['authorId'], (authorId) => {
|
||||
@ -264,7 +267,7 @@ Factory.define('donations')
|
||||
.attr('showDonations', true)
|
||||
.attr('goal', 15000)
|
||||
.attr('progress', 7000)
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('Donations', buildObject)
|
||||
})
|
||||
|
||||
@ -275,13 +278,13 @@ const emailDefaults = {
|
||||
|
||||
Factory.define('emailAddress')
|
||||
.attrs(emailDefaults)
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('EmailAddress', buildObject)
|
||||
})
|
||||
|
||||
Factory.define('unverifiedEmailAddress')
|
||||
.attr(emailDefaults)
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('UnverifiedEmailAddress', buildObject)
|
||||
})
|
||||
|
||||
@ -294,7 +297,7 @@ const inviteCodeDefaults = {
|
||||
Factory.define('inviteCode')
|
||||
.attrs(inviteCodeDefaults)
|
||||
.option('groupId', null)
|
||||
.option('group', ['groupId'], (groupId) => {
|
||||
.option('group', ['groupId'], async (groupId) => {
|
||||
if (groupId) {
|
||||
return neode.find('Group', groupId)
|
||||
}
|
||||
@ -331,11 +334,11 @@ Factory.define('location')
|
||||
id: 'country.10743216036480410',
|
||||
type: 'country',
|
||||
})
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('Location', buildObject)
|
||||
})
|
||||
|
||||
Factory.define('report').after((buildObject, _options) => {
|
||||
Factory.define('report').after(async (buildObject, _options) => {
|
||||
return neode.create('Report', buildObject)
|
||||
})
|
||||
|
||||
@ -343,7 +346,7 @@ Factory.define('tag')
|
||||
.attrs({
|
||||
name: '#human-connection',
|
||||
})
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('Tag', buildObject)
|
||||
})
|
||||
|
||||
@ -351,7 +354,7 @@ Factory.define('socialMedia')
|
||||
.attrs({
|
||||
url: 'https://mastodon.social/@Gargron',
|
||||
})
|
||||
.after((buildObject, _options) => {
|
||||
.after(async (buildObject, _options) => {
|
||||
return neode.create('SocialMedia', buildObject)
|
||||
})
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
|
||||
import { getDriver, getNeode } from '@db/neo4j'
|
||||
|
||||
class Store {
|
||||
@ -83,7 +84,7 @@ class Store {
|
||||
const driver = getDriver()
|
||||
const session = driver.session()
|
||||
const { migrations } = set
|
||||
const writeTxResultPromise = session.writeTransaction((txc) => {
|
||||
const writeTxResultPromise = session.writeTransaction(async (txc) => {
|
||||
return Promise.all(
|
||||
migrations.map(async (migration) => {
|
||||
const { title, description, timestamp } = migration
|
||||
|
||||
@ -4,8 +4,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable import-x/no-extraneous-dependencies */
|
||||
/* eslint-disable promise/prefer-await-to-callbacks */
|
||||
/* eslint-disable import-x/no-deprecated */
|
||||
import { throwError, concat } from 'rxjs'
|
||||
import { flatMap, mergeMap, map, catchError, filter } from 'rxjs/operators'
|
||||
|
||||
@ -71,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:
|
||||
@ -79,7 +80,8 @@ export function up(next) {
|
||||
userId: ${user.id}
|
||||
email: ${oldEmail} => ${email.email}
|
||||
=============================
|
||||
`),
|
||||
`)
|
||||
},
|
||||
complete: () => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Merging of duplicate users completed')
|
||||
|
||||
@ -4,8 +4,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable import-x/no-extraneous-dependencies */
|
||||
/* eslint-disable promise/prefer-await-to-callbacks */
|
||||
/* eslint-disable import-x/no-deprecated */
|
||||
import { throwError, concat } from 'rxjs'
|
||||
import { flatMap, mergeMap, map, catchError } from 'rxjs/operators'
|
||||
|
||||
@ -65,7 +66,7 @@ export function up(next) {
|
||||
),
|
||||
)
|
||||
.subscribe({
|
||||
next: ({ updatedLocation, location }) =>
|
||||
next: ({ updatedLocation, location }) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`
|
||||
Merged:
|
||||
@ -73,7 +74,8 @@ export function up(next) {
|
||||
locationId: ${location.id}
|
||||
updatedLocation: ${location.id} => ${updatedLocation.id}
|
||||
=============================
|
||||
`),
|
||||
`)
|
||||
},
|
||||
complete: () => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Merging of duplicate locations completed')
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
'use strict'
|
||||
|
||||
export async function up(_next) {}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/await-thenable */
|
||||
|
||||
import { open } from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable jest/valid-title */
|
||||
|
||||
import { cleanDatabase } from '@db/factories'
|
||||
import { getNeode, getDriver } from '@db/neo4j'
|
||||
@ -65,8 +66,8 @@ describe('slug', () => {
|
||||
})
|
||||
|
||||
describe('characters', () => {
|
||||
const createUser = (attrs) => {
|
||||
return neode.create('User', attrs).then((user) => user.toJson())
|
||||
const createUser = async (attrs) => {
|
||||
return neode.create('User', attrs).then(async (user) => user.toJson())
|
||||
}
|
||||
|
||||
it('-', async () => {
|
||||
@ -81,7 +82,7 @@ describe('slug', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it(' ', async () => {
|
||||
it('', async () => {
|
||||
await expect(createUser({ slug: 'matt rider' })).rejects.toThrow('ERROR_VALIDATION')
|
||||
})
|
||||
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
/* eslint-disable import/no-named-as-default-member */
|
||||
import neo4j, { Driver } from 'neo4j-driver'
|
||||
/* eslint-disable import-x/no-named-as-default-member */
|
||||
import neo4j from 'neo4j-driver'
|
||||
import Neode from 'neode'
|
||||
|
||||
import CONFIG from '@config/index'
|
||||
import models from '@db/models/index'
|
||||
|
||||
import type { Driver } from 'neo4j-driver'
|
||||
|
||||
let driver: Driver
|
||||
const defaultOptions = {
|
||||
uri: CONFIG.NEO4J_URI,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* 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'
|
||||
|
||||
import { cleanDatabase } from './factories'
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* 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'
|
||||
|
||||
import { cleanDatabase } from './factories'
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
/* 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 */
|
||||
/* eslint-disable n/no-unpublished-import */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
|
||||
|
||||
import { faker } from '@faker-js/faker'
|
||||
import sample from 'lodash/sample'
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface CategoryDbProperties {
|
||||
createdAt: string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface CommentDbProperties {
|
||||
content: string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface EmailAddressDbProperties {
|
||||
createdAt: string
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
import { PostDbProperties } from './Post'
|
||||
import type { PostDbProperties } from './Post'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface EventDbProperties extends PostDbProperties {
|
||||
eventIsOnline: boolean
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface GroupDbProperties {
|
||||
about: string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface ImageDbProperties {
|
||||
alt: string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface InviteCodeDbProperties {
|
||||
code: string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface LocationDbProperties {
|
||||
id: string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface MessageDbProperties {
|
||||
content: string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface PostDbProperties {
|
||||
clickedCount: number
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface ReportDbProperties {
|
||||
closed: boolean
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface TagDbProperties {
|
||||
deleted: boolean
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Integer, Node } from 'neo4j-driver'
|
||||
import type { Integer, Node } from 'neo4j-driver'
|
||||
|
||||
export interface UserDbProperties {
|
||||
allowEmbedIframes: boolean
|
||||
|
||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
||||
|
||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||
|
||||
// eslint-disable-next-line import/first
|
||||
// eslint-disable-next-line import-x/first
|
||||
import { sendChatMessageMail } from './sendEmail'
|
||||
|
||||
const senderUser = {
|
||||
|
||||
@ -12,7 +12,8 @@ import { createTransport } from 'nodemailer'
|
||||
import CONFIG, { nodemailerTransportOptions } from '@config/index'
|
||||
import logosWebapp from '@config/logosBranded'
|
||||
import metadata from '@config/metadata'
|
||||
import { UserDbProperties } from '@db/types/User'
|
||||
|
||||
import type { UserDbProperties } from '@db/types/User'
|
||||
|
||||
const welcomeImageUrl = new URL(logosWebapp.LOGO_WELCOME_PATH, CONFIG.CLIENT_URI)
|
||||
const settingsUrl = new URL('/settings/notifications', CONFIG.CLIENT_URI)
|
||||
|
||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
||||
|
||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||
|
||||
// eslint-disable-next-line import/first
|
||||
// eslint-disable-next-line import-x/first
|
||||
import { sendEmailVerification } from './sendEmail'
|
||||
|
||||
describe('sendEmailVerification', () => {
|
||||
|
||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
||||
|
||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||
|
||||
// eslint-disable-next-line import/first
|
||||
// eslint-disable-next-line import-x/first
|
||||
import { sendNotificationMail } from './sendEmail'
|
||||
|
||||
describe('sendNotificationMail', () => {
|
||||
|
||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
||||
|
||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||
|
||||
// eslint-disable-next-line import/first
|
||||
// eslint-disable-next-line import-x/first
|
||||
import { sendRegistrationMail } from './sendEmail'
|
||||
|
||||
describe('sendRegistrationMail', () => {
|
||||
|
||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
||||
|
||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||
|
||||
// eslint-disable-next-line import/first
|
||||
// eslint-disable-next-line import-x/first
|
||||
import { sendResetPasswordMail } from './sendEmail'
|
||||
|
||||
describe('sendResetPasswordMail', () => {
|
||||
|
||||
@ -2,7 +2,7 @@ import CONFIG from '@config/index'
|
||||
|
||||
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
||||
|
||||
// eslint-disable-next-line import/first
|
||||
// eslint-disable-next-line import-x/first
|
||||
import { sendWrongEmail } from './sendEmail'
|
||||
|
||||
describe('sendWrongEmail', () => {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { ReadStream } from 'node:fs'
|
||||
/* eslint-disable jest/no-conditional-expect */
|
||||
import { Readable } from 'node:stream'
|
||||
|
||||
import { S3Client } from '@aws-sdk/client-s3'
|
||||
@ -11,16 +11,17 @@ import { Upload } from '@aws-sdk/lib-storage'
|
||||
import { UserInputError } from 'apollo-server'
|
||||
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import File from '@db/models/File'
|
||||
import { CreateMessage } from '@graphql/queries/CreateMessage'
|
||||
import { CreateRoom } from '@graphql/queries/CreateRoom'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
import type { S3Config } from '@src/config'
|
||||
|
||||
import { attachments } from './attachments'
|
||||
|
||||
import type { FileInput } from './attachments'
|
||||
import type File from '@db/models/File'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { S3Config } from '@src/config'
|
||||
import type { ReadStream } from 'node:fs'
|
||||
|
||||
const s3SendMock = jest.fn()
|
||||
jest.spyOn(S3Client.prototype, 'send').mockImplementation(s3SendMock)
|
||||
@ -165,7 +166,7 @@ describe('delete Attachment', () => {
|
||||
throw new Error('Ouch!')
|
||||
})
|
||||
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// nothing has been deleted
|
||||
await expect(database.neode.all('File')).resolves.toHaveLength(1)
|
||||
// all good
|
||||
@ -194,14 +195,14 @@ describe('add Attachment', () => {
|
||||
fileInput = {
|
||||
...fileInput,
|
||||
// eslint-disable-next-line promise/avoid-new
|
||||
upload: new Promise((resolve) =>
|
||||
upload: new Promise((resolve) => {
|
||||
resolve({
|
||||
createReadStream: () => file1 as ReadStream,
|
||||
filename: 'file1',
|
||||
encoding: '7bit',
|
||||
mimetype: 'application/json',
|
||||
}),
|
||||
),
|
||||
})
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
@ -306,7 +307,7 @@ describe('add Attachment', () => {
|
||||
return transaction.run('Ooops invalid cypher!', { file })
|
||||
})
|
||||
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// nothing has been created
|
||||
await expect(database.neode.all('File')).resolves.toHaveLength(0)
|
||||
// all good
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import path from 'node:path'
|
||||
|
||||
import { UserInputError } from 'apollo-server-express'
|
||||
import slug from 'slugify'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import type { S3Config } from '@config/index'
|
||||
import { getDriver } from '@db/neo4j'
|
||||
import { s3Service } from '@src/uploads/s3Service'
|
||||
|
||||
import type { S3Config } from '@config/index'
|
||||
import type { FileUpload } from 'graphql-upload'
|
||||
import type { Transaction } from 'neo4j-driver'
|
||||
|
||||
@ -59,7 +60,7 @@ const wrapTransactionDeleteAttachment = async (
|
||||
): ReturnType<Attachments['del']> => {
|
||||
const session = getDriver().session()
|
||||
try {
|
||||
const result = await session.writeTransaction((transaction) => {
|
||||
const result = await session.writeTransaction(async (transaction) => {
|
||||
return wrappedCallback(...args, { ...opts, transaction })
|
||||
})
|
||||
return result
|
||||
@ -80,7 +81,7 @@ const wrapTransactionMergeAttachment = async (
|
||||
): ReturnType<Attachments['add']> => {
|
||||
const session = getDriver().session()
|
||||
try {
|
||||
const result = await session.writeTransaction((transaction) => {
|
||||
const result = await session.writeTransaction(async (transaction) => {
|
||||
return wrappedCallback(...args, { ...opts, transaction })
|
||||
})
|
||||
return result
|
||||
|
||||
@ -1,6 +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/restrict-template-expressions */
|
||||
import { TROPHY_BADGES_SELECTED_MAX } from '@constants/badges'
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { revokeBadge } from '@graphql/queries/revokeBadge'
|
||||
@ -8,8 +9,9 @@ import { rewardTrophyBadge } from '@graphql/queries/rewardTrophyBadge'
|
||||
import { setTrophyBadgeSelected } from '@graphql/queries/setTrophyBadgeSelected'
|
||||
import { setVerificationBadge } from '@graphql/queries/setVerificationBadge'
|
||||
import { User } from '@graphql/queries/User'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let regularUser, administrator, moderator, badge, verification
|
||||
|
||||
@ -4,10 +4,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-loop-func */
|
||||
import { neo4jgraphql } from 'neo4j-graphql-js'
|
||||
|
||||
import { TROPHY_BADGES_SELECTED_MAX } from '@constants/badges'
|
||||
import { Context } from '@src/context'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
export const defaultTrophyBadge = {
|
||||
id: 'default_trophy',
|
||||
|
||||
@ -6,8 +6,9 @@ import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { CreateComment } from '@graphql/queries/CreateComment'
|
||||
import { DeleteComment } from '@graphql/queries/DeleteComment'
|
||||
import { UpdateComment as updateComment } from '@graphql/queries/UpdateComment'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let variables, commentAuthor, newlyCreatedComment
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import Resolver from './helpers/Resolver'
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
export default {
|
||||
Query: {
|
||||
Donations: async (_parent, _params, context, _resolveInfo) => {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
|
||||
import { createTestClient } from 'apollo-server-testing'
|
||||
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { UserInputError } from 'apollo-server'
|
||||
// eslint-disable-next-line import/extensions
|
||||
// eslint-disable-next-line import-x/extensions
|
||||
import Validator from 'neode/build/Services/Validator.js'
|
||||
|
||||
import existingEmailAddress from './helpers/existingEmailAddress'
|
||||
@ -38,7 +38,7 @@ export default {
|
||||
try {
|
||||
const { neode } = context
|
||||
await new Validator(neode, neode.model('UnverifiedEmailAddress'), args)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
throw new UserInputError('must be a valid email')
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
@ -61,7 +62,6 @@ describe('Query', () => {
|
||||
beforeEach(() => {
|
||||
embedAction = async (variables) => {
|
||||
const { server } = createServer({
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
context: () => {},
|
||||
})
|
||||
const { query } = createTestClient(server)
|
||||
|
||||
@ -4,11 +4,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable n/no-extraneous-require */
|
||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
|
||||
/* eslint-disable n/global-require */
|
||||
/* eslint-disable import/no-commonjs */
|
||||
/* eslint-disable import/no-named-as-default */
|
||||
/* eslint-disable import-x/no-commonjs */
|
||||
/* eslint-disable import-x/no-named-as-default */
|
||||
|
||||
import { ApolloError } from 'apollo-server'
|
||||
import isArray from 'lodash/isArray'
|
||||
@ -19,7 +20,7 @@ import fetch from 'node-fetch'
|
||||
|
||||
import findProvider from './findProvider'
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line import-x/no-extraneous-dependencies
|
||||
const error = require('debug')('embed:error')
|
||||
|
||||
const metascraper = Metascraper([
|
||||
|
||||
@ -7,6 +7,7 @@ import { followUser } from '@graphql/queries/followUser'
|
||||
import { unfollowUser } from '@graphql/queries/unfollowUser'
|
||||
import { User } from '@graphql/queries/User'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
|
||||
@ -3,6 +3,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
/* eslint-disable jest/no-commented-out-tests */
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { ChangeGroupMemberRole } from '@graphql/queries/ChangeGroupMemberRole'
|
||||
import { CreateGroup } from '@graphql/queries/CreateGroup'
|
||||
@ -12,8 +15,9 @@ import { JoinGroup } from '@graphql/queries/JoinGroup'
|
||||
import { LeaveGroup } from '@graphql/queries/LeaveGroup'
|
||||
import { RemoveUserFromGroup } from '@graphql/queries/RemoveUserFromGroup'
|
||||
import { UpdateGroup } from '@graphql/queries/UpdateGroup'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
// import CONFIG from '@src/config'
|
||||
|
||||
@ -2982,7 +2986,7 @@ describe('in mode', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('"locationName" is empty string – shall change location "Hamburg" to unset location ', () => {
|
||||
describe('"locationName" is empty string – shall change location "Hamburg" to unset location', () => {
|
||||
it('has updated the location to unset', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
|
||||
@ -4,18 +4,22 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
import { UserInputError } from 'apollo-server'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import { CATEGORIES_MIN, CATEGORIES_MAX } from '@constants/categories'
|
||||
import { DESCRIPTION_WITHOUT_HTML_LENGTH_MIN } from '@constants/groups'
|
||||
import { removeHtmlTags } from '@middleware/helpers/cleanHtml'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
import Resolver from './helpers/Resolver'
|
||||
import { images } from './images/images'
|
||||
import { createOrUpdateLocations } from './users/location'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
export default {
|
||||
Query: {
|
||||
Group: async (_object, params, context: Context, _resolveInfo) => {
|
||||
@ -211,7 +215,7 @@ export default {
|
||||
if (!context.user) {
|
||||
throw new Error('Missing authenticated user.')
|
||||
}
|
||||
if (config.CATEGORIES_ACTIVE && categoryIds && categoryIds.length) {
|
||||
if (config.CATEGORIES_ACTIVE && categoryIds?.length) {
|
||||
await transaction.run(
|
||||
`
|
||||
MATCH (group:Group {id: $groupId})-[previousRelations:CATEGORIZED]->(:Category)
|
||||
@ -226,7 +230,7 @@ export default {
|
||||
SET group.updatedAt = toString(datetime())
|
||||
WITH group
|
||||
`
|
||||
if (config.CATEGORIES_ACTIVE && categoryIds && categoryIds.length) {
|
||||
if (config.CATEGORIES_ACTIVE && categoryIds?.length) {
|
||||
updateGroupCypher += `
|
||||
UNWIND $categoryIds AS categoryId
|
||||
MATCH (category:Category {id: categoryId})
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
/* 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/prefer-nullish-coalescing */
|
||||
/* eslint-disable security/detect-object-injection */
|
||||
export const undefinedToNullResolver = (list) => {
|
||||
const resolvers = {}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import normalizeEmail from './normalizeEmail'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
export default async function createPasswordReset(options: {
|
||||
driver: Context['driver']
|
||||
nonce: string
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
import { UserInputError } from 'apollo-server'
|
||||
|
||||
export const validateEventParams = (params) => {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import normalizeEmail from './normalizeEmail'
|
||||
|
||||
export default async function alreadyExistingMail({ args, context }) {
|
||||
@ -20,6 +21,7 @@ export default async function alreadyExistingMail({ args, context }) {
|
||||
return existingEmailAddressTransactionResponse.records.map((record) => {
|
||||
return {
|
||||
alreadyExistingEmail: record.get('email').properties,
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
user: record.get('user') && record.get('user').properties,
|
||||
}
|
||||
})
|
||||
|
||||
@ -4,6 +4,7 @@ import registrationConstants from '@constants/registrationBranded'
|
||||
export default function generateNonce() {
|
||||
return Array.from(
|
||||
{ length: registrationConstants.NONCE_LENGTH },
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-default-assignment
|
||||
(n: number = Math.floor(Math.random() * 10)) => {
|
||||
return String.fromCharCode(n + 48)
|
||||
},
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import { TEST_CONFIG } from '@root/test/helpers'
|
||||
|
||||
import ImageResolver from './images'
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import crypto from 'node:crypto'
|
||||
import { join as joinPath } from 'node:path/posix'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
import Resolver from './helpers/Resolver'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
type UrlResolver = (
|
||||
parent: { url: string },
|
||||
args: { width?: number; height?: number },
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import type { Context } from '@src/context'
|
||||
import type { FileDeleteCallback, FileUploadCallback } from '@src/uploads/types'
|
||||
|
||||
import { images as imagesS3 } from './imagesS3'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
import type { FileDeleteCallback, FileUploadCallback } from '@src/uploads/types'
|
||||
import type { FileUpload } from 'graphql-upload'
|
||||
import type { Transaction } from 'neo4j-driver'
|
||||
|
||||
|
||||
@ -2,17 +2,21 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable jest/no-conditional-expect */
|
||||
/* eslint-disable promise/prefer-await-to-callbacks */
|
||||
/* eslint-disable no-undef */
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import { DeleteObjectCommand } from '@aws-sdk/client-s3'
|
||||
import { Upload } from '@aws-sdk/lib-storage'
|
||||
import { UserInputError } from 'apollo-server'
|
||||
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { getNeode, getDriver } from '@db/neo4j'
|
||||
import type { S3Config } from '@src/config'
|
||||
|
||||
import { images } from './imagesS3'
|
||||
|
||||
import type { ImageInput } from './images'
|
||||
import type { S3Config } from '@src/config'
|
||||
import type { FileUpload } from 'graphql-upload'
|
||||
|
||||
jest.mock('@aws-sdk/client-s3', () => {
|
||||
@ -28,7 +32,8 @@ jest.mock('@aws-sdk/client-s3', () => {
|
||||
jest.mock('@aws-sdk/lib-storage', () => {
|
||||
return {
|
||||
Upload: jest.fn().mockImplementation(({ params: { Key } }: { params: { Key: string } }) => ({
|
||||
done: () => Promise.resolve({ Location: `http://your-objectstorage.com/bucket/${Key}` }),
|
||||
done: async () =>
|
||||
Promise.resolve({ Location: `http://your-objectstorage.com/bucket/${Key}` }),
|
||||
})),
|
||||
}
|
||||
})
|
||||
@ -125,7 +130,7 @@ describe('deleteImage', () => {
|
||||
throw new Error('Ouch!')
|
||||
})
|
||||
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// nothing has been deleted
|
||||
await expect(neode.all('Image')).resolves.toHaveLength(1)
|
||||
// all good
|
||||
@ -151,7 +156,9 @@ describe('mergeImage', () => {
|
||||
beforeEach(() => {
|
||||
const createReadStream: FileUpload['createReadStream'] = (() => ({
|
||||
pipe: () => ({
|
||||
on: (_: unknown, callback: () => void) => callback(), // eslint-disable-line promise/prefer-await-to-callbacks
|
||||
on: (_: unknown, callback: () => void) => {
|
||||
callback()
|
||||
},
|
||||
}),
|
||||
})) as unknown as FileUpload['createReadStream']
|
||||
imageInput = {
|
||||
@ -272,7 +279,7 @@ describe('mergeImage', () => {
|
||||
return transaction.run('Ooops invalid cypher!', { image })
|
||||
})
|
||||
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||
} catch (err) {
|
||||
} catch {
|
||||
// nothing has been created
|
||||
await expect(neode.all('Image')).resolves.toHaveLength(0)
|
||||
// all good
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import path from 'node:path'
|
||||
|
||||
import { UserInputError } from 'apollo-server'
|
||||
import { FileUpload } from 'graphql-upload'
|
||||
import slug from 'slugify'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import type { S3Config } from '@config/index'
|
||||
import { s3Service } from '@src/uploads/s3Service'
|
||||
|
||||
import { wrapTransactionDeleteImage, wrapTransactionMergeImage } from './wrapTransaction'
|
||||
|
||||
import type { Image, Images } from './images'
|
||||
import type { S3Config } from '@config/index'
|
||||
import type { FileUpload } from 'graphql-upload'
|
||||
|
||||
export const images = (config: S3Config) => {
|
||||
const s3 = s3Service(config, 'original')
|
||||
|
||||
@ -9,7 +9,7 @@ export const wrapTransactionDeleteImage = async (
|
||||
): ReturnType<Images['deleteImage']> => {
|
||||
const session = getDriver().session()
|
||||
try {
|
||||
const result = await session.writeTransaction((transaction) => {
|
||||
const result = await session.writeTransaction(async (transaction) => {
|
||||
return wrappedCallback(...args, { ...opts, transaction })
|
||||
})
|
||||
return result
|
||||
@ -29,7 +29,7 @@ export const wrapTransactionMergeImage = async (
|
||||
): ReturnType<Images['mergeImage']> => {
|
||||
const session = getDriver().session()
|
||||
try {
|
||||
const result = await session.writeTransaction((transaction) => {
|
||||
const result = await session.writeTransaction(async (transaction) => {
|
||||
return wrappedCallback(...args, { ...opts, transaction })
|
||||
})
|
||||
return result
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable jest/expect-expect */
|
||||
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { CreateGroup } from '@graphql/queries/CreateGroup'
|
||||
@ -16,8 +17,9 @@ import {
|
||||
authenticatedValidateInviteCode,
|
||||
unauthenticatedValidateInviteCode,
|
||||
} from '@graphql/queries/validateInviteCode'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup, TEST_CONFIG } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let authenticatedUser: Context['user']
|
||||
@ -326,7 +328,7 @@ describe('validateInviteCode', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// eslint-disable-next-line jest/no-disabled-tests, @typescript-eslint/no-empty-function
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
it.skip('throws no authorization error when querying extended hidden group fields as member', async () => {})
|
||||
})
|
||||
})
|
||||
@ -495,7 +497,7 @@ describe('generatePersonalInviteCode', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// eslint-disable-next-line jest/no-disabled-tests, @typescript-eslint/no-empty-function
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
it.skip('returns a new invite code when colliding with an existing one', () => {})
|
||||
})
|
||||
})
|
||||
@ -763,7 +765,7 @@ describe('generateGroupInviteCode', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// eslint-disable-next-line jest/no-disabled-tests, @typescript-eslint/no-empty-function
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
it.skip('returns a new group invite code when colliding with an existing one', () => {})
|
||||
})
|
||||
|
||||
|
||||
@ -2,14 +2,16 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import registrationConstants from '@constants/registrationBranded'
|
||||
import { Context } from '@src/context'
|
||||
|
||||
import Resolver from './helpers/Resolver'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
export const generateInviteCode = () => {
|
||||
// 6 random numbers in [ 0, 35 ] are 36 possible numbers (10 [0-9] + 26 [A-Z])
|
||||
return Array.from(
|
||||
{ length: registrationConstants.INVITE_CODE_LENGTH },
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-default-assignment
|
||||
(n: number = Math.floor(Math.random() * 36)) => {
|
||||
// n > 9: it is a letter (ASCII 65 is A) -> 10 + 55 = 65
|
||||
// else: it is a number (ASCII 48 is 0) -> 0 + 48 = 48
|
||||
|
||||
@ -5,6 +5,7 @@ import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { UpdateUser } from '@graphql/queries/UpdateUser'
|
||||
import { User } from '@graphql/queries/User'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
|
||||
@ -2,13 +2,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/return-await */
|
||||
import { UserInputError } from 'apollo-server'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
import Resolver from './helpers/Resolver'
|
||||
import { queryLocations } from './users/location'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
export default {
|
||||
Location: {
|
||||
...Resolver('Location', {
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
|
||||
import { Readable } from 'node:stream'
|
||||
|
||||
import { Upload } from 'graphql-upload/public/index'
|
||||
@ -14,8 +16,9 @@ import { CreateRoom } from '@graphql/queries/CreateRoom'
|
||||
import { MarkMessagesAsSeen } from '@graphql/queries/MarkMessagesAsSeen'
|
||||
import { Message } from '@graphql/queries/Message'
|
||||
import { Room } from '@graphql/queries/Room'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let authenticatedUser: Context['user']
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import { withFilter } from 'graphql-subscriptions'
|
||||
import { neo4jgraphql } from 'neo4j-graphql-js'
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
export default {
|
||||
Mutation: {
|
||||
review: async (_object, params, context, _resolveInfo) => {
|
||||
|
||||
@ -3,13 +3,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { DeletePost } from '@graphql/queries/DeletePost'
|
||||
import { markAllAsRead } from '@graphql/queries/markAllAsRead'
|
||||
import { markAsRead } from '@graphql/queries/markAsRead'
|
||||
import { notifications } from '@graphql/queries/notifications'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let user
|
||||
|
||||
@ -6,11 +6,12 @@ import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { login } from '@graphql/queries/login'
|
||||
import { requestPasswordReset } from '@graphql/queries/requestPasswordReset'
|
||||
import { resetPassword } from '@graphql/queries/resetPassword'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import createPasswordReset from './helpers/createPasswordReset'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
let variables
|
||||
|
||||
let mutate: ApolloTestSetup['mutate']
|
||||
|
||||
@ -8,11 +8,12 @@ import bcrypt from 'bcryptjs'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import registrationConstants from '@constants/registrationBranded'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
import createPasswordReset from './helpers/createPasswordReset'
|
||||
import normalizeEmail from './helpers/normalizeEmail'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
export default {
|
||||
Mutation: {
|
||||
requestPasswordReset: async (_parent, { email }, context: Context) => {
|
||||
|
||||
@ -5,8 +5,9 @@
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { CreatePost } from '@graphql/queries/CreatePost'
|
||||
import { Post } from '@graphql/queries/Post'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let user
|
||||
|
||||
@ -8,8 +8,9 @@ import { CreatePost } from '@graphql/queries/CreatePost'
|
||||
import { pinGroupPost } from '@graphql/queries/pinGroupPost'
|
||||
import { profilePagePosts } from '@graphql/queries/profilePagePosts'
|
||||
import { unpinGroupPost } from '@graphql/queries/unpinGroupPost'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
const defaultConfig = {
|
||||
|
||||
@ -12,8 +12,9 @@ import { Post } from '@graphql/queries/Post'
|
||||
import { profilePagePosts } from '@graphql/queries/profilePagePosts'
|
||||
import { searchPosts } from '@graphql/queries/searchPosts'
|
||||
import { SignupVerification } from '@graphql/queries/SignupVerification'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
jest.mock('@constants/groups', () => {
|
||||
|
||||
@ -6,8 +6,9 @@ import { CreateComment } from '@graphql/queries/CreateComment'
|
||||
import { CreatePost } from '@graphql/queries/CreatePost'
|
||||
import { Post } from '@graphql/queries/Post'
|
||||
import { toggleObservePost } from '@graphql/queries/toggleObservePost'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let user
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
/* eslint-disable jest/no-commented-out-tests */
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import Image from '@db/models/Image'
|
||||
import { AddPostEmotions } from '@graphql/queries/AddPostEmotions'
|
||||
import { CreateGroup } from '@graphql/queries/CreateGroup'
|
||||
import { CreatePost } from '@graphql/queries/CreatePost'
|
||||
@ -17,8 +18,10 @@ import { RemovePostEmotions } from '@graphql/queries/RemovePostEmotions'
|
||||
import { unpinPost } from '@graphql/queries/unpinPost'
|
||||
import { unpushPost } from '@graphql/queries/unpushPost'
|
||||
import { UpdatePost } from '@graphql/queries/UpdatePost'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type Image from '@db/models/Image'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let user
|
||||
|
||||
@ -4,13 +4,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import { UserInputError } from 'apollo-server'
|
||||
import { isEmpty } from 'lodash'
|
||||
import { neo4jgraphql } from 'neo4j-graphql-js'
|
||||
import { v4 as uuid } from 'uuid'
|
||||
|
||||
import { Context } from '@src/context'
|
||||
|
||||
import { validateEventParams } from './helpers/events'
|
||||
import { filterForMutedUsers } from './helpers/filterForMutedUsers'
|
||||
import { filterInvisiblePosts } from './helpers/filterInvisiblePosts'
|
||||
@ -19,6 +18,8 @@ import Resolver from './helpers/Resolver'
|
||||
import { images } from './images/images'
|
||||
import { createOrUpdateLocations } from './users/location'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
const maintainPinnedPosts = (params) => {
|
||||
const pinnedPostFilter = { pinned: true }
|
||||
if (isEmpty(params.filter)) {
|
||||
@ -235,7 +236,7 @@ export default {
|
||||
WITH post
|
||||
`
|
||||
|
||||
if (config.CATEGORIES_ACTIVE && categoryIds && categoryIds.length) {
|
||||
if (config.CATEGORIES_ACTIVE && categoryIds?.length) {
|
||||
const cypherDeletePreviousRelations = `
|
||||
MATCH (post:Post { id: $params.id })-[previousRelations:CATEGORIZED]->(category:Category)
|
||||
DELETE previousRelations
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import EmailAddress from '@db/models/EmailAddress'
|
||||
import User from '@db/models/User'
|
||||
import { Signup } from '@graphql/queries/Signup'
|
||||
import { SignupVerification } from '@graphql/queries/SignupVerification'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type EmailAddress from '@db/models/EmailAddress'
|
||||
import type User from '@db/models/User'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let variables
|
||||
|
||||
@ -7,7 +7,6 @@ import { UserInputError } from 'apollo-server'
|
||||
import { hash } from 'bcryptjs'
|
||||
|
||||
import { getNeode } from '@db/neo4j'
|
||||
import { Context } from '@src/context'
|
||||
|
||||
import existingEmailAddress from './helpers/existingEmailAddress'
|
||||
import generateNonce from './helpers/generateNonce'
|
||||
@ -15,6 +14,8 @@ import normalizeEmail from './helpers/normalizeEmail'
|
||||
import { redeemInviteCode } from './inviteCodes'
|
||||
import { createOrUpdateLocations } from './users/location'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
export default {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
export default {
|
||||
Mutation: {
|
||||
fileReport: async (_parent, params, context, _resolveInfo) => {
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { ApolloServerTestClient, createTestClient } from 'apollo-server-testing'
|
||||
import { createTestClient } from 'apollo-server-testing'
|
||||
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { getDriver, getNeode } from '@db/neo4j'
|
||||
import { availableRoles } from '@graphql/queries/availableRoles'
|
||||
import createServer from '@src/server'
|
||||
|
||||
import type { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
|
||||
const instance = getNeode()
|
||||
const driver = getDriver()
|
||||
|
||||
|
||||
@ -7,8 +7,9 @@ import { CreateMessage } from '@graphql/queries/CreateMessage'
|
||||
import { CreateRoom } from '@graphql/queries/CreateRoom'
|
||||
import { Room } from '@graphql/queries/Room'
|
||||
import { UnreadRooms } from '@graphql/queries/UnreadRooms'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let chattingUser, otherChattingUser, notChattingUser
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import { withFilter } from 'graphql-subscriptions'
|
||||
import { neo4jgraphql } from 'neo4j-graphql-js'
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import { queryString } from './searches/queryString'
|
||||
|
||||
// see http://lucene.apache.org/core/8_3_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package.description
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
export function queryString(str) {
|
||||
const normalizedString = normalizeWhitespace(str)
|
||||
const escapedString = escapeSpecialCharacters(normalizedString)
|
||||
|
||||
@ -4,8 +4,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import { statistics } from '@graphql/queries/statistics'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
let currentUser
|
||||
@ -49,7 +50,7 @@ describe('statistics', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('authenticated as user ', () => {
|
||||
describe('authenticated as user', () => {
|
||||
beforeEach(async () => {
|
||||
currentUser = await database.neode.create('User', {
|
||||
name: 'Current User',
|
||||
@ -66,7 +67,7 @@ describe('statistics', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('authenticated as moderator ', () => {
|
||||
describe('authenticated as moderator', () => {
|
||||
beforeEach(async () => {
|
||||
currentUser = await database.neode.create('User', {
|
||||
name: 'Current User',
|
||||
@ -84,7 +85,7 @@ describe('statistics', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('authenticated as admin ', () => {
|
||||
describe('authenticated as admin', () => {
|
||||
beforeEach(async () => {
|
||||
currentUser = await database.neode.create('User', {
|
||||
name: 'Current User',
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/dot-notation */
|
||||
import { Context } from '@src/context'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
export default {
|
||||
Query: {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
export default {
|
||||
Query: {
|
||||
userData: async (_object, _args, context, _resolveInfo) => {
|
||||
|
||||
@ -6,6 +6,9 @@
|
||||
/* eslint-disable promise/prefer-await-to-callbacks */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable jest/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
/* eslint-disable jest/expect-expect */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { verify } from 'jsonwebtoken'
|
||||
|
||||
import { categories } from '@constants/categories'
|
||||
@ -16,9 +19,10 @@ import { login } from '@graphql/queries/login'
|
||||
import { saveCategorySettings } from '@graphql/queries/saveCategorySettings'
|
||||
import { decode } from '@jwt/decode'
|
||||
import { encode } from '@jwt/encode'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup, TEST_CONFIG } from '@root/test/helpers'
|
||||
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
const jwt = { verify }
|
||||
let variables, req, user
|
||||
let mutate: ApolloTestSetup['mutate']
|
||||
@ -265,7 +269,7 @@ describe('login', () => {
|
||||
})
|
||||
|
||||
describe('normalization', () => {
|
||||
describe('email address is a gmail address ', () => {
|
||||
describe('email address is a gmail address', () => {
|
||||
beforeEach(async () => {
|
||||
const email = await database.neode.first(
|
||||
'EmailAddress',
|
||||
|
||||
@ -7,10 +7,11 @@ import bcrypt from 'bcryptjs'
|
||||
|
||||
import { getNeode } from '@db/neo4j'
|
||||
import { encode } from '@jwt/encode'
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
import normalizeEmail from './helpers/normalizeEmail'
|
||||
|
||||
import type { Context } from '@src/context'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
export default {
|
||||
|
||||
@ -3,10 +3,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { categories } from '@constants/categories'
|
||||
import pubsubContext from '@context/pubsub'
|
||||
import Factory, { cleanDatabase } from '@db/factories'
|
||||
import User from '@db/models/User'
|
||||
import { DeleteUser } from '@graphql/queries/DeleteUser'
|
||||
import { resetTrophyBadgesSelected } from '@graphql/queries/resetTrophyBadgesSelected'
|
||||
import { saveCategorySettings } from '@graphql/queries/saveCategorySettings'
|
||||
@ -15,8 +16,10 @@ import { switchUserRole } from '@graphql/queries/switchUserRole'
|
||||
import { updateOnlineStatus } from '@graphql/queries/updateOnlineStatus'
|
||||
import { UpdateUser } from '@graphql/queries/UpdateUser'
|
||||
import { UserEmailNotificationSettings, User as userQuery } from '@graphql/queries/User'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import { createApolloTestSetup } from '@root/test/helpers'
|
||||
|
||||
import type User from '@db/models/User'
|
||||
import type { ApolloTestSetup } from '@root/test/helpers'
|
||||
import type { Context } from '@src/context'
|
||||
import type { DecodedUser } from '@src/jwt/decode'
|
||||
// import CONFIG from '@src/config'
|
||||
|
||||
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