mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
refactor code to satisfy biome rules, remove eslint rule comments
This commit is contained in:
parent
9c5cc3b29a
commit
90b8dbcc7b
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
**/*.min.js
|
||||
build
|
||||
coverage
|
||||
@ -1,213 +0,0 @@
|
||||
// eslint-disable-next-line import/no-commonjs, import/unambiguous
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['prettier', '@typescript-eslint', 'type-graphql', 'import', 'n', 'promise'],
|
||||
extends: [
|
||||
'standard',
|
||||
'eslint:recommended',
|
||||
'plugin:prettier/recommended',
|
||||
'plugin:import/recommended',
|
||||
'plugin:import/typescript',
|
||||
'plugin:security/recommended',
|
||||
'plugin:@eslint-community/eslint-comments/recommended',
|
||||
],
|
||||
settings: {
|
||||
'import/parsers': {
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||
},
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
project: ['./tsconfig.json', '**/tsconfig.json'],
|
||||
},
|
||||
node: true,
|
||||
},
|
||||
// the parser cannot handle the split sodium import
|
||||
'import/ignore': ['sodium-native'],
|
||||
},
|
||||
rules: {
|
||||
'no-console': 'error',
|
||||
camelcase: ['error', { allow: ['FederationClient_*', 'crypto_*', 'randombytes_random'] }],
|
||||
'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': 'error',
|
||||
'import/default': 'error',
|
||||
'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: ['@/*', 'random-bigint', 'sodium-native'] },
|
||||
],
|
||||
'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': 'error',
|
||||
'import/no-default-export': 'error',
|
||||
'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/handle-callback-err': 'error',
|
||||
'n/no-callback-literal': 'error',
|
||||
'n/no-exports-assign': 'error',
|
||||
'n/no-extraneous-import': 'error',
|
||||
'n/no-extraneous-require': 'error',
|
||||
'n/no-hide-core-modules': 'error',
|
||||
'n/no-missing-import': 'off', // not compatible with typescript
|
||||
'n/no-missing-require': 'error',
|
||||
'n/no-new-require': 'error',
|
||||
'n/no-path-concat': 'error',
|
||||
'n/no-process-exit': 'error',
|
||||
'n/no-unpublished-bin': 'error',
|
||||
'n/no-unpublished-import': 'off', // TODO need to exclude seeds
|
||||
'n/no-unpublished-require': 'error',
|
||||
'n/no-unsupported-features': ['error', { ignores: ['modules'] }],
|
||||
'n/no-unsupported-features/es-builtins': 'error',
|
||||
'n/no-unsupported-features/es-syntax': 'error',
|
||||
'n/no-unsupported-features/node-builtins': 'error',
|
||||
'n/process-exit-as-throw': 'error',
|
||||
'n/shebang': 'error',
|
||||
'n/callback-return': 'error',
|
||||
'n/exports-style': 'error',
|
||||
'n/file-extension-in-import': 'off',
|
||||
'n/global-require': 'error',
|
||||
'n/no-mixed-requires': 'error',
|
||||
'n/no-process-env': 'error',
|
||||
'n/no-restricted-import': 'error',
|
||||
'n/no-restricted-require': 'error',
|
||||
'n/no-sync': 'error',
|
||||
'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-promises/dns': 'error',
|
||||
'n/prefer-promises/fs': 'error',
|
||||
// promise
|
||||
'promise/catch-or-return': 'error',
|
||||
'promise/no-return-wrap': 'error',
|
||||
'promise/param-names': 'error',
|
||||
'promise/always-return': 'error',
|
||||
'promise/no-native': 'off',
|
||||
'promise/no-nesting': 'warn',
|
||||
'promise/no-promise-in-callback': 'warn',
|
||||
'promise/no-callback-in-promise': 'warn',
|
||||
'promise/avoid-new': 'warn',
|
||||
'promise/no-new-statics': 'error',
|
||||
'promise/no-return-in-finally': 'warn',
|
||||
'promise/valid-params': 'warn',
|
||||
'promise/prefer-await-to-callbacks': 'error',
|
||||
'promise/no-multiple-resolved': 'error',
|
||||
// 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: [
|
||||
// only for ts files
|
||||
{
|
||||
files: ['*.ts', '*.tsx'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
'plugin:@typescript-eslint/strict',
|
||||
'plugin:type-graphql/recommended',
|
||||
],
|
||||
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',
|
||||
},
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: ['./tsconfig.json', '**/tsconfig.json'],
|
||||
// this is to properly reference the referenced project database without requirement of compiling it
|
||||
// eslint-disable-next-line camelcase
|
||||
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.test.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',
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
printWidth: 100,
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: false,
|
||||
singleQuote: true,
|
||||
quoteProps: "as-needed",
|
||||
jsxSingleQuote: true,
|
||||
trailingComma: "all",
|
||||
bracketSpacing: true,
|
||||
bracketSameLine: false,
|
||||
arrowParens: "always",
|
||||
endOfLine: "auto",
|
||||
};
|
||||
@ -57,6 +57,20 @@
|
||||
"fileNameSep" : "_",
|
||||
"numBackups" : 30
|
||||
},
|
||||
"gms":
|
||||
{
|
||||
"type": "dateFile",
|
||||
"filename": "../logs/backend/gms.log",
|
||||
"pattern": "yyyy-MM-dd",
|
||||
"layout":
|
||||
{
|
||||
"type": "pattern", "pattern": "%d{ISO8601} %p %c [%X{user}] [%f : %l] - %m"
|
||||
},
|
||||
"compress": true,
|
||||
"keepFileExt" : true,
|
||||
"fileNameSep" : "_",
|
||||
"numBackups" : 30
|
||||
},
|
||||
"errorFile":
|
||||
{
|
||||
"type": "dateFile",
|
||||
@ -137,6 +151,16 @@
|
||||
"level": "debug",
|
||||
"enableCallStack": true
|
||||
},
|
||||
"gms":
|
||||
{
|
||||
"appenders":
|
||||
[
|
||||
"gms",
|
||||
"errors"
|
||||
],
|
||||
"level": "debug",
|
||||
"enableCallStack": true
|
||||
},
|
||||
"http":
|
||||
{
|
||||
"appenders":
|
||||
|
||||
@ -12,7 +12,8 @@
|
||||
"clean": "tsc --build --clean",
|
||||
"start": "cross-env TZ=UTC TS_NODE_BASEURL=./build node -r tsconfig-paths/register build/src/index.js",
|
||||
"dev": "cross-env TZ=UTC nodemon -w src --ext ts,pug,json,css --exec ts-node -r tsconfig-paths/register src/index.ts",
|
||||
"lint": "eslint --max-warnings=0 .",
|
||||
"lint": "biome check --error-on-warnings .",
|
||||
"lint:fix": "biome check --error-on-warnings . --write",
|
||||
"test": "cross-env TZ=UTC NODE_ENV=development jest --runInBand --forceExit --detectOpenHandles",
|
||||
"seed": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/seeds/index.ts",
|
||||
"klicktipp": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/util/executeKlicktipp.ts",
|
||||
@ -59,7 +60,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^3.2.1",
|
||||
"@types/email-templates": "^10.0.1",
|
||||
"@types/express": "^4.17.12",
|
||||
"@types/faker": "^5.5.9",
|
||||
@ -71,20 +71,7 @@
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/sodium-native": "^2.3.5",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"apollo-server-testing": "^2.25.2",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.4",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-n": "^15.7.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-security": "^1.7.1",
|
||||
"eslint-plugin-type-graphql": "^1.0.0",
|
||||
"faker": "^5.5.3",
|
||||
"graphql-tag": "^2.12.6",
|
||||
"jest": "^27.2.4",
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import axios from 'axios'
|
||||
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
@ -1,13 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { CONFIG } from '@/config'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
// eslint-disable-next-line import/no-relative-parent-imports
|
||||
import KlicktippConnector from 'klicktipp-api'
|
||||
|
||||
const klicktippConnector = new KlicktippConnector()
|
||||
@ -18,7 +11,9 @@ export const subscribe = async (
|
||||
firstName?: string,
|
||||
lastName?: string,
|
||||
): Promise<boolean> => {
|
||||
if (!CONFIG.KLICKTIPP) return true
|
||||
if (!CONFIG.KLICKTIPP) {
|
||||
return true
|
||||
}
|
||||
const fields = {
|
||||
fieldFirstName: firstName,
|
||||
fieldLastName: lastName,
|
||||
@ -29,7 +24,9 @@ export const subscribe = async (
|
||||
}
|
||||
|
||||
export const unsubscribe = async (email: string): Promise<boolean> => {
|
||||
if (!CONFIG.KLICKTIPP) return true
|
||||
if (!CONFIG.KLICKTIPP) {
|
||||
return true
|
||||
}
|
||||
const isLogin = await loginKlicktippUser()
|
||||
if (isLogin) {
|
||||
return await klicktippConnector.unsubscribe(email)
|
||||
@ -38,12 +35,14 @@ export const unsubscribe = async (email: string): Promise<boolean> => {
|
||||
}
|
||||
|
||||
export const getKlickTippUser = async (email: string): Promise<any> => {
|
||||
if (!CONFIG.KLICKTIPP) return true
|
||||
if (!CONFIG.KLICKTIPP) {
|
||||
return true
|
||||
}
|
||||
const isLogin = await loginKlicktippUser()
|
||||
if (isLogin) {
|
||||
try {
|
||||
return klicktippConnector.subscriberGet(await klicktippConnector.subscriberSearch(email))
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
logger.error('Could not find subscriber', email)
|
||||
return false
|
||||
}
|
||||
@ -52,7 +51,9 @@ export const getKlickTippUser = async (email: string): Promise<any> => {
|
||||
}
|
||||
|
||||
export const loginKlicktippUser = async (): Promise<boolean> => {
|
||||
if (!CONFIG.KLICKTIPP) return true
|
||||
if (!CONFIG.KLICKTIPP) {
|
||||
return true
|
||||
}
|
||||
return await klicktippConnector.login(CONFIG.KLICKTIPP_USER, CONFIG.KLICKTIPP_PASSWORD)
|
||||
}
|
||||
|
||||
@ -62,7 +63,9 @@ export const addFieldsToSubscriber = async (
|
||||
newemail = '',
|
||||
newsmsnumber = '',
|
||||
) => {
|
||||
if (!CONFIG.KLICKTIPP) return true
|
||||
if (!CONFIG.KLICKTIPP) {
|
||||
return true
|
||||
}
|
||||
const isLogin = await loginKlicktippUser()
|
||||
if (isLogin) {
|
||||
try {
|
||||
|
||||
@ -1,8 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable security/detect-object-injection */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ -34,16 +34,15 @@ function getTransactionTypeString(id: TransactionTypeId): string {
|
||||
* A Singleton class defines the `getInstance` method that lets clients access
|
||||
* the unique singleton instance.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
||||
|
||||
export class DltConnectorClient {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
private static instance: DltConnectorClient
|
||||
client: GraphQLClient
|
||||
/**
|
||||
* The Singleton's constructor should always be private to prevent direct
|
||||
* construction calls with the `new` operator.
|
||||
*/
|
||||
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
||||
|
||||
private constructor() {}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,9 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
|
||||
import { User as DbUser } from '@entity/User'
|
||||
// import { createTestClient } from 'apollo-server-testing'
|
||||
|
||||
@ -13,29 +7,28 @@ import { CONFIG } from '@/config'
|
||||
import { getHomeCommunity } from '@/graphql/resolver/util/communities'
|
||||
import { sendUserToGms } from '@/graphql/resolver/util/sendUserToGms'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { createServer } from '@/server/createServer'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { checkDBVersion } from '@/typeorm/DBVersion'
|
||||
import { Connection } from '@/typeorm/connection'
|
||||
|
||||
CONFIG.EMAIL = false
|
||||
// use force to copy over all user even if gmsRegistered is set to true
|
||||
const forceMode = process.argv.includes('--force')
|
||||
|
||||
const context = {
|
||||
token: '',
|
||||
setHeaders: {
|
||||
push: (value: { key: string; value: string }): void => {
|
||||
context.token = value.value
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
forEach: (): void => {},
|
||||
},
|
||||
clientTimezoneOffset: 0,
|
||||
}
|
||||
async function main() {
|
||||
// open mysql connection
|
||||
const con = await Connection.getInstance()
|
||||
if (!con?.isConnected) {
|
||||
logger.fatal(`Couldn't open connection to database!`)
|
||||
throw new Error(`Fatal: Couldn't open connection to database`)
|
||||
}
|
||||
|
||||
const run = async () => {
|
||||
const server = await createServer(context)
|
||||
// const seedClient = createTestClient(server.apollo)
|
||||
const { con } = server
|
||||
// check for correct database version
|
||||
const dbVersion = await checkDBVersion(CONFIG.DB_VERSION)
|
||||
if (!dbVersion) {
|
||||
logger.fatal('Fatal: Database Version incorrect')
|
||||
throw new Error('Fatal: Database Version incorrect')
|
||||
}
|
||||
|
||||
const homeCom = await getHomeCommunity()
|
||||
if (homeCom.gmsApiKey === null) {
|
||||
@ -63,7 +56,7 @@ const run = async () => {
|
||||
/*
|
||||
const gmsUser = new GmsUser(user)
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
|
||||
if (await createGmsUser(homeCom.gmsApiKey, gmsUser)) {
|
||||
logger.debug('GMS user published successfully:', gmsUser)
|
||||
user.gmsRegistered = true
|
||||
@ -84,7 +77,11 @@ const run = async () => {
|
||||
}
|
||||
logger.info('##gms## publishing all local users successful...')
|
||||
|
||||
await con.close()
|
||||
await con.destroy()
|
||||
}
|
||||
|
||||
void run()
|
||||
main().catch((e) => {
|
||||
// biome-ignore lint/suspicious/noConsole: logger isn't used here
|
||||
console.error(e)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import axios from 'axios'
|
||||
|
||||
import { httpAgent, httpsAgent } from '@/apis/ConnectionAgents'
|
||||
@ -10,7 +6,7 @@ import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { ensureUrlEndsWithSlash } from '@/util/utilities'
|
||||
|
||||
import { GmsUser } from './model/GmsUser'
|
||||
import type { GmsUser } from './model/GmsUser'
|
||||
|
||||
/*
|
||||
export async function communityList(): Promise<GmsCommunity[] | string | undefined> {
|
||||
@ -33,10 +29,10 @@ export async function communityList(): Promise<GmsCommunity[] | string | undefin
|
||||
throw new LogError('HTTP Status Error in community/list:', result.status, result.statusText)
|
||||
}
|
||||
logger.debug('responseData:', result.data.responseData.data)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
|
||||
// const gmsCom = JSON.parse(result.data.responseData.data)
|
||||
// logger.debug('gmsCom:', gmsCom)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
|
||||
return result.data.responseData.data
|
||||
} catch (error: any) {
|
||||
logger.error('Error in Get community/list:', error)
|
||||
@ -69,10 +65,10 @@ export async function userList(): Promise<GmsUser[] | string | undefined> {
|
||||
)
|
||||
}
|
||||
logger.debug('responseData:', result.data.responseData.data)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
|
||||
// const gmsUser = JSON.parse(result.data.responseData.data)
|
||||
// logger.debug('gmsUser:', gmsUser)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
|
||||
return result.data.responseData.data
|
||||
} catch (error: any) {
|
||||
logger.error('Error in Get community-user/list:', error)
|
||||
@ -105,10 +101,10 @@ export async function userByUuid(uuid: string): Promise<GmsUser[] | string | und
|
||||
)
|
||||
}
|
||||
logger.debug('responseData:', result.data.responseData.data)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
|
||||
// const gmsUser = JSON.parse(result.data.responseData.data)
|
||||
// logger.debug('gmsUser:', gmsUser)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
|
||||
return result.data.responseData.data
|
||||
} catch (error: any) {
|
||||
logger.error('Error in Get community-user/list:', error)
|
||||
@ -139,13 +135,16 @@ export async function createGmsUser(apiKey: string, user: GmsUser): Promise<bool
|
||||
throw new LogError('HTTP Status Error in community-user:', result.status, result.statusText)
|
||||
}
|
||||
logger.debug('responseData:', result.data.responseData)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
|
||||
// const gmsUser = JSON.parse(result.data.responseData)
|
||||
// logger.debug('gmsUser:', gmsUser)
|
||||
return true
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error in post community-user:', error)
|
||||
throw new LogError(error.message)
|
||||
if (error instanceof Error) {
|
||||
throw new LogError(error.message)
|
||||
}
|
||||
throw new LogError('Unknown error in post community-user')
|
||||
}
|
||||
} else {
|
||||
logger.info('GMS-Communication disabled per ConfigKey GMS_ACTIVE=false!')
|
||||
@ -174,13 +173,16 @@ export async function updateGmsUser(apiKey: string, user: GmsUser): Promise<bool
|
||||
throw new LogError('HTTP Status Error in community-user:', result.status, result.statusText)
|
||||
}
|
||||
logger.debug('responseData:', result.data.responseData)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
|
||||
// const gmsUser = JSON.parse(result.data.responseData)
|
||||
// logger.debug('gmsUser:', gmsUser)
|
||||
return true
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error in patch community-user:', error)
|
||||
throw new LogError(error.message)
|
||||
if (error instanceof Error) {
|
||||
throw new LogError(error.message)
|
||||
}
|
||||
throw new LogError('Unknown error in patch community-user')
|
||||
}
|
||||
} else {
|
||||
logger.info('GMS-Communication disabled per ConfigKey GMS_ACTIVE=false!')
|
||||
@ -194,6 +196,7 @@ export async function verifyAuthToken(
|
||||
token: string,
|
||||
): Promise<string> {
|
||||
const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_API_URL)
|
||||
// TODO: NEVER pass user JWT token to another server - serious security risk! 😱⚠️
|
||||
const service = 'verify-auth-token?token='.concat(token).concat('&uuid=').concat(communityUuid)
|
||||
const config = {
|
||||
headers: {
|
||||
@ -216,12 +219,15 @@ export async function verifyAuthToken(
|
||||
)
|
||||
}
|
||||
logger.debug('responseData:', result.data.responseData)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
|
||||
const token: string = result.data.responseData.token
|
||||
logger.debug('verifyAuthToken=', token)
|
||||
return token
|
||||
} catch (error: any) {
|
||||
} catch (error: unknown) {
|
||||
logger.error('Error in verifyAuthToken:', error)
|
||||
throw new LogError(error.message)
|
||||
if (error instanceof Error) {
|
||||
throw new LogError(error.message)
|
||||
}
|
||||
throw new LogError('Unknown error in verifyAuthToken')
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ export class GmsCommunityProfile {
|
||||
communityId: number
|
||||
radius: number
|
||||
description: string
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
api_key: string
|
||||
communityAuthUrl: unknown
|
||||
profileImage: unknown
|
||||
|
||||
@ -11,7 +11,7 @@ export class GmsUserAccount {
|
||||
address: string
|
||||
radius: number
|
||||
description: string
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
api_key: string
|
||||
profileImage: unknown
|
||||
}
|
||||
|
||||
@ -8,8 +8,8 @@ import { checkDBVersion } from '@/typeorm/DBVersion'
|
||||
import { Connection } from '@/typeorm/connection'
|
||||
|
||||
import { HumHubClient } from './HumHubClient'
|
||||
import { GetUser } from './model/GetUser'
|
||||
import { UsersResponse } from './model/UsersResponse'
|
||||
import type { GetUser } from './model/GetUser'
|
||||
import type { UsersResponse } from './model/UsersResponse'
|
||||
import { ExecutedHumhubAction, syncUser } from './syncUser'
|
||||
|
||||
const USER_BULK_SIZE = 20
|
||||
@ -39,14 +39,14 @@ async function loadUsersFromHumHub(client: HumHubClient): Promise<Map<string, Ge
|
||||
if (!usersPage) {
|
||||
throw new LogError('error requesting next users page from humhub')
|
||||
}
|
||||
usersPage.results.forEach((user) => {
|
||||
for (const user of usersPage.results) {
|
||||
// deleted users have empty emails
|
||||
if (user.account.email) {
|
||||
humhubUsers.set(user.account.email.trim(), user)
|
||||
} else {
|
||||
skippedUsersCount++
|
||||
}
|
||||
})
|
||||
}
|
||||
page++
|
||||
process.stdout.write(
|
||||
`load users from humhub: ${humhubUsers.size}/${usersPage.total}, skipped: ${skippedUsersCount}\r`,
|
||||
@ -95,11 +95,13 @@ async function main() {
|
||||
userCount = users.length
|
||||
page++
|
||||
const promises: Promise<ExecutedHumhubAction>[] = []
|
||||
users.forEach((user: User) => promises.push(syncUser(user, humhubUsers)))
|
||||
for (const user of users) {
|
||||
promises.push(syncUser(user, humhubUsers))
|
||||
}
|
||||
const executedActions = await Promise.all(promises)
|
||||
executedActions.forEach((executedAction: ExecutedHumhubAction) => {
|
||||
for (const executedAction of executedActions) {
|
||||
executedHumhubActionsCount[executedAction as number]++
|
||||
})
|
||||
}
|
||||
// using process.stdout.write here so that carriage-return is working analog to c
|
||||
// printf("\rchecked user: %d/%d", dbUserCount, totalUsers);
|
||||
process.stdout.write(`checked user: ${dbUserCount}/${totalUsers}\r`)
|
||||
@ -118,8 +120,7 @@ async function main() {
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
// eslint-disable-next-line no-console
|
||||
// biome-ignore lint/suspicious/noConsole: logger isn't used here
|
||||
console.error(e)
|
||||
// eslint-disable-next-line n/no-process-exit
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
@ -17,11 +17,9 @@ import { UsersResponse } from './model/UsersResponse'
|
||||
* HumHubClient as singleton class
|
||||
*/
|
||||
export class HumHubClient {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
private static instance: HumHubClient
|
||||
private restClient: RestClient
|
||||
|
||||
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
||||
private constructor() {
|
||||
this.restClient = new RestClient('gradido-backend', CONFIG.HUMHUB_API_URL, undefined, {
|
||||
keepAlive: true,
|
||||
|
||||
@ -10,10 +10,8 @@ import { UsersResponse } from '@/apis/humhub/model/UsersResponse'
|
||||
* HumHubClient as singleton class
|
||||
*/
|
||||
export class HumHubClient {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
private static instance: HumHubClient
|
||||
|
||||
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
||||
private constructor() {}
|
||||
|
||||
public static getInstance(): HumHubClient {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable prettier/prettier */
|
||||
import { communityDbUser } from '@/util/communityUser'
|
||||
|
||||
import { isHumhubUserIdenticalToDbUser } from './compareHumhubUserDbUser'
|
||||
@ -56,7 +55,7 @@ describe('isHumhubUserIdenticalToDbUser', () => {
|
||||
|
||||
it('Should return false because gradido_address differ', () => {
|
||||
const humhubUser = new GetUser(defaultUser, 1)
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
humhubUser.profile.gradido_address = 'changed gradido address'
|
||||
const result = isHumhubUserIdenticalToDbUser(humhubUser, defaultUser)
|
||||
expect(result).toBe(false)
|
||||
|
||||
@ -1,23 +1,37 @@
|
||||
import { User } from '@entity/User'
|
||||
import type { User } from '@entity/User'
|
||||
|
||||
import { Account } from './model/Account'
|
||||
import { GetUser } from './model/GetUser'
|
||||
import type { GetUser } from './model/GetUser'
|
||||
import { Profile } from './model/Profile'
|
||||
|
||||
function profileIsTheSame(profile: Profile, user: User): boolean {
|
||||
const gradidoUserProfile = new Profile(user)
|
||||
if (profile.firstname !== gradidoUserProfile.firstname) return false
|
||||
if (profile.lastname !== gradidoUserProfile.lastname) return false
|
||||
if (profile.gradido_address !== gradidoUserProfile.gradido_address) return false
|
||||
if (profile.firstname !== gradidoUserProfile.firstname) {
|
||||
return false
|
||||
}
|
||||
if (profile.lastname !== gradidoUserProfile.lastname) {
|
||||
return false
|
||||
}
|
||||
if (profile.gradido_address !== gradidoUserProfile.gradido_address) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function accountIsTheSame(account: Account, user: User): boolean {
|
||||
const gradidoUserAccount = new Account(user)
|
||||
if (account.username !== gradidoUserAccount.username) return false
|
||||
if (account.email !== gradidoUserAccount.email) return false
|
||||
if (account.language !== gradidoUserAccount.language) return false
|
||||
if (account.status !== gradidoUserAccount.status) return false
|
||||
if (account.username !== gradidoUserAccount.username) {
|
||||
return false
|
||||
}
|
||||
if (account.email !== gradidoUserAccount.email) {
|
||||
return false
|
||||
}
|
||||
if (account.language !== gradidoUserAccount.language) {
|
||||
return false
|
||||
}
|
||||
if (account.status !== gradidoUserAccount.status) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ export class ProfileLoggingView extends AbstractLoggingView {
|
||||
return {
|
||||
firstname: this.self.firstname.substring(0, 3) + '...',
|
||||
lastname: this.self.lastname.substring(0, 3) + '...',
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
gradido_address:
|
||||
gradidoAddressParts[0] + '/' + gradidoAddressParts[1].substring(0, 3) + '...',
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable camelcase */
|
||||
import { User } from '@entity/User'
|
||||
|
||||
import { convertGradidoLanguageToHumhub } from '@/apis/humhub/convertLanguage'
|
||||
|
||||
@ -10,6 +10,6 @@ export class GetUser extends AbstractUser {
|
||||
|
||||
id: number
|
||||
guid: string
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
display_name: string
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable camelcase */
|
||||
import { User } from '@entity/User'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { User } from '@entity/User'
|
||||
import { UserContact } from '@entity/UserContact'
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable camelcase */
|
||||
import { OpenaiThreads } from '@entity/OpenaiThreads'
|
||||
import { User } from '@entity/User'
|
||||
import { OpenAI } from 'openai'
|
||||
@ -18,7 +17,7 @@ export class OpenaiClient {
|
||||
/**
|
||||
* The singleton instance of the `OpenaiClient`.
|
||||
*/
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
private static instance: OpenaiClient
|
||||
|
||||
/**
|
||||
|
||||
@ -6,7 +6,9 @@ import { LogError } from '@/server/LogError'
|
||||
import { CustomJwtPayload } from './CustomJwtPayload'
|
||||
|
||||
export const decode = async (token: string): Promise<CustomJwtPayload | null> => {
|
||||
if (!token) throw new LogError('401 Unauthorized')
|
||||
if (!token) {
|
||||
throw new LogError('401 Unauthorized')
|
||||
}
|
||||
|
||||
try {
|
||||
const secret = new TextEncoder().encode(CONFIG.JWT_SECRET)
|
||||
@ -15,7 +17,7 @@ export const decode = async (token: string): Promise<CustomJwtPayload | null> =>
|
||||
audience: 'urn:gradido:audience',
|
||||
})
|
||||
return payload as CustomJwtPayload
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
|
||||
/* eslint-disable n/no-process-env */
|
||||
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import { validate } from '@config/index'
|
||||
import { latestDbVersion } from '@dbTools/config/detectLastDBVersion'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
@ -89,8 +87,8 @@ const email = {
|
||||
EMAIL_PASSWORD: process.env.EMAIL_PASSWORD ?? '',
|
||||
EMAIL_SMTP_HOST: process.env.EMAIL_SMTP_HOST ?? 'mailserver',
|
||||
EMAIL_SMTP_PORT: Number(process.env.EMAIL_SMTP_PORT) || 1025,
|
||||
// eslint-disable-next-line no-unneeded-ternary
|
||||
EMAIL_TLS: process.env.EMAIL_TLS === 'false' ? false : true,
|
||||
|
||||
EMAIL_TLS: process.env.EMAIL_TLS !== 'false',
|
||||
EMAIL_LINK_VERIFICATION:
|
||||
COMMUNITY_URL + (process.env.EMAIL_LINK_VERIFICATION_PATH ?? '/checkEmail/'),
|
||||
EMAIL_LINK_SETPASSWORD:
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import {
|
||||
COMMUNITY_DESCRIPTION,
|
||||
COMMUNITY_NAME,
|
||||
@ -61,7 +59,6 @@ export const schema = Joi.object({
|
||||
.description('The url for redeeming link transactions, must start with frontend base url')
|
||||
.default('http://0.0.0.0/redeem/')
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
@ -72,7 +69,6 @@ export const schema = Joi.object({
|
||||
COMMUNITY_REDEEM_CONTRIBUTION_URL: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
@ -168,7 +164,6 @@ export const schema = Joi.object({
|
||||
EMAIL_LINK_VERIFICATION: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
@ -180,7 +175,6 @@ export const schema = Joi.object({
|
||||
EMAIL_LINK_SETPASSWORD: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
@ -192,7 +186,6 @@ export const schema = Joi.object({
|
||||
EMAIL_LINK_FORGOTPASSWORD: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
@ -204,7 +197,6 @@ export const schema = Joi.object({
|
||||
EMAIL_LINK_OVERVIEW: Joi.string()
|
||||
.uri({ scheme: ['http', 'https'] })
|
||||
.custom((value: string, helpers: Joi.CustomHelpers<string>): string | Joi.ErrorReport => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
||||
if (!value.startsWith(helpers.state.ancestors[0].COMMUNITY_URL)) {
|
||||
return helpers.error('string.pattern.base', { value, communityUrl: COMMUNITY_URL })
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@ import { User } from '@entity/User'
|
||||
|
||||
import { ContributionMessageType } from '@/graphql/enum/ContributionMessageType'
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
||||
export class ContributionMessageBuilder {
|
||||
private contributionMessage: ContributionMessage
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@ export class PublishNameLogic {
|
||||
|
||||
// remove character which are invalid for humhub username
|
||||
private filterOutInvalidChar(name: string) {
|
||||
// eslint-disable-next-line import/no-named-as-default-member
|
||||
return XRegExp.match(name, this.usernameRegex, 'all').join('')
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { createTransport } from 'nodemailer'
|
||||
|
||||
import { i18n, logger } from '@test/testSetup'
|
||||
@ -103,12 +102,10 @@ describe('sendEmailTranslated', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
it.skip('calls "i18n.setLocale" with "en"', () => {
|
||||
expect(i18n.setLocale).toBeCalledWith('en')
|
||||
})
|
||||
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
it.skip('calls "i18n.__" for translation', () => {
|
||||
expect(i18n.__).toBeCalled()
|
||||
})
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import path from 'path'
|
||||
|
||||
import Email from 'email-templates'
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
@ -11,7 +7,6 @@ import { i18n as localization, logger } from '@test/testSetup'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
// eslint-disable-next-line import/no-namespace
|
||||
import * as sendEmailTranslatedApi from './sendEmailTranslated'
|
||||
import {
|
||||
sendAccountActivationEmail,
|
||||
@ -69,7 +64,6 @@ afterAll(async () => {
|
||||
const sendEmailTranslatedSpy = jest.spyOn(sendEmailTranslatedApi, 'sendEmailTranslated')
|
||||
|
||||
describe('sendEmailVariants', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let result: any
|
||||
|
||||
describe('sendAddedContributionMessageEmail', () => {
|
||||
|
||||
@ -3,7 +3,7 @@ import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCom
|
||||
import { validate as validateUUID, version as versionUUID } from 'uuid'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
import { AuthenticationClient as V1_0_AuthenticationClient } from '@/federation/client/1_0/AuthenticationClient'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { ensureUrlEndsWithSlash } from '@/util/utilities'
|
||||
@ -35,7 +35,7 @@ export async function startCommunityAuthentication(
|
||||
) {
|
||||
try {
|
||||
const client = AuthenticationClientFactory.getInstance(foreignFedCom)
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
if (client instanceof V1_0_AuthenticationClient) {
|
||||
const args = new OpenConnectionArgs()
|
||||
args.publicKey = homeCom.publicKey.toString('hex')
|
||||
|
||||
@ -132,7 +132,7 @@ export class SendCoinsClient {
|
||||
{ args },
|
||||
)
|
||||
logger.debug(`X-Com: SendCoinsClient: after revertSettledSendCoins: data=`, data)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
|
||||
if (!data?.revertSettledSendCoins) {
|
||||
logger.warn(
|
||||
'X-Com: SendCoinsClient: revertSettledSendCoins without response data from endpoint',
|
||||
|
||||
@ -7,7 +7,6 @@ export class PublicCommunityInfoLoggingView extends AbstractLoggingView {
|
||||
super()
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public toJSON(): any {
|
||||
return {
|
||||
name: this.self.name,
|
||||
|
||||
@ -7,7 +7,6 @@ export class SendCoinsArgsLoggingView extends AbstractLoggingView {
|
||||
super()
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public toJSON(): any {
|
||||
return {
|
||||
recipientCommunityUuid: this.self.recipientCommunityUuid,
|
||||
|
||||
@ -7,7 +7,6 @@ export class SendCoinsResultLoggingView extends AbstractLoggingView {
|
||||
super()
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public toJSON(): any {
|
||||
return {
|
||||
vote: this.self.vote,
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import { Field, ObjectType } from 'type-graphql'
|
||||
|
||||
@ObjectType()
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export class GetPublicKeyResult {
|
||||
constructor(pubKey: string) {
|
||||
this.publicKey = pubKey
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
// eslint-disable-next-line camelcase
|
||||
import { AuthenticationClient as V1_0_AuthenticationClient } from '@/federation/client/1_0/AuthenticationClient'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
export class AuthenticationClient extends V1_0_AuthenticationClient {}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
// eslint-disable-next-line camelcase
|
||||
import { FederationClient as V1_0_FederationClient } from '@/federation/client/1_0/FederationClient'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
export class FederationClient extends V1_0_FederationClient {}
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
// eslint-disable-next-line camelcase
|
||||
import { SendCoinsClient as V1_0_SendCoinsClient } from '@/federation/client/1_0/SendCoinsClient'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
export class SendCoinsClient extends V1_0_SendCoinsClient {}
|
||||
|
||||
@ -1,21 +1,18 @@
|
||||
import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
import { AuthenticationClient as V1_0_AuthenticationClient } from '@/federation/client/1_0/AuthenticationClient'
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
import { AuthenticationClient as V1_1_AuthenticationClient } from '@/federation/client/1_1/AuthenticationClient'
|
||||
import { ApiVersionType } from '@/federation/enum/apiVersionType'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
type AuthenticationClient = V1_0_AuthenticationClient | V1_1_AuthenticationClient
|
||||
|
||||
interface AuthenticationClientInstance {
|
||||
id: number
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
client: AuthenticationClient
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
||||
export class AuthenticationClientFactory {
|
||||
private static instanceArray: AuthenticationClientInstance[] = []
|
||||
|
||||
@ -23,7 +20,7 @@ export class AuthenticationClientFactory {
|
||||
* The Singleton's constructor should always be private to prevent direct
|
||||
* construction calls with the `new` operator.
|
||||
*/
|
||||
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
||||
|
||||
private constructor() {}
|
||||
|
||||
private static createAuthenticationClient = (dbCom: DbFederatedCommunity) => {
|
||||
|
||||
@ -1,22 +1,19 @@
|
||||
import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
import { FederationClient as V1_0_FederationClient } from '@/federation/client/1_0/FederationClient'
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
import { FederationClient as V1_1_FederationClient } from '@/federation/client/1_1/FederationClient'
|
||||
import { ApiVersionType } from '@/federation/enum/apiVersionType'
|
||||
import { ensureUrlEndsWithSlash } from '@/util/utilities'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
type FederationClient = V1_0_FederationClient | V1_1_FederationClient
|
||||
|
||||
interface FederationClientInstance {
|
||||
id: number
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
client: FederationClient
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
||||
export class FederationClientFactory {
|
||||
private static instanceArray: FederationClientInstance[] = []
|
||||
|
||||
@ -24,7 +21,7 @@ export class FederationClientFactory {
|
||||
* The Singleton's constructor should always be private to prevent direct
|
||||
* construction calls with the `new` operator.
|
||||
*/
|
||||
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
||||
|
||||
private constructor() {}
|
||||
|
||||
private static createFederationClient = (dbCom: DbFederatedCommunity) => {
|
||||
|
||||
@ -1,21 +1,18 @@
|
||||
import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
import { SendCoinsClient as V1_0_SendCoinsClient } from '@/federation/client/1_0/SendCoinsClient'
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
import { SendCoinsClient as V1_1_SendCoinsClient } from '@/federation/client/1_1/SendCoinsClient'
|
||||
import { ApiVersionType } from '@/federation/enum/apiVersionType'
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
type SendCoinsClient = V1_0_SendCoinsClient | V1_1_SendCoinsClient
|
||||
|
||||
interface SendCoinsClientInstance {
|
||||
id: number
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
|
||||
client: SendCoinsClient
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
||||
export class SendCoinsClientFactory {
|
||||
private static instanceArray: SendCoinsClientInstance[] = []
|
||||
|
||||
@ -23,7 +20,7 @@ export class SendCoinsClientFactory {
|
||||
* The Singleton's constructor should always be private to prevent direct
|
||||
* construction calls with the `new` operator.
|
||||
*/
|
||||
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
||||
|
||||
private constructor() {}
|
||||
|
||||
private static createSendCoinsClient = (dbCom: DbFederatedCommunity) => {
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
@ -62,9 +55,8 @@ describe('validate Communities', () => {
|
||||
describe('with one Community of api 1_0 but missing pubKey response', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return { data: {} } as Response<unknown>
|
||||
})
|
||||
const variables1 = {
|
||||
@ -78,7 +70,6 @@ describe('validate Communities', () => {
|
||||
.into(DbFederatedCommunity)
|
||||
.values(variables1)
|
||||
.orUpdate({
|
||||
// eslint-disable-next-line camelcase
|
||||
conflict_target: ['id', 'publicKey', 'apiVersion'],
|
||||
overwrite: ['end_point', 'last_announced_at'],
|
||||
})
|
||||
@ -101,9 +92,8 @@ describe('validate Communities', () => {
|
||||
describe('with one Community of api 1_0 and not matching pubKey', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return {
|
||||
data: {
|
||||
getPublicKey: {
|
||||
@ -123,15 +113,14 @@ describe('validate Communities', () => {
|
||||
.into(DbFederatedCommunity)
|
||||
.values(variables1)
|
||||
.orUpdate({
|
||||
// eslint-disable-next-line camelcase
|
||||
conflict_target: ['id', 'publicKey', 'apiVersion'],
|
||||
overwrite: ['end_point', 'last_announced_at'],
|
||||
})
|
||||
.execute()
|
||||
/*
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
|
||||
return {
|
||||
data: {
|
||||
getPublicCommunityInfo: {
|
||||
@ -183,9 +172,8 @@ describe('validate Communities', () => {
|
||||
describe('with one Community of api 1_0 and matching pubKey', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return {
|
||||
data: {
|
||||
getPublicKey: {
|
||||
@ -205,7 +193,6 @@ describe('validate Communities', () => {
|
||||
.into(DbFederatedCommunity)
|
||||
.values(variables1)
|
||||
.orUpdate({
|
||||
// eslint-disable-next-line camelcase
|
||||
conflict_target: ['id', 'publicKey', 'apiVersion'],
|
||||
overwrite: ['end_point', 'last_announced_at'],
|
||||
})
|
||||
@ -251,9 +238,8 @@ describe('validate Communities', () => {
|
||||
describe('with two Communities of api 1_0 and 1_1', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return {
|
||||
data: {
|
||||
getPublicKey: {
|
||||
@ -273,7 +259,6 @@ describe('validate Communities', () => {
|
||||
.into(DbFederatedCommunity)
|
||||
.values(variables2)
|
||||
.orUpdate({
|
||||
// eslint-disable-next-line camelcase
|
||||
conflict_target: ['id', 'publicKey', 'apiVersion'],
|
||||
overwrite: ['end_point', 'last_announced_at'],
|
||||
})
|
||||
@ -303,9 +288,8 @@ describe('validate Communities', () => {
|
||||
let dbCom: DbFederatedCommunity
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return {
|
||||
data: {
|
||||
getPublicKey: {
|
||||
@ -325,7 +309,6 @@ describe('validate Communities', () => {
|
||||
.into(DbFederatedCommunity)
|
||||
.values(variables3)
|
||||
.orUpdate({
|
||||
// eslint-disable-next-line camelcase
|
||||
conflict_target: ['id', 'publicKey', 'apiVersion'],
|
||||
overwrite: ['end_point', 'last_announced_at'],
|
||||
})
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/** eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/** eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { IsNull } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity'
|
||||
@ -27,8 +25,8 @@ export async function startValidateCommunities(timerInterval: number): Promise<v
|
||||
|
||||
// TODO: replace the timer-loop by an event-based communication to verify announced foreign communities
|
||||
// better to use setTimeout twice than setInterval once -> see https://javascript.info/settimeout-setinterval
|
||||
setTimeout(function run() {
|
||||
void validateCommunities()
|
||||
setTimeout(async function run() {
|
||||
await validateCommunities()
|
||||
setTimeout(run, timerInterval)
|
||||
}, timerInterval)
|
||||
}
|
||||
@ -55,7 +53,7 @@ export async function validateCommunities(): Promise<void> {
|
||||
}
|
||||
try {
|
||||
const client = FederationClientFactory.getInstance(dbCom)
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
if (client instanceof V1_0_FederationClient) {
|
||||
const pubKey = await client.getPublicKey()
|
||||
if (pubKey && pubKey === dbCom.publicKey.toString('hex')) {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable type-graphql/invalid-nullable-input-type */
|
||||
import { IsEnum, IsPositive } from 'class-validator'
|
||||
import { ArgsType, Field, InputType, Int } from 'type-graphql'
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable type-graphql/invalid-nullable-input-type */
|
||||
import { IsBoolean } from 'class-validator'
|
||||
import { Field, InputType } from 'type-graphql'
|
||||
|
||||
|
||||
@ -21,8 +21,11 @@ export const isAuthorized: AuthChecker<Context> = async ({ context }, rights) =>
|
||||
context.role = ROLE_UNAUTHORIZED // unauthorized user
|
||||
|
||||
// is rights an inalienable right?
|
||||
if ((rights as RIGHTS[]).reduce((acc, right) => acc && INALIENABLE_RIGHTS.includes(right), true))
|
||||
if (
|
||||
(rights as RIGHTS[]).reduce((acc, right) => acc && INALIENABLE_RIGHTS.includes(right), true)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Do we have a token?
|
||||
if (!context.token) {
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Field, Float, Int, ObjectType } from 'type-graphql'
|
||||
|
||||
import { GdtEntryType } from '@enum/GdtEntryType'
|
||||
@ -12,9 +10,9 @@ export class GdtEntry {
|
||||
date,
|
||||
email,
|
||||
comment,
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
coupon_code,
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
gdt_entry_type_id,
|
||||
factor,
|
||||
amount2,
|
||||
@ -26,9 +24,9 @@ export class GdtEntry {
|
||||
this.date = date
|
||||
this.email = email
|
||||
this.comment = comment
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
this.couponCode = coupon_code
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
this.gdtEntryType = gdt_entry_type_id
|
||||
this.factor = factor
|
||||
this.amount2 = amount2
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { IsNull } from '@dbTools/typeorm'
|
||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
/* 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/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity'
|
||||
@ -31,9 +24,9 @@ import { getCommunityByUuid } from './util/communities'
|
||||
jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
// to do: We need a setup for the tests that closes the connection
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let query: ApolloServerTestClient['query']
|
||||
let con: Connection
|
||||
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
@ -24,9 +22,9 @@ import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||
|
||||
jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let query: ApolloServerTestClient['query']
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
|
||||
@ -47,8 +47,12 @@ export class ContributionLinkResolver {
|
||||
dbContributionLink.createdAt = new Date()
|
||||
dbContributionLink.code = contributionLinkCode(dbContributionLink.createdAt)
|
||||
dbContributionLink.cycle = cycle
|
||||
if (validFrom) dbContributionLink.validFrom = new Date(validFrom)
|
||||
if (validTo) dbContributionLink.validTo = new Date(validTo)
|
||||
if (validFrom) {
|
||||
dbContributionLink.validFrom = new Date(validFrom)
|
||||
}
|
||||
if (validTo) {
|
||||
dbContributionLink.validTo = new Date(validTo)
|
||||
}
|
||||
dbContributionLink.maxAmountPerMonth = maxAmountPerMonth
|
||||
dbContributionLink.maxPerCycle = maxPerCycle
|
||||
await dbContributionLink.save()
|
||||
@ -116,8 +120,12 @@ export class ContributionLinkResolver {
|
||||
dbContributionLink.name = name
|
||||
dbContributionLink.memo = memo
|
||||
dbContributionLink.cycle = cycle
|
||||
if (validFrom) dbContributionLink.validFrom = new Date(validFrom)
|
||||
if (validTo) dbContributionLink.validTo = new Date(validTo)
|
||||
if (validFrom) {
|
||||
dbContributionLink.validFrom = new Date(validFrom)
|
||||
}
|
||||
if (validTo) {
|
||||
dbContributionLink.validTo = new Date(validTo)
|
||||
}
|
||||
dbContributionLink.maxAmountPerMonth = maxAmountPerMonth
|
||||
dbContributionLink.maxPerCycle = maxPerCycle
|
||||
await dbContributionLink.save()
|
||||
|
||||
@ -1,8 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
@ -39,7 +34,8 @@ jest.mock('@/emails/sendEmailVariants', () => {
|
||||
}
|
||||
})
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { EntityManager, FindOptionsRelations, getConnection } from '@dbTools/typeorm'
|
||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
|
||||
@ -175,9 +174,10 @@ export class ContributionMessageResolver {
|
||||
throw new LogError('ContributionMessage was not sent successfully')
|
||||
}
|
||||
const moderator = getUser(context)
|
||||
|
||||
if (messageType === ContributionMessageType.DIALOG) {
|
||||
// send email (never for moderator messages)
|
||||
void sendAddedContributionMessageEmail({
|
||||
await sendAddedContributionMessageEmail({
|
||||
firstName: finalContribution.user.firstName,
|
||||
lastName: finalContribution.user.lastName,
|
||||
email: finalContribution.user.emailContact.email,
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Connection, Equal } from '@dbTools/typeorm'
|
||||
import { Contribution } from '@entity/Contribution'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
@ -61,9 +58,9 @@ import { getFirstDayOfPreviousNMonth } from '@/util/utilities'
|
||||
jest.mock('@/emails/sendEmailVariants')
|
||||
jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let query: ApolloServerTestClient['query']
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
@ -99,7 +96,7 @@ describe('ContributionResolver', () => {
|
||||
admin = await userFactory(testEnv, peterLustig)
|
||||
await userFactory(testEnv, raeuberHotzenplotz)
|
||||
const bibisCreation = creations.find((creation) => creation.email === 'bibi@bloxberg.de')
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
|
||||
bibiCreatedContribution = await creationFactory(testEnv, bibisCreation!)
|
||||
await mutate({
|
||||
mutation: login,
|
||||
@ -2281,7 +2278,6 @@ describe('ContributionResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
describe.skip('creation update is successful changing month', () => {
|
||||
// skipped as changing the month is currently disable
|
||||
it('returns update creation object', async () => {
|
||||
|
||||
@ -318,7 +318,7 @@ export class ContributionResolver {
|
||||
relations: ['emailContact'],
|
||||
})
|
||||
|
||||
void sendContributionChangedByModeratorEmail({
|
||||
await sendContributionChangedByModeratorEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email: user.emailContact.email,
|
||||
@ -408,7 +408,7 @@ export class ContributionResolver {
|
||||
contribution,
|
||||
contribution.amount,
|
||||
)
|
||||
void sendContributionDeletedEmail({
|
||||
await sendContributionDeletedEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email: user.emailContact.email,
|
||||
@ -511,10 +511,10 @@ export class ContributionResolver {
|
||||
await queryRunner.commitTransaction()
|
||||
|
||||
// trigger to send transaction via dlt-connector
|
||||
void sendTransactionsToDltConnector()
|
||||
await sendTransactionsToDltConnector()
|
||||
|
||||
logger.info('creation commited successfuly.')
|
||||
void sendContributionConfirmedEmail({
|
||||
await sendContributionConfirmedEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email: user.emailContact.email,
|
||||
@ -598,7 +598,7 @@ export class ContributionResolver {
|
||||
contributionToUpdate.amount,
|
||||
)
|
||||
|
||||
void sendContributionDeniedEmail({
|
||||
await sendContributionDeniedEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email: user.emailContact.email,
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { User as DbUser } from '@entity/User'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
@ -12,9 +10,9 @@ import { writeHomeCommunityEntry } from '@/seeds/community'
|
||||
import { createUser, forgotPassword, setPassword } from '@/seeds/graphql/mutations'
|
||||
import { queryOptIn } from '@/seeds/graphql/queries'
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let query: ApolloServerTestClient['query']
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* 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/no-unsafe-argument */
|
||||
import { Arg, Args, Authorized, Ctx, Float, Int, Query, Resolver } from 'type-graphql'
|
||||
|
||||
import { Paginated } from '@arg/Paginated'
|
||||
@ -15,6 +11,8 @@ import { CONFIG } from '@/config'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { Context, getUser } from '@/server/context'
|
||||
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
@Resolver()
|
||||
export class GdtResolver {
|
||||
@Authorized([RIGHTS.LIST_GDT_ENTRIES])
|
||||
@ -25,20 +23,12 @@ export class GdtResolver {
|
||||
@Ctx() context: Context,
|
||||
): Promise<GdtEntryList> {
|
||||
if (!CONFIG.GDT_ACTIVE) {
|
||||
return new GdtEntryList(
|
||||
'disabled',
|
||||
0,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any
|
||||
[],
|
||||
0,
|
||||
0,
|
||||
)
|
||||
return new GdtEntryList('disabled', 0, [], 0, 0)
|
||||
}
|
||||
const userEntity = getUser(context)
|
||||
|
||||
try {
|
||||
const resultGDT = await apiGet(
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
`${CONFIG.GDT_API_URL}/GdtEntries/listPerEmailApi/${userEntity.emailContact.email}/${currentPage}/${pageSize}/${order}`,
|
||||
)
|
||||
if (!resultGDT.success) {
|
||||
@ -48,12 +38,12 @@ export class GdtResolver {
|
||||
return new GdtEntryList(
|
||||
state,
|
||||
count,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any
|
||||
gdtEntries ? gdtEntries.map((data: any) => new GdtEntry(data)) : [],
|
||||
gdtSum,
|
||||
timeUsed,
|
||||
)
|
||||
} catch (err) {
|
||||
logger.error('GDT Server is not reachable', err)
|
||||
throw new LogError('GDT Server is not reachable')
|
||||
}
|
||||
}
|
||||
@ -74,15 +64,13 @@ export class GdtResolver {
|
||||
}
|
||||
return Number(resultGDTSum.data.sum) || 0
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Could not query GDT Server')
|
||||
logger.error('Could not query GDT Server', err)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.EXIST_PID])
|
||||
@Query(() => Int)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async existPid(@Arg('pid', () => Int) pid: number): Promise<number> {
|
||||
if (!CONFIG.GDT_ACTIVE) {
|
||||
return 0
|
||||
|
||||
@ -1,8 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
import { UserContact } from '@entity/UserContact'
|
||||
import { GraphQLError } from 'graphql'
|
||||
@ -17,7 +12,9 @@ import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||
|
||||
jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
let testEnv: any, mutate: any, con: any
|
||||
let testEnv: any
|
||||
let mutate: any
|
||||
let con: any
|
||||
|
||||
beforeAll(async () => {
|
||||
testEnv = await testEnvironment(logger, localization)
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||
import { User as DbUser } from '@entity/User'
|
||||
@ -12,8 +9,7 @@ import { CommunityStatistics, DynamicStatisticsFields } from '@model/CommunitySt
|
||||
import { RIGHTS } from '@/auth/RIGHTS'
|
||||
import { calculateDecay } from '@/util/decay'
|
||||
|
||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||
@Resolver((of) => CommunityStatistics)
|
||||
@Resolver(() => CommunityStatistics)
|
||||
export class StatisticsResolver {
|
||||
@Authorized([RIGHTS.COMMUNITY_STATISTICS])
|
||||
@Query(() => CommunityStatistics)
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
@ -44,9 +41,9 @@ jest.mock('@/password/EncryptorUtils')
|
||||
jest.mock('@/util/TRANSACTIONS_LOCK')
|
||||
TRANSACTIONS_LOCK.acquire = jest.fn().mockResolvedValue(jest.fn())
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let query: ApolloServerTestClient['query']
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
@ -890,7 +887,7 @@ describe('TransactionLinkResolver', () => {
|
||||
variables.pageSize = 25
|
||||
// bibi needs GDDs
|
||||
const bibisCreation = creations.find((creation) => creation.email === 'bibi@bloxberg.de')
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
|
||||
await creationFactory(testEnv, bibisCreation!)
|
||||
// bibis transaktion links
|
||||
const bibisTransaktionLinks = transactionLinks.filter(
|
||||
@ -1066,7 +1063,7 @@ describe('TransactionLinkResolver', () => {
|
||||
})
|
||||
|
||||
// TODO: works not as expected, because 'redeemedAt' and 'redeemedBy' have to be added to the transaktion link factory
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
|
||||
describe.skip('filter by redeemed', () => {
|
||||
it('finds 6 open transaction links, 1 deleted, and no redeemed', async () => {
|
||||
await expect(
|
||||
@ -1119,7 +1116,6 @@ describe('TransactionLinkResolver', () => {
|
||||
})
|
||||
|
||||
it('returns a string that ends with the hex value of date', () => {
|
||||
// eslint-disable-next-line security/detect-non-literal-regexp
|
||||
const regexp = new RegExp(date.getTime().toString(16) + '$')
|
||||
expect(transactionLinkCode(date)).toEqual(expect.stringMatching(regexp))
|
||||
})
|
||||
|
||||
@ -311,7 +311,7 @@ export class TransactionLinkResolver {
|
||||
releaseLock()
|
||||
}
|
||||
// trigger to send transaction via dlt-connector
|
||||
void sendTransactionsToDltConnector()
|
||||
await sendTransactionsToDltConnector()
|
||||
return true
|
||||
} else {
|
||||
const now = new Date()
|
||||
@ -387,9 +387,8 @@ export class TransactionLinkResolver {
|
||||
async listTransactionLinksAdmin(
|
||||
@Args()
|
||||
paginated: Paginated,
|
||||
// eslint-disable-next-line type-graphql/wrong-decorator-signature
|
||||
@Arg('filters', () => TransactionLinkFilters, { nullable: true })
|
||||
filters: TransactionLinkFilters | null, // eslint-disable-line type-graphql/invalid-nullable-input-type
|
||||
filters: TransactionLinkFilters,
|
||||
@Arg('userId', () => Int)
|
||||
userId: number,
|
||||
): Promise<TransactionLinkResult> {
|
||||
|
||||
@ -1,9 +1,3 @@
|
||||
/* 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-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Connection, In } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { DltTransaction } from '@entity/DltTransaction'
|
||||
@ -39,9 +33,9 @@ import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
||||
|
||||
jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let query: ApolloServerTestClient['query']
|
||||
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable new-cap */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import { In, IsNull, getConnection } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { PendingTransaction as DbPendingTransaction } from '@entity/PendingTransaction'
|
||||
@ -178,14 +174,14 @@ export const executeTransaction = async (
|
||||
)
|
||||
|
||||
// trigger to send transaction via dlt-connector
|
||||
void sendTransactionsToDltConnector()
|
||||
await sendTransactionsToDltConnector()
|
||||
} catch (e) {
|
||||
await queryRunner.rollbackTransaction()
|
||||
throw new LogError('Transaction was not successful', e)
|
||||
} finally {
|
||||
await queryRunner.release()
|
||||
}
|
||||
void sendTransactionReceivedEmail({
|
||||
await sendTransactionReceivedEmail({
|
||||
firstName: recipient.firstName,
|
||||
lastName: recipient.lastName,
|
||||
email: recipient.emailContact.email,
|
||||
@ -197,7 +193,7 @@ export const executeTransaction = async (
|
||||
transactionAmount: amount,
|
||||
})
|
||||
if (transactionLink) {
|
||||
void sendTransactionLinkRedeemedEmail({
|
||||
await sendTransactionLinkRedeemedEmail({
|
||||
firstName: sender.firstName,
|
||||
lastName: sender.lastName,
|
||||
email: sender.emailContact.email,
|
||||
|
||||
@ -1,9 +1,3 @@
|
||||
/* 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-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { Event as DbEvent } from '@entity/Event'
|
||||
@ -101,9 +95,9 @@ CONFIG.EMAIL_CODE_REQUEST_TIME = 10
|
||||
|
||||
let admin: User
|
||||
let user: User
|
||||
let mutate: ApolloServerTestClient['mutate'],
|
||||
query: ApolloServerTestClient['query'],
|
||||
con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let query: ApolloServerTestClient['query']
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
@ -859,7 +853,6 @@ describe('UserResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
describe.skip('user is in database but password is not set', () => {
|
||||
beforeAll(async () => {
|
||||
jest.clearAllMocks()
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* 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/restrict-template-expressions */
|
||||
import { In, Point, getConnection } from '@dbTools/typeorm'
|
||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||
import { ProjectBranding } from '@entity/ProjectBranding'
|
||||
@ -122,7 +118,6 @@ const newEmailContact = (email: string, userId: number): DbUserContact => {
|
||||
return emailContact
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export const activationLink = (verificationCode: string): string => {
|
||||
logger.debug(`activationLink(${verificationCode})...`)
|
||||
return CONFIG.EMAIL_LINK_SETPASSWORD + verificationCode.toString()
|
||||
@ -251,7 +246,7 @@ export class UserResolver {
|
||||
if (projectBranding) {
|
||||
spaceId = projectBranding.spaceId
|
||||
}
|
||||
void syncHumhub(null, dbUser, spaceId)
|
||||
await syncHumhub(null, dbUser, spaceId)
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error("couldn't reach out to humhub, disable for now", e)
|
||||
@ -326,7 +321,7 @@ export class UserResolver {
|
||||
}
|
||||
logger.debug('partly faked user', user)
|
||||
|
||||
void sendAccountMultiRegistrationEmail({
|
||||
await sendAccountMultiRegistrationEmail({
|
||||
firstName: foundUser.firstName, // this is the real name of the email owner, but just "firstName" would be the name of the new registrant which shall not be passed to the outside
|
||||
lastName: foundUser.lastName, // this is the real name of the email owner, but just "lastName" would be the name of the new registrant which shall not be passed to the outside
|
||||
email,
|
||||
@ -421,7 +416,7 @@ export class UserResolver {
|
||||
}`
|
||||
|
||||
projectBranding = projectBrandingPromise ? await projectBrandingPromise : undefined
|
||||
void sendAccountActivationEmail({
|
||||
await sendAccountActivationEmail({
|
||||
firstName,
|
||||
lastName,
|
||||
email,
|
||||
@ -448,7 +443,7 @@ export class UserResolver {
|
||||
if (projectBranding) {
|
||||
spaceId = projectBranding.spaceId
|
||||
}
|
||||
void syncHumhub(null, dbUser, spaceId)
|
||||
await syncHumhub(null, dbUser, spaceId)
|
||||
}
|
||||
|
||||
if (redeemCode) {
|
||||
@ -507,7 +502,7 @@ export class UserResolver {
|
||||
|
||||
logger.info('optInCode for', email, user.emailContact)
|
||||
|
||||
void sendResetPasswordEmail({
|
||||
await sendResetPasswordEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email,
|
||||
@ -794,6 +789,7 @@ export class UserResolver {
|
||||
if (!homeCom.gmsApiKey) {
|
||||
throw new LogError('authenticateGmsUserSearch missing HomeCommunity GmsApiKey')
|
||||
}
|
||||
// TODO: NEVER pass user JWT token to another server - serious security risk! 😱⚠️
|
||||
result = await authenticateGmsUserPlayground(homeCom.gmsApiKey, context.token, dbUser)
|
||||
logger.info('authenticateGmsUserSearch=', result)
|
||||
} else {
|
||||
@ -1029,8 +1025,7 @@ export class UserResolver {
|
||||
user.emailContact.emailResendCount++
|
||||
await user.emailContact.save()
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
void sendAccountActivationEmail({
|
||||
await sendAccountActivationEmail({
|
||||
firstName: user.firstName,
|
||||
lastName: user.lastName,
|
||||
email,
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
@ -27,7 +24,8 @@ import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||
|
||||
jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
|
||||
@ -7,7 +7,7 @@ import { backendLogger as logger } from '@/server/logger'
|
||||
import { ensureUrlEndsWithSlash } from '@/util/utilities'
|
||||
|
||||
export async function authenticateGmsUserPlayground(
|
||||
apiKey: string,
|
||||
_apiKey: string,
|
||||
token: string,
|
||||
dbUser: DbUser,
|
||||
): Promise<GmsUserAuthenticationResult> {
|
||||
|
||||
@ -17,7 +17,8 @@ jest.mock('@/password/EncryptorUtils')
|
||||
|
||||
CONFIG.HUMHUB_ACTIVE = false
|
||||
|
||||
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
||||
let mutate: ApolloServerTestClient['mutate']
|
||||
let con: Connection
|
||||
let testEnv: {
|
||||
mutate: ApolloServerTestClient['mutate']
|
||||
query: ApolloServerTestClient['query']
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
import { Contribution } from '@entity/Contribution'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
@ -30,12 +27,11 @@ export const validateContribution = (
|
||||
throw new LogError('No information for available creations for the given date', creationDate)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
if (amount.greaterThan(creations[index].toString())) {
|
||||
throw new LogError(
|
||||
'The amount to be created exceeds the amount still available for this month',
|
||||
amount,
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
|
||||
creations[index],
|
||||
)
|
||||
}
|
||||
@ -154,7 +150,7 @@ export const updateCreations = (
|
||||
if (index < 0) {
|
||||
throw new LogError('You cannot create GDD for a month older than the last three months')
|
||||
}
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
|
||||
creations[index] = creations[index].plus(contribution.amount.toString())
|
||||
return creations
|
||||
}
|
||||
@ -173,7 +169,7 @@ export const getOpenCreations = async (
|
||||
return {
|
||||
month: date.getMonth(),
|
||||
year: date.getFullYear(),
|
||||
// eslint-disable-next-line security/detect-object-injection
|
||||
|
||||
amount: creations[index],
|
||||
}
|
||||
})
|
||||
|
||||
@ -19,7 +19,9 @@ export const findContributionMessages = async (
|
||||
|
||||
const messageTypes = [ContributionMessageType.DIALOG, ContributionMessageType.HISTORY]
|
||||
|
||||
if (showModeratorType) messageTypes.push(ContributionMessageType.MODERATOR)
|
||||
if (showModeratorType) {
|
||||
messageTypes.push(ContributionMessageType.MODERATOR)
|
||||
}
|
||||
|
||||
return DbContributionMessage.findAndCount({
|
||||
where: {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable security/detect-object-injection */
|
||||
import {
|
||||
Brackets,
|
||||
In,
|
||||
@ -46,8 +45,12 @@ export const findContributions = async (
|
||||
throw new LogError('Cannot connect to db')
|
||||
}
|
||||
const queryBuilder = connection.getRepository(DbContribution).createQueryBuilder('Contribution')
|
||||
if (relations) joinRelationsRecursive(relations, queryBuilder, 'Contribution')
|
||||
if (withDeleted) queryBuilder.withDeleted()
|
||||
if (relations) {
|
||||
joinRelationsRecursive(relations, queryBuilder, 'Contribution')
|
||||
}
|
||||
if (withDeleted) {
|
||||
queryBuilder.withDeleted()
|
||||
}
|
||||
queryBuilder.where({
|
||||
...(filter.statusFilter?.length && { contributionStatus: In(filter.statusFilter) }),
|
||||
...(filter.userId && { userId: filter.userId }),
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { User as DbUser } from '@entity/User'
|
||||
@ -44,9 +41,9 @@ describe('graphql/resolver/util/findUserByIdentifier', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
homeCom = await writeHomeCommunityEntry()
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
|
||||
communityUuid = homeCom.communityUuid!
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
|
||||
communityName = homeCom.communityUuid!
|
||||
|
||||
userBibi = await userFactory(testEnv, bibiBloxberg)
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import { KlickTipp } from '@model/KlickTipp'
|
||||
|
||||
import { getKlickTippUser } from '@/apis/KlicktippController'
|
||||
@ -6,10 +5,8 @@ import { klickTippLogger as logger } from '@/server/logger'
|
||||
|
||||
export const getKlicktippState = async (email: string): Promise<KlickTipp> => {
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const klickTippUser = await getKlickTippUser(email)
|
||||
if (klickTippUser) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
return new KlickTipp(klickTippUser.status === 'Subscribed')
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
@ -5,7 +5,7 @@ import { User as dbUser } from '@entity/User'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
import { SendCoinsClient as V1_0_SendCoinsClient } from '@/federation/client/1_0/SendCoinsClient'
|
||||
import { SendCoinsArgs } from '@/federation/client/1_0/model/SendCoinsArgs'
|
||||
import { SendCoinsResult } from '@/federation/client/1_0/model/SendCoinsResult'
|
||||
@ -70,7 +70,7 @@ export async function processXComPendingSendCoins(
|
||||
},
|
||||
})
|
||||
const client = SendCoinsClientFactory.getInstance(receiverFCom)
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
if (client instanceof V1_0_SendCoinsClient) {
|
||||
const args = new SendCoinsArgs()
|
||||
if (receiverCom.communityUuid) {
|
||||
@ -112,7 +112,9 @@ export async function processXComPendingSendCoins(
|
||||
pendingTx.previous = senderBalance ? senderBalance.lastTransactionId : null
|
||||
pendingTx.state = PendingTransactionState.NEW
|
||||
pendingTx.typeId = TransactionTypeId.SEND
|
||||
if (senderCom.communityUuid) pendingTx.userCommunityUuid = senderCom.communityUuid
|
||||
if (senderCom.communityUuid) {
|
||||
pendingTx.userCommunityUuid = senderCom.communityUuid
|
||||
}
|
||||
pendingTx.userId = sender.id
|
||||
pendingTx.userGradidoID = sender.gradidoID
|
||||
pendingTx.userName = fullName(sender.firstName, sender.lastName)
|
||||
@ -191,12 +193,12 @@ export async function processXComCommittingSendCoins(
|
||||
const receiverFCom = await DbFederatedCommunity.findOneOrFail({
|
||||
where: {
|
||||
publicKey: receiverCom.publicKey,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
apiVersion: CONFIG.FEDERATION_BACKEND_SEND_ON_API,
|
||||
},
|
||||
})
|
||||
const client = SendCoinsClientFactory.getInstance(receiverFCom)
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
if (client instanceof V1_0_SendCoinsClient) {
|
||||
const args = new SendCoinsArgs()
|
||||
args.recipientCommunityUuid = pendingTx.linkedUserCommunityUuid
|
||||
|
||||
@ -1,10 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Connection } from '@dbTools/typeorm'
|
||||
import { Community } from '@entity/Community'
|
||||
import { DltTransaction } from '@entity/DltTransaction'
|
||||
@ -441,15 +434,15 @@ describe('create and send Transactions to DltConnector', () => {
|
||||
await creationFactory(testEnv, creation)
|
||||
count++
|
||||
// we need only 3 for testing
|
||||
if (count >= 3) break
|
||||
if (count >= 3) {
|
||||
break
|
||||
}
|
||||
}
|
||||
await createHomeCommunity()
|
||||
|
||||
CONFIG.DLT_CONNECTOR = true
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return {
|
||||
data: {
|
||||
sendTransaction: { succeed: true },
|
||||
@ -523,9 +516,7 @@ describe('create and send Transactions to DltConnector', () => {
|
||||
|
||||
CONFIG.DLT_CONNECTOR = true
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return {
|
||||
data: {
|
||||
sendTransaction: { succeed: true },
|
||||
@ -599,9 +590,9 @@ describe('create and send Transactions to DltConnector', () => {
|
||||
/*
|
||||
describe('with one Community of api 1_0 and not matching pubKey', () => {
|
||||
beforeEach(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
|
||||
return {
|
||||
data: {
|
||||
getPublicKey: {
|
||||
@ -621,7 +612,7 @@ describe('create and send Transactions to DltConnector', () => {
|
||||
.into(DbFederatedCommunity)
|
||||
.values(variables1)
|
||||
.orUpdate({
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
conflict_target: ['id', 'publicKey', 'apiVersion'],
|
||||
overwrite: ['end_point', 'last_announced_at'],
|
||||
})
|
||||
@ -650,9 +641,9 @@ describe('create and send Transactions to DltConnector', () => {
|
||||
})
|
||||
describe('with one Community of api 1_0 and matching pubKey', () => {
|
||||
beforeEach(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
|
||||
return {
|
||||
data: {
|
||||
getPublicKey: {
|
||||
@ -672,7 +663,7 @@ describe('create and send Transactions to DltConnector', () => {
|
||||
.into(DbFederatedCommunity)
|
||||
.values(variables1)
|
||||
.orUpdate({
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
conflict_target: ['id', 'publicKey', 'apiVersion'],
|
||||
overwrite: ['end_point', 'last_announced_at'],
|
||||
})
|
||||
@ -702,9 +693,9 @@ describe('create and send Transactions to DltConnector', () => {
|
||||
describe('with two Communities of api 1_0 and 1_1', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
jest.spyOn(GraphQLClient.prototype, 'rawRequest').mockImplementation(async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
|
||||
return {
|
||||
data: {
|
||||
getPublicKey: {
|
||||
@ -724,7 +715,7 @@ describe('create and send Transactions to DltConnector', () => {
|
||||
.into(DbFederatedCommunity)
|
||||
.values(variables2)
|
||||
.orUpdate({
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
conflict_target: ['id', 'publicKey', 'apiVersion'],
|
||||
overwrite: ['end_point', 'last_announced_at'],
|
||||
})
|
||||
@ -764,7 +755,7 @@ describe('create and send Transactions to DltConnector', () => {
|
||||
.into(DbFederatedCommunity)
|
||||
.values(variables3)
|
||||
.orUpdate({
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
conflict_target: ['id', 'publicKey', 'apiVersion'],
|
||||
overwrite: ['end_point', 'last_announced_at'],
|
||||
})
|
||||
|
||||
@ -65,7 +65,7 @@ async function createDltTransactions(): Promise<void> {
|
||||
.select('id')
|
||||
.addSelect('balance_date')
|
||||
.where('id NOT IN (' + dltqb.getSql() + ')')
|
||||
// eslint-disable-next-line camelcase
|
||||
|
||||
.orderBy({ balance_date: 'ASC', id: 'ASC' })
|
||||
.getRawMany()
|
||||
|
||||
|
||||
@ -20,14 +20,14 @@ export async function sendUserToGms(
|
||||
try {
|
||||
if (alwaysCreateUser === true || (!user.gmsRegistered && user.gmsRegisteredAt === null)) {
|
||||
logger.debug('create user in gms:', gmsUser)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
|
||||
if (await createGmsUser(homeCom.gmsApiKey, gmsUser)) {
|
||||
logger.debug('GMS user published successfully:', gmsUser)
|
||||
await updateUserGmsStatus(user)
|
||||
}
|
||||
} else {
|
||||
logger.debug('update user in gms:', gmsUser)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
|
||||
if (await updateGmsUser(homeCom.gmsApiKey, gmsUser)) {
|
||||
logger.debug('GMS user published successfully:', gmsUser)
|
||||
await updateUserGmsStatus(user)
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable new-cap */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { PendingTransaction as DbPendingTransaction } from '@entity/PendingTransaction'
|
||||
|
||||
@ -55,7 +55,7 @@ export async function syncHumhub(
|
||||
externId: humhubUser?.id,
|
||||
// for preventing this warning https://github.com/eslint-community/eslint-plugin-security/blob/main/docs/rules/detect-object-injection.md
|
||||
// and possible danger coming with it
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
|
||||
result: ExecutedHumhubAction[result as ExecutedHumhubAction],
|
||||
})
|
||||
if (spaceId && humhubUser) {
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ -3,7 +3,6 @@ import { User as DbUser } from '@entity/User'
|
||||
|
||||
import { LogError } from '@/server/LogError'
|
||||
|
||||
// eslint-disable-next-line security/detect-unsafe-regex
|
||||
export const VALID_ALIAS_REGEX = /^(?=.{3,20}$)[a-zA-Z0-9]+(?:[_-][a-zA-Z0-9]+?)*$/
|
||||
|
||||
const RESERVED_ALIAS = [
|
||||
@ -25,11 +24,18 @@ const RESERVED_ALIAS = [
|
||||
]
|
||||
|
||||
export const validateAlias = async (alias: string): Promise<boolean> => {
|
||||
if (alias.length < 3) throw new LogError('Given alias is too short', alias)
|
||||
if (alias.length > 20) throw new LogError('Given alias is too long', alias)
|
||||
if (!alias.match(VALID_ALIAS_REGEX)) throw new LogError('Invalid characters in alias', alias)
|
||||
if (RESERVED_ALIAS.includes(alias.toLowerCase()))
|
||||
if (alias.length < 3) {
|
||||
throw new LogError('Given alias is too short', alias)
|
||||
}
|
||||
if (alias.length > 20) {
|
||||
throw new LogError('Given alias is too long', alias)
|
||||
}
|
||||
if (!alias.match(VALID_ALIAS_REGEX)) {
|
||||
throw new LogError('Invalid characters in alias', alias)
|
||||
}
|
||||
if (RESERVED_ALIAS.includes(alias.toLowerCase())) {
|
||||
throw new LogError('Alias is not allowed', alias)
|
||||
}
|
||||
const aliasInUse = await DbUser.find({
|
||||
where: { alias: Raw((a) => `LOWER(${a}) = "${alias.toLowerCase()}"`) },
|
||||
})
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { GraphQLScalarType, Kind } from 'graphql'
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { GraphQLScalarType, Kind } from 'graphql'
|
||||
|
||||
import { Location } from '@model/Location'
|
||||
@ -17,9 +16,9 @@ export const LocationScalar = new GraphQLScalarType({
|
||||
parseValue(value): Location {
|
||||
try {
|
||||
const loc = new Location()
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
loc.longitude = value.longitude
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
|
||||
|
||||
loc.latitude = value.latitude
|
||||
return loc
|
||||
} catch (err) {
|
||||
|
||||
@ -3,7 +3,6 @@ import { ValidationOptions, registerDecorator } from 'class-validator'
|
||||
import { ContributionStatus } from '@enum/ContributionStatus'
|
||||
|
||||
export function isContributionStatusArray(validationOptions?: ValidationOptions) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
return function (object: Object, propertyName: string) {
|
||||
registerDecorator({
|
||||
name: 'isContributionStatusArray',
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { ValidationArguments, ValidationOptions, registerDecorator } from 'class-validator'
|
||||
|
||||
export function isValidDateString(validationOptions?: ValidationOptions) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
return function (object: Object, propertyName: string) {
|
||||
registerDecorator({
|
||||
name: 'isValidDateString',
|
||||
|
||||
@ -2,7 +2,6 @@ import { ValidationArguments, ValidationOptions, registerDecorator } from 'class
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
export function IsPositiveDecimal(validationOptions?: ValidationOptions) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
return function (object: Object, propertyName: string) {
|
||||
registerDecorator({
|
||||
name: 'isPositiveDecimal',
|
||||
|
||||
@ -5,7 +5,6 @@ import { Location } from '@model/Location'
|
||||
import { Location2Point } from '@/graphql/resolver/util/Location2Point'
|
||||
|
||||
export function isValidLocation(validationOptions?: ValidationOptions) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
return function (object: Object, propertyName: string) {
|
||||
registerDecorator({
|
||||
name: 'isValidLocation',
|
||||
|
||||
@ -6,18 +6,18 @@ async function main() {
|
||||
const { app } = await createServer()
|
||||
|
||||
app.listen(CONFIG.PORT, () => {
|
||||
// eslint-disable-next-line no-console
|
||||
// biome-ignore lint/suspicious/noConsole: no need for logging the start message
|
||||
console.log(`Server is running at http://localhost:${CONFIG.PORT}`)
|
||||
if (CONFIG.GRAPHIQL) {
|
||||
// eslint-disable-next-line no-console
|
||||
// biome-ignore lint/suspicious/noConsole: no need for logging the start message
|
||||
console.log(`GraphIQL available at http://localhost:${CONFIG.PORT}`)
|
||||
}
|
||||
})
|
||||
void startValidateCommunities(Number(CONFIG.FEDERATION_VALIDATE_COMMUNITY_TIMER))
|
||||
await startValidateCommunities(Number(CONFIG.FEDERATION_VALIDATE_COMMUNITY_TIMER))
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
// eslint-disable-next-line no-console
|
||||
// biome-ignore lint/suspicious/noConsole: maybe logger isn't initialized here
|
||||
console.error(e)
|
||||
throw e
|
||||
})
|
||||
|
||||
@ -61,8 +61,7 @@ export class UnconfirmedContributionAdminRole extends AbstractUnconfirmedContrib
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
protected checkAuthorization(user: User, role: Role): AbstractUnconfirmedContributionRole {
|
||||
protected checkAuthorization(_user: User, role: Role): AbstractUnconfirmedContributionRole {
|
||||
if (
|
||||
!role.hasRight(RIGHTS.MODERATOR_UPDATE_CONTRIBUTION_MEMO) &&
|
||||
this.self.moderatorId === null
|
||||
|
||||
@ -7,7 +7,6 @@ export class BalanceLoggingView extends AbstractLoggingView {
|
||||
super()
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public toJSON(): any {
|
||||
return {
|
||||
balance: this.decimalToString(this.self.balance),
|
||||
|
||||
@ -7,7 +7,6 @@ export class DecayLoggingView extends AbstractLoggingView {
|
||||
super()
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public toJSON(): any {
|
||||
return {
|
||||
balance: this.decimalToString(this.self.balance),
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* 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-unsafe-argument */
|
||||
import { cpus } from 'os'
|
||||
import path from 'path'
|
||||
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* 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-unsafe-argument */
|
||||
import { User } from '@entity/User'
|
||||
|
||||
import { PasswordEncryptionType } from '@enum/PasswordEncryptionType'
|
||||
|
||||
@ -29,7 +29,7 @@ export async function writeHomeCommunityEntry(): Promise<DbCommunity> {
|
||||
await DbCommunity.insert(homeCom)
|
||||
}
|
||||
return homeCom
|
||||
} catch (err) {
|
||||
} catch (_err) {
|
||||
throw new Error(`Seeding: Error writing HomeCommunity-Entry`) // : ${err}`)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
|
||||
import { ContributionLink } from '@model/ContributionLink'
|
||||
@ -15,8 +12,7 @@ export const contributionLinkFactory = async (
|
||||
const { mutate } = client
|
||||
|
||||
// login as admin
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const user = await mutate({
|
||||
await mutate({
|
||||
mutation: login,
|
||||
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
||||
})
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/* 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/unbound-method */
|
||||
import { Contribution } from '@entity/Contribution'
|
||||
import { Transaction } from '@entity/Transaction'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import { TransactionLink } from '@entity/TransactionLink'
|
||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||
|
||||
|
||||
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