mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into delete-node-modules-delete-tmp-on-start
This commit is contained in:
commit
9e07f7ae9a
@ -1,12 +1,27 @@
|
|||||||
|
// eslint-disable-next-line import/no-commonjs, import/unambiguous
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
env: {
|
env: {
|
||||||
node: true,
|
node: true,
|
||||||
},
|
},
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
plugins: ['prettier', '@typescript-eslint', 'type-graphql', 'jest'],
|
plugins: ['prettier', '@typescript-eslint', 'type-graphql', 'jest', 'import'],
|
||||||
extends: ['standard', 'eslint:recommended', 'plugin:prettier/recommended'],
|
extends: [
|
||||||
// add your custom rules here
|
'standard',
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:prettier/recommended',
|
||||||
|
'plugin:import/recommended',
|
||||||
|
'plugin:import/typescript',
|
||||||
|
],
|
||||||
|
settings: {
|
||||||
|
'import/parsers': {
|
||||||
|
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||||
|
},
|
||||||
|
'import/resolver': {
|
||||||
|
typescript: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': ['error'],
|
'no-console': ['error'],
|
||||||
'no-debugger': 'error',
|
'no-debugger': 'error',
|
||||||
@ -22,6 +37,47 @@ module.exports = {
|
|||||||
'jest/no-identical-title': 'error',
|
'jest/no-identical-title': 'error',
|
||||||
'jest/prefer-to-have-length': 'error',
|
'jest/prefer-to-have-length': 'error',
|
||||||
'jest/valid-expect': 'error',
|
'jest/valid-expect': 'error',
|
||||||
|
// 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/named': 'error',
|
||||||
|
'import/namespace': 'error',
|
||||||
|
'import/no-absolute-path': 'error',
|
||||||
|
'import/no-cycle': 'off',
|
||||||
|
'import/no-dynamic-require': 'error',
|
||||||
|
'import/no-internal-modules': 'off',
|
||||||
|
'import/no-relative-packages': 'error',
|
||||||
|
'import/no-relative-parent-imports': ['error', { ignore: ['@/*'] }],
|
||||||
|
'import/no-self-import': 'error',
|
||||||
|
'import/no-unresolved': 'error',
|
||||||
|
'import/no-useless-path-segments': 'error',
|
||||||
|
'import/no-webpack-loader-syntax': 'error',
|
||||||
|
'import/consistent-type-specifier-style': 'error',
|
||||||
|
'import/exports-last': 'off',
|
||||||
|
'import/extensions': 'error',
|
||||||
|
'import/first': 'error',
|
||||||
|
'import/group-exports': 'off',
|
||||||
|
'import/newline-after-import': 'error',
|
||||||
|
'import/no-anonymous-default-export': 'error',
|
||||||
|
'import/no-default-export': 'off',
|
||||||
|
'import/no-duplicates': 'error',
|
||||||
|
'import/no-named-default': 'error',
|
||||||
|
'import/no-namespace': 'error',
|
||||||
|
'import/no-unassigned-import': 'error',
|
||||||
|
'import/order': 'error',
|
||||||
|
'import/prefer-default-export': 'off', // TODO
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
// only for ts files
|
// only for ts files
|
||||||
@ -38,9 +94,11 @@ module.exports = {
|
|||||||
'no-void': ['error', { allowAsStatement: true }],
|
'no-void': ['error', { allowAsStatement: true }],
|
||||||
// ignore prefer-regexp-exec rule to allow string.match(regex)
|
// ignore prefer-regexp-exec rule to allow string.match(regex)
|
||||||
'@typescript-eslint/prefer-regexp-exec': 'off',
|
'@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',
|
||||||
},
|
},
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
tsconfigRootDir: __dirname,
|
tsconfigRootDir: './',
|
||||||
project: ['./tsconfig.json'],
|
project: ['./tsconfig.json'],
|
||||||
// this is to properly reference the referenced project database without requirement of compiling it
|
// this is to properly reference the referenced project database without requirement of compiling it
|
||||||
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||||
|
// eslint-disable-next-line import/no-commonjs, import/unambiguous
|
||||||
module.exports = {
|
module.exports = {
|
||||||
verbose: true,
|
verbose: true,
|
||||||
preset: 'ts-jest',
|
preset: 'ts-jest',
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
"clean": "tsc --build --clean",
|
"clean": "tsc --build --clean",
|
||||||
"start": "cross-env TZ=UTC TS_NODE_BASEURL=./build node -r tsconfig-paths/register build/src/index.js",
|
"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 --exec ts-node -r tsconfig-paths/register src/index.ts",
|
"dev": "cross-env TZ=UTC nodemon -w src --ext ts --exec ts-node -r tsconfig-paths/register src/index.ts",
|
||||||
"lint": "eslint --max-warnings=0 --ext .js,.ts .",
|
"lint": "eslint --max-warnings=0 .",
|
||||||
"test": "cross-env TZ=UTC NODE_ENV=development jest --runInBand --forceExit --detectOpenHandles",
|
"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",
|
"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/klicktipp.ts",
|
"klicktipp": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/util/klicktipp.ts",
|
||||||
@ -29,6 +29,7 @@
|
|||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"email-templates": "^10.0.1",
|
"email-templates": "^10.0.1",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
"gradido-database": "file:../database",
|
||||||
"graphql": "^15.5.1",
|
"graphql": "^15.5.1",
|
||||||
"graphql-request": "5.0.0",
|
"graphql-request": "5.0.0",
|
||||||
"i18n": "^0.15.1",
|
"i18n": "^0.15.1",
|
||||||
@ -61,13 +62,15 @@
|
|||||||
"eslint": "^7.29.0",
|
"eslint": "^7.29.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-config-standard": "^16.0.3",
|
"eslint-config-standard": "^16.0.3",
|
||||||
"eslint-plugin-import": "^2.23.4",
|
"eslint-import-resolver-typescript": "^3.5.3",
|
||||||
|
"eslint-plugin-import": "^2.27.5",
|
||||||
"eslint-plugin-jest": "^27.2.1",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-prettier": "^3.4.0",
|
"eslint-plugin-prettier": "^3.4.0",
|
||||||
"eslint-plugin-promise": "^5.1.0",
|
"eslint-plugin-promise": "^5.1.0",
|
||||||
"eslint-plugin-type-graphql": "^1.0.0",
|
"eslint-plugin-type-graphql": "^1.0.0",
|
||||||
"faker": "^5.5.3",
|
"faker": "^5.5.3",
|
||||||
|
"graphql-tag": "^2.12.6",
|
||||||
"jest": "^27.2.4",
|
"jest": "^27.2.4",
|
||||||
"klicktipp-api": "^1.0.2",
|
"klicktipp-api": "^1.0.2",
|
||||||
"nodemon": "^2.0.7",
|
"nodemon": "^2.0.7",
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
// eslint-disable-next-line import/no-relative-parent-imports
|
||||||
import KlicktippConnector from 'klicktipp-api'
|
import KlicktippConnector from 'klicktipp-api'
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
import jwt from 'jsonwebtoken'
|
import { verify, sign } from 'jsonwebtoken'
|
||||||
import CONFIG from '@/config/'
|
|
||||||
import { CustomJwtPayload } from './CustomJwtPayload'
|
import { CustomJwtPayload } from './CustomJwtPayload'
|
||||||
|
import CONFIG from '@/config/'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
export const decode = (token: string): CustomJwtPayload | null => {
|
export const decode = (token: string): CustomJwtPayload | null => {
|
||||||
if (!token) throw new LogError('401 Unauthorized')
|
if (!token) throw new LogError('401 Unauthorized')
|
||||||
try {
|
try {
|
||||||
return <CustomJwtPayload>jwt.verify(token, CONFIG.JWT_SECRET)
|
return <CustomJwtPayload>verify(token, CONFIG.JWT_SECRET)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const encode = (gradidoID: string): string => {
|
export const encode = (gradidoID: string): string => {
|
||||||
const token = jwt.sign({ gradidoID }, CONFIG.JWT_SECRET, {
|
const token = sign({ gradidoID }, CONFIG.JWT_SECRET, {
|
||||||
expiresIn: CONFIG.JWT_EXPIRES_IN,
|
expiresIn: CONFIG.JWT_EXPIRES_IN,
|
||||||
})
|
})
|
||||||
return token
|
return token
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
|
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
|
||||||
|
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
||||||
Decimal.set({
|
Decimal.set({
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
import { createTransport } from 'nodemailer'
|
import { createTransport } from 'nodemailer'
|
||||||
|
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||||
import { logger, i18n } from '@test/testSetup'
|
import { logger, i18n } from '@test/testSetup'
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
|
||||||
|
|
||||||
CONFIG.EMAIL = false
|
CONFIG.EMAIL = false
|
||||||
CONFIG.EMAIL_SMTP_URL = 'EMAIL_SMTP_URL'
|
CONFIG.EMAIL_SMTP_URL = 'EMAIL_SMTP_URL'
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
import CONFIG from '@/config'
|
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { createTransport } from 'nodemailer'
|
import { createTransport } from 'nodemailer'
|
||||||
import Email from 'email-templates'
|
import Email from 'email-templates'
|
||||||
import i18n from 'i18n'
|
import i18n from 'i18n'
|
||||||
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
|
import CONFIG from '@/config'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
export const sendEmailTranslated = async (params: {
|
export const sendEmailTranslated = async (params: {
|
||||||
|
|||||||
@ -3,10 +3,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { testEnvironment } from '@test/helpers'
|
|
||||||
import { logger, i18n as localization } from '@test/testSetup'
|
|
||||||
import CONFIG from '@/config'
|
|
||||||
import {
|
import {
|
||||||
sendAddedContributionMessageEmail,
|
sendAddedContributionMessageEmail,
|
||||||
sendAccountActivationEmail,
|
sendAccountActivationEmail,
|
||||||
@ -19,6 +16,9 @@ import {
|
|||||||
sendTransactionReceivedEmail,
|
sendTransactionReceivedEmail,
|
||||||
} from './sendEmailVariants'
|
} from './sendEmailVariants'
|
||||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||||
|
import { testEnvironment } from '@test/helpers'
|
||||||
|
import { logger, i18n as localization } from '@test/testSetup'
|
||||||
|
import CONFIG from '@/config'
|
||||||
|
|
||||||
let con: any
|
let con: any
|
||||||
let testEnv: any
|
let testEnv: any
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
import { decimalSeparatorByLanguage } from '@/util/utilities'
|
import { decimalSeparatorByLanguage } from '@/util/utilities'
|
||||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
|
||||||
|
|
||||||
export const sendAddedContributionMessageEmail = (data: {
|
export const sendAddedContributionMessageEmail = (data: {
|
||||||
firstName: string
|
firstName: string
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
|
import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
|
import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
|
|||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
|
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
|
||||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { EventType } from './Event'
|
import { EventType } from './EventType'
|
||||||
|
|
||||||
export const Event = (
|
export const Event = (
|
||||||
type: EventType,
|
type: EventType,
|
||||||
@ -34,7 +34,7 @@ export const Event = (
|
|||||||
return event
|
return event
|
||||||
}
|
}
|
||||||
|
|
||||||
export { EventType } from './EventType'
|
export { EventType }
|
||||||
|
|
||||||
export { EVENT_ADMIN_CONTRIBUTION_CONFIRM } from './EVENT_ADMIN_CONTRIBUTION_CONFIRM'
|
export { EVENT_ADMIN_CONTRIBUTION_CONFIRM } from './EVENT_ADMIN_CONTRIBUTION_CONFIRM'
|
||||||
export { EVENT_ADMIN_CONTRIBUTION_CREATE } from './EVENT_ADMIN_CONTRIBUTION_CREATE'
|
export { EVENT_ADMIN_CONTRIBUTION_CREATE } from './EVENT_ADMIN_CONTRIBUTION_CREATE'
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
import { gql } from 'graphql-request'
|
import { gql } from 'graphql-request'
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
|
||||||
import { Community as DbCommunity } from '@entity/Community'
|
import { Community as DbCommunity } from '@entity/Community'
|
||||||
import { GraphQLGetClient } from '../GraphQLGetClient'
|
import { GraphQLGetClient } from '@/federation/client/GraphQLGetClient'
|
||||||
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
export async function requestGetPublicKey(dbCom: DbCommunity): Promise<string | undefined> {
|
export async function requestGetPublicKey(dbCom: DbCommunity): Promise<string | undefined> {
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
import { gql } from 'graphql-request'
|
import { gql } from 'graphql-request'
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
|
||||||
import { Community as DbCommunity } from '@entity/Community'
|
import { Community as DbCommunity } from '@entity/Community'
|
||||||
import { GraphQLGetClient } from '../GraphQLGetClient'
|
import { GraphQLGetClient } from '@/federation/client/GraphQLGetClient'
|
||||||
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
export async function requestGetPublicKey(dbCom: DbCommunity): Promise<string | undefined> {
|
export async function requestGetPublicKey(dbCom: DbCommunity): Promise<string | undefined> {
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import { logger } from '@test/testSetup'
|
|
||||||
import { Community as DbCommunity } from '@entity/Community'
|
import { Community as DbCommunity } from '@entity/Community'
|
||||||
import { testEnvironment, cleanDB } from '@test/helpers'
|
|
||||||
import { validateCommunities } from './validateCommunities'
|
import { validateCommunities } from './validateCommunities'
|
||||||
|
import { logger } from '@test/testSetup'
|
||||||
|
import { testEnvironment, cleanDB } from '@test/helpers'
|
||||||
|
|
||||||
let con: any
|
let con: any
|
||||||
let testEnv: any
|
let testEnv: any
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import { IsNull } from '@dbTools/typeorm'
|
|||||||
import { requestGetPublicKey as v1_0_requestGetPublicKey } from './client/1_0/FederationClient'
|
import { requestGetPublicKey as v1_0_requestGetPublicKey } from './client/1_0/FederationClient'
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
import { requestGetPublicKey as v1_1_requestGetPublicKey } from './client/1_1/FederationClient'
|
import { requestGetPublicKey as v1_1_requestGetPublicKey } from './client/1_1/FederationClient'
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
|
||||||
import { ApiVersionType } from './enum/apiVersionType'
|
import { ApiVersionType } from './enum/apiVersionType'
|
||||||
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
export function startValidateCommunities(timerInterval: number): void {
|
export function startValidateCommunities(timerInterval: number): void {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ArgsType, Field, InputType } from 'type-graphql'
|
import { ArgsType, Field, InputType } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
@ArgsType()
|
@ArgsType()
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ArgsType, Field, Int } from 'type-graphql'
|
import { ArgsType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@ArgsType()
|
@ArgsType()
|
||||||
export default class AdminUpdateContributionArgs {
|
export default class AdminUpdateContributionArgs {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ArgsType, Field, InputType } from 'type-graphql'
|
import { ArgsType, Field, InputType } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
@ArgsType()
|
@ArgsType()
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ArgsType, Field, Int } from 'type-graphql'
|
import { ArgsType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@ArgsType()
|
@ArgsType()
|
||||||
export default class ContributionLinkArgs {
|
export default class ContributionLinkArgs {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ArgsType, Field } from 'type-graphql'
|
import { ArgsType, Field } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@ArgsType()
|
@ArgsType()
|
||||||
export default class TransactionLinkArgs {
|
export default class TransactionLinkArgs {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ArgsType, Field } from 'type-graphql'
|
import { ArgsType, Field } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@ArgsType()
|
@ArgsType()
|
||||||
export default class TransactionSendArgs {
|
export default class TransactionSendArgs {
|
||||||
|
|||||||
@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
import { AuthChecker } from 'type-graphql'
|
import { AuthChecker } from 'type-graphql'
|
||||||
|
|
||||||
|
import { User } from '@entity/User'
|
||||||
import { decode, encode } from '@/auth/JWT'
|
import { decode, encode } from '@/auth/JWT'
|
||||||
import { ROLE_UNAUTHORIZED, ROLE_USER, ROLE_ADMIN } from '@/auth/ROLES'
|
import { ROLE_UNAUTHORIZED, ROLE_USER, ROLE_ADMIN } from '@/auth/ROLES'
|
||||||
import { RIGHTS } from '@/auth/RIGHTS'
|
import { RIGHTS } from '@/auth/RIGHTS'
|
||||||
import { INALIENABLE_RIGHTS } from '@/auth/INALIENABLE_RIGHTS'
|
import { INALIENABLE_RIGHTS } from '@/auth/INALIENABLE_RIGHTS'
|
||||||
import { User } from '@entity/User'
|
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
const isAuthorized: AuthChecker<any> = async ({ context }, rights) => {
|
const isAuthorized: AuthChecker<any> = async ({ context }, rights) => {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field } from 'type-graphql'
|
import { ObjectType, Field } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class AdminUpdateContribution {
|
export class AdminUpdateContribution {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field, Int, Float } from 'type-graphql'
|
import { ObjectType, Field, Int, Float } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class Balance {
|
export class Balance {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class DynamicStatisticsFields {
|
export class DynamicStatisticsFields {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { Contribution as dbContribution } from '@entity/Contribution'
|
import { Contribution as dbContribution } from '@entity/Contribution'
|
||||||
import { User } from '@entity/User'
|
import { User } from '@entity/User'
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { ContributionLink as dbContributionLink } from '@entity/ContributionLink'
|
import { ContributionLink as dbContributionLink } from '@entity/ContributionLink'
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
interface DecayInterface {
|
interface DecayInterface {
|
||||||
balance: Decimal
|
balance: Decimal
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
import { GdtEntry } from './GdtEntry'
|
|
||||||
import { ObjectType, Field, Int, Float } from 'type-graphql'
|
import { ObjectType, Field, Int, Float } from 'type-graphql'
|
||||||
|
import { GdtEntry } from './GdtEntry'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class GdtEntryList {
|
export class GdtEntryList {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class OpenCreation {
|
export class OpenCreation {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import { Decay } from './Decay'
|
|
||||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { TransactionTypeId } from '@enum/TransactionTypeId'
|
import { Decay } from './Decay'
|
||||||
import { User } from './User'
|
import { User } from './User'
|
||||||
|
import { TransactionTypeId } from '@enum/TransactionTypeId'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class Transaction {
|
export class Transaction {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||||
import { User } from './User'
|
import { User } from './User'
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { Contribution } from '@entity/Contribution'
|
import { Contribution } from '@entity/Contribution'
|
||||||
import { User } from '@entity/User'
|
import { User } from '@entity/User'
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import { KlickTipp } from './KlickTipp'
|
|
||||||
import { User as dbUser } from '@entity/User'
|
import { User as dbUser } from '@entity/User'
|
||||||
|
import { KlickTipp } from './KlickTipp'
|
||||||
import { UserContact } from './UserContact'
|
import { UserContact } from './UserContact'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { User } from '@entity/User'
|
import { User } from '@entity/User'
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { Resolver, Query, Ctx, Authorized } from 'type-graphql'
|
import { Resolver, Query, Ctx, Authorized } from 'type-graphql'
|
||||||
import { getCustomRepository } from '@dbTools/typeorm'
|
import { getCustomRepository } from '@dbTools/typeorm'
|
||||||
|
|
||||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||||
|
|
||||||
|
import { GdtResolver } from './GdtResolver'
|
||||||
|
import { getLastTransaction } from './util/getLastTransaction'
|
||||||
import { TransactionLinkRepository } from '@repository/TransactionLink'
|
import { TransactionLinkRepository } from '@repository/TransactionLink'
|
||||||
|
|
||||||
import { Balance } from '@model/Balance'
|
import { Balance } from '@model/Balance'
|
||||||
@ -14,9 +16,6 @@ import { backendLogger as logger } from '@/server/logger'
|
|||||||
import { Context, getUser } from '@/server/context'
|
import { Context, getUser } from '@/server/context'
|
||||||
import { calculateDecay } from '@/util/decay'
|
import { calculateDecay } from '@/util/decay'
|
||||||
import { RIGHTS } from '@/auth/RIGHTS'
|
import { RIGHTS } from '@/auth/RIGHTS'
|
||||||
import { GdtResolver } from './GdtResolver'
|
|
||||||
|
|
||||||
import { getLastTransaction } from './util/getLastTransaction'
|
|
||||||
|
|
||||||
@Resolver()
|
@Resolver()
|
||||||
export class BalanceResolver {
|
export class BalanceResolver {
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import { getCommunities } from '@/seeds/graphql/queries'
|
|
||||||
import { Community as DbCommunity } from '@entity/Community'
|
import { Community as DbCommunity } from '@entity/Community'
|
||||||
|
import { getCommunities } from '@/seeds/graphql/queries'
|
||||||
import { testEnvironment } from '@test/helpers'
|
import { testEnvironment } from '@test/helpers'
|
||||||
|
|
||||||
let query: any
|
let query: any
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Resolver, Query, Authorized } from 'type-graphql'
|
import { Resolver, Query, Authorized } from 'type-graphql'
|
||||||
|
|
||||||
import { Community } from '@model/Community'
|
|
||||||
import { Community as DbCommunity } from '@entity/Community'
|
import { Community as DbCommunity } from '@entity/Community'
|
||||||
|
import { Community } from '@model/Community'
|
||||||
|
|
||||||
import { RIGHTS } from '@/auth/RIGHTS'
|
import { RIGHTS } from '@/auth/RIGHTS'
|
||||||
|
|
||||||
|
|||||||
@ -4,9 +4,11 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { logger } from '@test/testSetup'
|
|
||||||
import { GraphQLError } from 'graphql'
|
import { GraphQLError } from 'graphql'
|
||||||
|
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||||
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
import { logger } from '@test/testSetup'
|
||||||
import {
|
import {
|
||||||
login,
|
login,
|
||||||
createContributionLink,
|
createContributionLink,
|
||||||
@ -18,9 +20,7 @@ import { cleanDB, testEnvironment, resetToken } from '@test/helpers'
|
|||||||
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||||
import { userFactory } from '@/seeds/factory/user'
|
import { userFactory } from '@/seeds/factory/user'
|
||||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
|
||||||
import { EventType } from '@/event/Event'
|
import { EventType } from '@/event/Event'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
|
||||||
|
|
||||||
let mutate: any, query: any, con: any
|
let mutate: any, query: any, con: any
|
||||||
let testEnv: any
|
let testEnv: any
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { Resolver, Args, Arg, Authorized, Mutation, Query, Int, Ctx } from 'type-graphql'
|
import { Resolver, Args, Arg, Authorized, Mutation, Query, Int, Ctx } from 'type-graphql'
|
||||||
import { MoreThan, IsNull } from '@dbTools/typeorm'
|
import { MoreThan, IsNull } from '@dbTools/typeorm'
|
||||||
|
|
||||||
|
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||||
import {
|
import {
|
||||||
CONTRIBUTIONLINK_NAME_MAX_CHARS,
|
CONTRIBUTIONLINK_NAME_MAX_CHARS,
|
||||||
CONTRIBUTIONLINK_NAME_MIN_CHARS,
|
CONTRIBUTIONLINK_NAME_MIN_CHARS,
|
||||||
@ -9,16 +10,15 @@ import {
|
|||||||
MEMO_MIN_CHARS,
|
MEMO_MIN_CHARS,
|
||||||
} from './const/const'
|
} from './const/const'
|
||||||
import { isStartEndDateValid } from './util/creations'
|
import { isStartEndDateValid } from './util/creations'
|
||||||
|
import { transactionLinkCode as contributionLinkCode } from './TransactionLinkResolver'
|
||||||
import { ContributionLinkList } from '@model/ContributionLinkList'
|
import { ContributionLinkList } from '@model/ContributionLinkList'
|
||||||
import { ContributionLink } from '@model/ContributionLink'
|
import { ContributionLink } from '@model/ContributionLink'
|
||||||
import ContributionLinkArgs from '@arg/ContributionLinkArgs'
|
import ContributionLinkArgs from '@arg/ContributionLinkArgs'
|
||||||
import { RIGHTS } from '@/auth/RIGHTS'
|
import { RIGHTS } from '@/auth/RIGHTS'
|
||||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
|
||||||
import { Order } from '@enum/Order'
|
import { Order } from '@enum/Order'
|
||||||
import Paginated from '@arg/Paginated'
|
import Paginated from '@arg/Paginated'
|
||||||
|
|
||||||
// TODO: this is a strange construct
|
// TODO: this is a strange construct
|
||||||
import { transactionLinkCode as contributionLinkCode } from './TransactionLinkResolver'
|
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
import { Context, getUser } from '@/server/context'
|
import { Context, getUser } from '@/server/context'
|
||||||
import {
|
import {
|
||||||
|
|||||||
@ -6,9 +6,10 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
|
import { GraphQLError } from 'graphql'
|
||||||
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
import { cleanDB, resetToken, testEnvironment } from '@test/helpers'
|
import { cleanDB, resetToken, testEnvironment } from '@test/helpers'
|
||||||
import { logger, i18n as localization } from '@test/testSetup'
|
import { logger, i18n as localization } from '@test/testSetup'
|
||||||
import { GraphQLError } from 'graphql'
|
|
||||||
import {
|
import {
|
||||||
adminCreateContributionMessage,
|
adminCreateContributionMessage,
|
||||||
createContribution,
|
createContribution,
|
||||||
@ -21,7 +22,6 @@ import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
|||||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||||
import { sendAddedContributionMessageEmail } from '@/emails/sendEmailVariants'
|
import { sendAddedContributionMessageEmail } from '@/emails/sendEmailVariants'
|
||||||
import { EventType } from '@/event/Event'
|
import { EventType } from '@/event/Event'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
|
||||||
|
|
||||||
jest.mock('@/emails/sendEmailVariants', () => {
|
jest.mock('@/emails/sendEmailVariants', () => {
|
||||||
const originalModule = jest.requireActual('@/emails/sendEmailVariants')
|
const originalModule = jest.requireActual('@/emails/sendEmailVariants')
|
||||||
|
|||||||
@ -6,7 +6,13 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
import { GraphQLError } from 'graphql'
|
||||||
|
import { Contribution } from '@entity/Contribution'
|
||||||
|
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||||
|
import { User } from '@entity/User'
|
||||||
|
import { UserInputError } from 'apollo-server-express'
|
||||||
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||||
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
||||||
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
||||||
@ -41,18 +47,12 @@ import {
|
|||||||
contributionDateFormatter,
|
contributionDateFormatter,
|
||||||
resetEntity,
|
resetEntity,
|
||||||
} from '@test/helpers'
|
} from '@test/helpers'
|
||||||
import { GraphQLError } from 'graphql'
|
|
||||||
import { userFactory } from '@/seeds/factory/user'
|
import { userFactory } from '@/seeds/factory/user'
|
||||||
import { creationFactory } from '@/seeds/factory/creation'
|
import { creationFactory } from '@/seeds/factory/creation'
|
||||||
import { creations } from '@/seeds/creation/index'
|
import { creations } from '@/seeds/creation/index'
|
||||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
|
||||||
import { Contribution } from '@entity/Contribution'
|
|
||||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
|
||||||
import { User } from '@entity/User'
|
|
||||||
import { EventType } from '@/event/Event'
|
import { EventType } from '@/event/Event'
|
||||||
import { logger, i18n as localization } from '@test/testSetup'
|
import { logger, i18n as localization } from '@test/testSetup'
|
||||||
import { UserInputError } from 'apollo-server-express'
|
|
||||||
import { raeuberHotzenplotz } from '@/seeds/users/raeuber-hotzenplotz'
|
import { raeuberHotzenplotz } from '@/seeds/users/raeuber-hotzenplotz'
|
||||||
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
||||||
import { ContributionListResult } from '@model/Contribution'
|
import { ContributionListResult } from '@model/Contribution'
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { Arg, Args, Authorized, Ctx, Int, Mutation, Query, Resolver } from 'type-graphql'
|
import { Arg, Args, Authorized, Ctx, Int, Mutation, Query, Resolver } from 'type-graphql'
|
||||||
import { IsNull, getConnection } from '@dbTools/typeorm'
|
import { IsNull, getConnection } from '@dbTools/typeorm'
|
||||||
|
|
||||||
@ -9,6 +9,16 @@ import { UserContact } from '@entity/UserContact'
|
|||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
import { Transaction as DbTransaction } from '@entity/Transaction'
|
import { Transaction as DbTransaction } from '@entity/Transaction'
|
||||||
|
|
||||||
|
import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const'
|
||||||
|
import { getLastTransaction } from './util/getLastTransaction'
|
||||||
|
import { findContributions } from './util/findContributions'
|
||||||
|
import {
|
||||||
|
getUserCreation,
|
||||||
|
validateContribution,
|
||||||
|
updateCreations,
|
||||||
|
isValidDateString,
|
||||||
|
getOpenCreations,
|
||||||
|
} from './util/creations'
|
||||||
import { AdminUpdateContribution } from '@model/AdminUpdateContribution'
|
import { AdminUpdateContribution } from '@model/AdminUpdateContribution'
|
||||||
import { Contribution, ContributionListResult } from '@model/Contribution'
|
import { Contribution, ContributionListResult } from '@model/Contribution'
|
||||||
import { Decay } from '@model/Decay'
|
import { Decay } from '@model/Decay'
|
||||||
@ -27,14 +37,6 @@ import AdminUpdateContributionArgs from '@arg/AdminUpdateContributionArgs'
|
|||||||
import { RIGHTS } from '@/auth/RIGHTS'
|
import { RIGHTS } from '@/auth/RIGHTS'
|
||||||
import { Context, getUser, getClientTimezoneOffset } from '@/server/context'
|
import { Context, getUser, getClientTimezoneOffset } from '@/server/context'
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
import {
|
|
||||||
getUserCreation,
|
|
||||||
validateContribution,
|
|
||||||
updateCreations,
|
|
||||||
isValidDateString,
|
|
||||||
getOpenCreations,
|
|
||||||
} from './util/creations'
|
|
||||||
import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const'
|
|
||||||
import {
|
import {
|
||||||
EVENT_CONTRIBUTION_CREATE,
|
EVENT_CONTRIBUTION_CREATE,
|
||||||
EVENT_CONTRIBUTION_DELETE,
|
EVENT_CONTRIBUTION_DELETE,
|
||||||
@ -54,9 +56,6 @@ import {
|
|||||||
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
import { getLastTransaction } from './util/getLastTransaction'
|
|
||||||
import { findContributions } from './util/findContributions'
|
|
||||||
|
|
||||||
@Resolver()
|
@Resolver()
|
||||||
export class ContributionResolver {
|
export class ContributionResolver {
|
||||||
@Authorized([RIGHTS.CREATE_CONTRIBUTION])
|
@Authorized([RIGHTS.CREATE_CONTRIBUTION])
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import { testEnvironment, cleanDB } from '@test/helpers'
|
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
|
import { GraphQLError } from 'graphql'
|
||||||
|
import { testEnvironment, cleanDB } from '@test/helpers'
|
||||||
import { createUser, setPassword, forgotPassword } from '@/seeds/graphql/mutations'
|
import { createUser, setPassword, forgotPassword } from '@/seeds/graphql/mutations'
|
||||||
import { queryOptIn } from '@/seeds/graphql/queries'
|
import { queryOptIn } from '@/seeds/graphql/queries'
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
import { GraphQLError } from 'graphql'
|
|
||||||
|
|
||||||
let mutate: any, query: any, con: any
|
let mutate: any, query: any, con: any
|
||||||
let testEnv: any
|
let testEnv: any
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { Resolver, Query, Authorized, FieldResolver } from 'type-graphql'
|
import { Resolver, Query, Authorized, FieldResolver } from 'type-graphql'
|
||||||
import { getConnection } from '@dbTools/typeorm'
|
import { getConnection } from '@dbTools/typeorm'
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,13 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
|
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||||
|
import { User } from '@entity/User'
|
||||||
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
import { GraphQLError } from 'graphql'
|
||||||
|
import { Transaction } from '@entity/Transaction'
|
||||||
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
import { UserContact } from '@entity/UserContact'
|
||||||
import { transactionLinkCode } from './TransactionLinkResolver'
|
import { transactionLinkCode } from './TransactionLinkResolver'
|
||||||
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||||
@ -22,20 +29,14 @@ import {
|
|||||||
createContribution,
|
createContribution,
|
||||||
updateContribution,
|
updateContribution,
|
||||||
createTransactionLink,
|
createTransactionLink,
|
||||||
|
deleteTransactionLink,
|
||||||
confirmContribution,
|
confirmContribution,
|
||||||
} from '@/seeds/graphql/mutations'
|
} from '@/seeds/graphql/mutations'
|
||||||
import { listTransactionLinksAdmin } from '@/seeds/graphql/queries'
|
import { listTransactionLinksAdmin } from '@/seeds/graphql/queries'
|
||||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
|
||||||
import { User } from '@entity/User'
|
|
||||||
import { Transaction } from '@entity/Transaction'
|
|
||||||
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
||||||
import Decimal from 'decimal.js-light'
|
|
||||||
import { GraphQLError } from 'graphql'
|
|
||||||
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||||
import { logger } from '@test/testSetup'
|
import { logger } from '@test/testSetup'
|
||||||
import { EventType } from '@/event/Event'
|
import { EventType } from '@/event/Event'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
|
||||||
import { UserContact } from '@entity/UserContact'
|
|
||||||
|
|
||||||
// mock semaphore to allow use fake timers
|
// mock semaphore to allow use fake timers
|
||||||
jest.mock('@/util/TRANSACTIONS_LOCK')
|
jest.mock('@/util/TRANSACTIONS_LOCK')
|
||||||
@ -573,6 +574,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
|
|
||||||
describe('link exists', () => {
|
describe('link exists', () => {
|
||||||
let myCode: string
|
let myCode: string
|
||||||
|
let myId: number
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await mutate({
|
await mutate({
|
||||||
@ -589,7 +591,7 @@ describe('TransactionLinkResolver', () => {
|
|||||||
})
|
})
|
||||||
const {
|
const {
|
||||||
data: {
|
data: {
|
||||||
createTransactionLink: { code },
|
createTransactionLink: { id, code },
|
||||||
},
|
},
|
||||||
} = await mutate({
|
} = await mutate({
|
||||||
mutation: createTransactionLink,
|
mutation: createTransactionLink,
|
||||||
@ -599,6 +601,23 @@ describe('TransactionLinkResolver', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
myCode = code
|
myCode = code
|
||||||
|
myId = id
|
||||||
|
})
|
||||||
|
|
||||||
|
it('stores the TRANSACTION_LINK_CREATE event in the database', async () => {
|
||||||
|
const userConatct = await UserContact.findOneOrFail(
|
||||||
|
{ email: 'bibi@bloxberg.de' },
|
||||||
|
{ relations: ['user'] },
|
||||||
|
)
|
||||||
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
type: EventType.TRANSACTION_LINK_CREATE,
|
||||||
|
affectedUserId: userConatct.user.id,
|
||||||
|
actingUserId: userConatct.user.id,
|
||||||
|
involvedTransactionLinkId: myId,
|
||||||
|
amount: expect.decimalEqual(200),
|
||||||
|
}),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('own link', () => {
|
describe('own link', () => {
|
||||||
@ -625,6 +644,94 @@ describe('TransactionLinkResolver', () => {
|
|||||||
expect.any(Number),
|
expect.any(Number),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
it('delete own link', async () => {
|
||||||
|
await expect(
|
||||||
|
mutate({
|
||||||
|
mutation: deleteTransactionLink,
|
||||||
|
variables: {
|
||||||
|
id: myId,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).resolves.toMatchObject({
|
||||||
|
data: { deleteTransactionLink: true },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('stores the TRANSACTION_LINK_DELETE event in the database', async () => {
|
||||||
|
const userConatct = await UserContact.findOneOrFail(
|
||||||
|
{ email: 'bibi@bloxberg.de' },
|
||||||
|
{ relations: ['user'] },
|
||||||
|
)
|
||||||
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
type: EventType.TRANSACTION_LINK_DELETE,
|
||||||
|
affectedUserId: userConatct.user.id,
|
||||||
|
actingUserId: userConatct.user.id,
|
||||||
|
involvedTransactionLinkId: myId,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('other link', () => {
|
||||||
|
beforeAll(async () => {
|
||||||
|
await mutate({
|
||||||
|
mutation: login,
|
||||||
|
variables: { email: 'bibi@bloxberg.de', password: 'Aa12345_' },
|
||||||
|
})
|
||||||
|
const {
|
||||||
|
data: {
|
||||||
|
createTransactionLink: { id, code },
|
||||||
|
},
|
||||||
|
} = await mutate({
|
||||||
|
mutation: createTransactionLink,
|
||||||
|
variables: {
|
||||||
|
amount: 200,
|
||||||
|
memo: 'This is a transaction link from bibi',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
myCode = code
|
||||||
|
myId = id
|
||||||
|
await mutate({
|
||||||
|
mutation: login,
|
||||||
|
variables: { email: 'peter@lustig.de', password: 'Aa12345_' },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('successfully redeems link', async () => {
|
||||||
|
await expect(
|
||||||
|
mutate({
|
||||||
|
mutation: redeemTransactionLink,
|
||||||
|
variables: {
|
||||||
|
code: myCode,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
).resolves.toMatchObject({
|
||||||
|
data: { redeemTransactionLink: true },
|
||||||
|
errors: undefined,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('stores the TRANSACTION_LINK_REDEEM event in the database', async () => {
|
||||||
|
const creator = await UserContact.findOneOrFail(
|
||||||
|
{ email: 'bibi@bloxberg.de' },
|
||||||
|
{ relations: ['user'] },
|
||||||
|
)
|
||||||
|
const redeemer = await UserContact.findOneOrFail(
|
||||||
|
{ email: 'peter@lustig.de' },
|
||||||
|
{ relations: ['user'] },
|
||||||
|
)
|
||||||
|
await expect(DbEvent.find()).resolves.toContainEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
type: EventType.TRANSACTION_LINK_REDEEM,
|
||||||
|
affectedUserId: redeemer.user.id,
|
||||||
|
actingUserId: redeemer.user.id,
|
||||||
|
involvedUserId: creator.user.id,
|
||||||
|
involvedTransactionLinkId: myId,
|
||||||
|
amount: expect.decimalEqual(200),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { randomBytes } from 'crypto'
|
import { randomBytes } from 'crypto'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
import { getConnection } from '@dbTools/typeorm'
|
import { getConnection } from '@dbTools/typeorm'
|
||||||
|
|
||||||
@ -9,6 +9,11 @@ import { Transaction as DbTransaction } from '@entity/Transaction'
|
|||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||||
|
|
||||||
|
import { Resolver, Args, Arg, Authorized, Ctx, Mutation, Query, Int } from 'type-graphql'
|
||||||
|
import { getUserCreation, validateContribution } from './util/creations'
|
||||||
|
import { executeTransaction } from './TransactionResolver'
|
||||||
|
import { getLastTransaction } from './util/getLastTransaction'
|
||||||
|
import transactionLinkList from './util/transactionLinkList'
|
||||||
import { User } from '@model/User'
|
import { User } from '@model/User'
|
||||||
import { ContributionLink } from '@model/ContributionLink'
|
import { ContributionLink } from '@model/ContributionLink'
|
||||||
import { Decay } from '@model/Decay'
|
import { Decay } from '@model/Decay'
|
||||||
@ -20,21 +25,14 @@ import { ContributionCycleType } from '@enum/ContributionCycleType'
|
|||||||
import TransactionLinkArgs from '@arg/TransactionLinkArgs'
|
import TransactionLinkArgs from '@arg/TransactionLinkArgs'
|
||||||
import Paginated from '@arg/Paginated'
|
import Paginated from '@arg/Paginated'
|
||||||
import TransactionLinkFilters from '@arg/TransactionLinkFilters'
|
import TransactionLinkFilters from '@arg/TransactionLinkFilters'
|
||||||
|
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
import { Context, getUser, getClientTimezoneOffset } from '@/server/context'
|
import { Context, getUser, getClientTimezoneOffset } from '@/server/context'
|
||||||
import { Resolver, Args, Arg, Authorized, Ctx, Mutation, Query, Int } from 'type-graphql'
|
|
||||||
import { calculateBalance } from '@/util/validate'
|
import { calculateBalance } from '@/util/validate'
|
||||||
import { RIGHTS } from '@/auth/RIGHTS'
|
import { RIGHTS } from '@/auth/RIGHTS'
|
||||||
import { calculateDecay } from '@/util/decay'
|
import { calculateDecay } from '@/util/decay'
|
||||||
import { getUserCreation, validateContribution } from './util/creations'
|
|
||||||
import { executeTransaction } from './TransactionResolver'
|
|
||||||
import QueryLinkResult from '@union/QueryLinkResult'
|
import QueryLinkResult from '@union/QueryLinkResult'
|
||||||
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
import { getLastTransaction } from './util/getLastTransaction'
|
|
||||||
import transactionLinkList from './util/transactionLinkList'
|
|
||||||
import {
|
import {
|
||||||
EVENT_CONTRIBUTION_LINK_REDEEM,
|
EVENT_CONTRIBUTION_LINK_REDEEM,
|
||||||
EVENT_TRANSACTION_LINK_CREATE,
|
EVENT_TRANSACTION_LINK_CREATE,
|
||||||
|
|||||||
@ -5,7 +5,12 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
import { Transaction } from '@entity/Transaction'
|
||||||
|
import { User } from '@entity/User'
|
||||||
|
import { GraphQLError } from 'graphql'
|
||||||
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
import { findUserByEmail } from './UserResolver'
|
||||||
import { EventType } from '@/event/Event'
|
import { EventType } from '@/event/Event'
|
||||||
import { userFactory } from '@/seeds/factory/user'
|
import { userFactory } from '@/seeds/factory/user'
|
||||||
import {
|
import {
|
||||||
@ -18,13 +23,8 @@ import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
|||||||
import { garrickOllivander } from '@/seeds/users/garrick-ollivander'
|
import { garrickOllivander } from '@/seeds/users/garrick-ollivander'
|
||||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||||
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
|
||||||
import { Transaction } from '@entity/Transaction'
|
|
||||||
import { User } from '@entity/User'
|
|
||||||
import { cleanDB, testEnvironment } from '@test/helpers'
|
import { cleanDB, testEnvironment } from '@test/helpers'
|
||||||
import { logger } from '@test/testSetup'
|
import { logger } from '@test/testSetup'
|
||||||
import { GraphQLError } from 'graphql'
|
|
||||||
import { findUserByEmail } from './UserResolver'
|
|
||||||
|
|
||||||
let mutate: any, query: any, con: any
|
let mutate: any, query: any, con: any
|
||||||
let testEnv: any
|
let testEnv: any
|
||||||
|
|||||||
@ -2,13 +2,17 @@
|
|||||||
/* eslint-disable new-cap */
|
/* eslint-disable new-cap */
|
||||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||||
|
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { Resolver, Query, Args, Authorized, Ctx, Mutation } from 'type-graphql'
|
import { Resolver, Query, Args, Authorized, Ctx, Mutation } from 'type-graphql'
|
||||||
import { getCustomRepository, getConnection, In } from '@dbTools/typeorm'
|
import { getCustomRepository, getConnection, In } from '@dbTools/typeorm'
|
||||||
|
|
||||||
import { User as dbUser } from '@entity/User'
|
import { User as dbUser } from '@entity/User'
|
||||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||||
|
import { BalanceResolver } from './BalanceResolver'
|
||||||
|
import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const'
|
||||||
|
import { findUserByEmail } from './UserResolver'
|
||||||
|
import { getLastTransaction } from './util/getLastTransaction'
|
||||||
import { TransactionRepository } from '@repository/Transaction'
|
import { TransactionRepository } from '@repository/Transaction'
|
||||||
import { TransactionLinkRepository } from '@repository/TransactionLink'
|
import { TransactionLinkRepository } from '@repository/TransactionLink'
|
||||||
|
|
||||||
@ -32,15 +36,9 @@ import {
|
|||||||
} from '@/emails/sendEmailVariants'
|
} from '@/emails/sendEmailVariants'
|
||||||
import { EVENT_TRANSACTION_RECEIVE, EVENT_TRANSACTION_SEND } from '@/event/Event'
|
import { EVENT_TRANSACTION_RECEIVE, EVENT_TRANSACTION_SEND } from '@/event/Event'
|
||||||
|
|
||||||
import { BalanceResolver } from './BalanceResolver'
|
|
||||||
import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const'
|
|
||||||
import { findUserByEmail } from './UserResolver'
|
|
||||||
|
|
||||||
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
import { getLastTransaction } from './util/getLastTransaction'
|
|
||||||
|
|
||||||
export const executeTransaction = async (
|
export const executeTransaction = async (
|
||||||
amount: Decimal,
|
amount: Decimal,
|
||||||
memo: string,
|
memo: string,
|
||||||
|
|||||||
@ -6,6 +6,15 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
|
import { GraphQLError } from 'graphql'
|
||||||
|
import { User } from '@entity/User'
|
||||||
|
import { TransactionLink } from '@entity/TransactionLink'
|
||||||
|
import { validate as validateUUID, version as versionUUID } from 'uuid'
|
||||||
|
import { UserContact } from '@entity/UserContact'
|
||||||
|
import { Event as DbEvent } from '@entity/Event'
|
||||||
|
import { OptInType } from '@enum/OptInType'
|
||||||
|
import { UserContactType } from '@enum/UserContactType'
|
||||||
|
import { PasswordEncryptionType } from '@enum/PasswordEncryptionType'
|
||||||
import { objectValuesToArray } from '@/util/utilities'
|
import { objectValuesToArray } from '@/util/utilities'
|
||||||
import { testEnvironment, headerPushMock, resetToken, cleanDB } from '@test/helpers'
|
import { testEnvironment, headerPushMock, resetToken, cleanDB } from '@test/helpers'
|
||||||
import { logger, i18n as localization } from '@test/testSetup'
|
import { logger, i18n as localization } from '@test/testSetup'
|
||||||
@ -27,8 +36,6 @@ import {
|
|||||||
sendActivationEmail,
|
sendActivationEmail,
|
||||||
} from '@/seeds/graphql/mutations'
|
} from '@/seeds/graphql/mutations'
|
||||||
import { verifyLogin, queryOptIn, searchAdminUsers, searchUsers } from '@/seeds/graphql/queries'
|
import { verifyLogin, queryOptIn, searchAdminUsers, searchUsers } from '@/seeds/graphql/queries'
|
||||||
import { GraphQLError } from 'graphql'
|
|
||||||
import { User } from '@entity/User'
|
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
import {
|
import {
|
||||||
sendAccountActivationEmail,
|
sendAccountActivationEmail,
|
||||||
@ -38,19 +45,12 @@ import {
|
|||||||
import { contributionLinkFactory } from '@/seeds/factory/contributionLink'
|
import { contributionLinkFactory } from '@/seeds/factory/contributionLink'
|
||||||
import { transactionLinkFactory } from '@/seeds/factory/transactionLink'
|
import { transactionLinkFactory } from '@/seeds/factory/transactionLink'
|
||||||
import { ContributionLink } from '@model/ContributionLink'
|
import { ContributionLink } from '@model/ContributionLink'
|
||||||
import { TransactionLink } from '@entity/TransactionLink'
|
|
||||||
import { EventType } from '@/event/Event'
|
import { EventType } from '@/event/Event'
|
||||||
import { Event as DbEvent } from '@entity/Event'
|
|
||||||
import { validate as validateUUID, version as versionUUID } from 'uuid'
|
|
||||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||||
import { UserContact } from '@entity/UserContact'
|
|
||||||
import { OptInType } from '../enum/OptInType'
|
|
||||||
import { UserContactType } from '../enum/UserContactType'
|
|
||||||
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
||||||
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
||||||
import { garrickOllivander } from '@/seeds/users/garrick-ollivander'
|
import { garrickOllivander } from '@/seeds/users/garrick-ollivander'
|
||||||
import { encryptPassword } from '@/password/PasswordEncryptor'
|
import { encryptPassword } from '@/password/PasswordEncryptor'
|
||||||
import { PasswordEncryptionType } from '../enum/PasswordEncryptionType'
|
|
||||||
import { SecretKeyCryptographyCreateKey } from '@/password/EncryptorUtils'
|
import { SecretKeyCryptographyCreateKey } from '@/password/EncryptorUtils'
|
||||||
|
|
||||||
// import { klicktippSignIn } from '@/apis/KlicktippController'
|
// import { klicktippSignIn } from '@/apis/KlicktippController'
|
||||||
|
|||||||
@ -21,6 +21,9 @@ import { User as DbUser } from '@entity/User'
|
|||||||
import { UserContact as DbUserContact } from '@entity/UserContact'
|
import { UserContact as DbUserContact } from '@entity/UserContact'
|
||||||
import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
|
import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
|
||||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||||
|
import { getUserCreations } from './util/creations'
|
||||||
|
import { FULL_CREATION_AVAILABLE } from './const/const'
|
||||||
|
import { PasswordEncryptionType } from '@enum/PasswordEncryptionType'
|
||||||
import { UserRepository } from '@repository/User'
|
import { UserRepository } from '@repository/User'
|
||||||
|
|
||||||
import { User } from '@model/User'
|
import { User } from '@model/User'
|
||||||
@ -68,16 +71,13 @@ import {
|
|||||||
EVENT_ADMIN_USER_DELETE,
|
EVENT_ADMIN_USER_DELETE,
|
||||||
EVENT_ADMIN_USER_UNDELETE,
|
EVENT_ADMIN_USER_UNDELETE,
|
||||||
} from '@/event/Event'
|
} from '@/event/Event'
|
||||||
import { getUserCreations } from './util/creations'
|
|
||||||
import { isValidPassword } from '@/password/EncryptorUtils'
|
import { isValidPassword } from '@/password/EncryptorUtils'
|
||||||
import { FULL_CREATION_AVAILABLE } from './const/const'
|
|
||||||
import { encryptPassword, verifyPassword } from '@/password/PasswordEncryptor'
|
import { encryptPassword, verifyPassword } from '@/password/PasswordEncryptor'
|
||||||
import { PasswordEncryptionType } from '../enum/PasswordEncryptionType'
|
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-commonjs
|
||||||
const sodium = require('sodium-native')
|
const sodium = require('sodium-native')
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-commonjs
|
||||||
const random = require('random-bigint')
|
const random = require('random-bigint')
|
||||||
|
|
||||||
const LANGUAGES = ['de', 'en', 'es', 'fr', 'nl']
|
const LANGUAGES = ['de', 'en', 'es', 'fr', 'nl']
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
export const MAX_CREATION_AMOUNT = new Decimal(1000)
|
export const MAX_CREATION_AMOUNT = new Decimal(1000)
|
||||||
export const FULL_CREATION_AVAILABLE = [
|
export const FULL_CREATION_AVAILABLE = [
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { userFactory } from '@/seeds/factory/user'
|
import { userFactory } from '@/seeds/factory/user'
|
||||||
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||||
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
||||||
|
|||||||
@ -4,14 +4,14 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
|
import { User } from '@entity/User'
|
||||||
|
import { Contribution } from '@entity/Contribution'
|
||||||
|
import { getUserCreation } from './creations'
|
||||||
import { testEnvironment, cleanDB, contributionDateFormatter } from '@test/helpers'
|
import { testEnvironment, cleanDB, contributionDateFormatter } from '@test/helpers'
|
||||||
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||||
import { User } from '@entity/User'
|
|
||||||
import { Contribution } from '@entity/Contribution'
|
|
||||||
import { userFactory } from '@/seeds/factory/user'
|
import { userFactory } from '@/seeds/factory/user'
|
||||||
import { login, createContribution, adminCreateContribution } from '@/seeds/graphql/mutations'
|
import { login, createContribution, adminCreateContribution } from '@/seeds/graphql/mutations'
|
||||||
import { getUserCreation } from './creations'
|
|
||||||
|
|
||||||
let mutate: any, con: any
|
let mutate: any, con: any
|
||||||
let testEnv: any
|
let testEnv: any
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
import LogError from '@/server/LogError'
|
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
|
||||||
import { getConnection } from '@dbTools/typeorm'
|
import { getConnection } from '@dbTools/typeorm'
|
||||||
import { Contribution } from '@entity/Contribution'
|
import { Contribution } from '@entity/Contribution'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { FULL_CREATION_AVAILABLE, MAX_CREATION_AMOUNT } from '../const/const'
|
import { FULL_CREATION_AVAILABLE, MAX_CREATION_AMOUNT } from '@/graphql/resolver/const/const'
|
||||||
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
import { OpenCreation } from '@model/OpenCreation'
|
import { OpenCreation } from '@model/OpenCreation'
|
||||||
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
interface CreationMap {
|
interface CreationMap {
|
||||||
id: number
|
id: number
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ContributionStatus } from '@enum/ContributionStatus'
|
|
||||||
import { Order } from '@enum/Order'
|
|
||||||
import { Contribution as DbContribution } from '@entity/Contribution'
|
import { Contribution as DbContribution } from '@entity/Contribution'
|
||||||
import { In } from '@dbTools/typeorm'
|
import { In } from '@dbTools/typeorm'
|
||||||
|
import { ContributionStatus } from '@enum/ContributionStatus'
|
||||||
|
import { Order } from '@enum/Order'
|
||||||
|
|
||||||
interface FindContributionsOptions {
|
interface FindContributionsOptions {
|
||||||
order: Order
|
order: Order
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { GraphQLScalarType, Kind } from 'graphql'
|
import { GraphQLScalarType, Kind } from 'graphql'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
export default new GraphQLScalarType({
|
const DecimalType = new GraphQLScalarType({
|
||||||
name: 'Decimal',
|
name: 'Decimal',
|
||||||
description: 'The `Decimal` scalar type to represent currency values',
|
description: 'The `Decimal` scalar type to represent currency values',
|
||||||
|
|
||||||
@ -21,3 +21,5 @@ export default new GraphQLScalarType({
|
|||||||
return new Decimal(ast.value)
|
return new Decimal(ast.value)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export default DecimalType
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
|
import path from 'path'
|
||||||
import { GraphQLSchema } from 'graphql'
|
import { GraphQLSchema } from 'graphql'
|
||||||
import { buildSchema } from 'type-graphql'
|
import { buildSchema } from 'type-graphql'
|
||||||
import path from 'path'
|
|
||||||
|
|
||||||
|
import { Decimal } from 'decimal.js-light'
|
||||||
import isAuthorized from './directive/isAuthorized'
|
import isAuthorized from './directive/isAuthorized'
|
||||||
import DecimalScalar from './scalar/Decimal'
|
import DecimalScalar from './scalar/Decimal'
|
||||||
import Decimal from 'decimal.js-light'
|
|
||||||
|
|
||||||
const schema = async (): Promise<GraphQLSchema> => {
|
const schema = async (): Promise<GraphQLSchema> => {
|
||||||
return buildSchema({
|
return buildSchema({
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { createUnionType } from 'type-graphql'
|
import { createUnionType } from 'type-graphql'
|
||||||
import { TransactionLink } from '@model/TransactionLink'
|
import { TransactionLink } from '@model/TransactionLink'
|
||||||
import { ContributionLink } from '@model/ContributionLink'
|
import { ContributionLink } from '@model/ContributionLink'
|
||||||
|
|
||||||
export default createUnionType({
|
export default createUnionType({
|
||||||
name: 'QueryLinkResult', // the name of the GraphQL union
|
name: 'QueryLinkResult', // the name of the GraphQL union
|
||||||
types: () => [TransactionLink, ContributionLink] as const, // function that returns tuple of object types classes
|
types: () => [TransactionLink, ContributionLink] as const, // function that returns tuple of object types classes
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
|
import { User } from '@entity/User'
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
import { User } from '@entity/User'
|
|
||||||
import { PasswordEncryptionType } from '@enum/PasswordEncryptionType'
|
import { PasswordEncryptionType } from '@enum/PasswordEncryptionType'
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-commonjs
|
||||||
const sodium = require('sodium-native')
|
const sodium = require('sodium-native')
|
||||||
|
|
||||||
// We will reuse this for changePassword
|
// We will reuse this for changePassword
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { CreationInterface } from './CreationInterface'
|
import { CreationInterface } from './CreationInterface'
|
||||||
import { nMonthsBefore } from '../factory/creation'
|
import { nMonthsBefore } from '@/seeds/factory/creation'
|
||||||
|
|
||||||
const bobsSendings = [
|
const bobsSendings = [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,11 +5,11 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import { login, createContribution, confirmContribution } from '@/seeds/graphql/mutations'
|
|
||||||
import { CreationInterface } from '@/seeds/creation/CreationInterface'
|
|
||||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||||
import { Transaction } from '@entity/Transaction'
|
import { Transaction } from '@entity/Transaction'
|
||||||
import { Contribution } from '@entity/Contribution'
|
import { Contribution } from '@entity/Contribution'
|
||||||
|
import { CreationInterface } from '@/seeds/creation/CreationInterface'
|
||||||
|
import { login, createContribution, confirmContribution } from '@/seeds/graphql/mutations'
|
||||||
import { findUserByEmail } from '@/graphql/resolver/UserResolver'
|
import { findUserByEmail } from '@/graphql/resolver/UserResolver'
|
||||||
// import CONFIG from '@/config/index'
|
// import CONFIG from '@/config/index'
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||||
|
import { TransactionLink } from '@entity/TransactionLink'
|
||||||
import { login, createTransactionLink } from '@/seeds/graphql/mutations'
|
import { login, createTransactionLink } from '@/seeds/graphql/mutations'
|
||||||
import { TransactionLinkInterface } from '@/seeds/transactionLink/TransactionLinkInterface'
|
import { TransactionLinkInterface } from '@/seeds/transactionLink/TransactionLinkInterface'
|
||||||
import { transactionLinkExpireDate } from '@/graphql/resolver/TransactionLinkResolver'
|
import { transactionLinkExpireDate } from '@/graphql/resolver/TransactionLinkResolver'
|
||||||
import { TransactionLink } from '@entity/TransactionLink'
|
|
||||||
|
|
||||||
export const transactionLinkFactory = async (
|
export const transactionLinkFactory = async (
|
||||||
client: ApolloServerTestClient,
|
client: ApolloServerTestClient,
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
import { createUser, setPassword } from '@/seeds/graphql/mutations'
|
|
||||||
import { User } from '@entity/User'
|
import { User } from '@entity/User'
|
||||||
import { UserInterface } from '@/seeds/users/UserInterface'
|
|
||||||
import { ApolloServerTestClient } from 'apollo-server-testing'
|
import { ApolloServerTestClient } from 'apollo-server-testing'
|
||||||
|
import { createUser, setPassword } from '@/seeds/graphql/mutations'
|
||||||
|
import { UserInterface } from '@/seeds/users/UserInterface'
|
||||||
|
|
||||||
export const userFactory = async (
|
export const userFactory = async (
|
||||||
client: ApolloServerTestClient,
|
client: ApolloServerTestClient,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import gql from 'graphql-tag'
|
import { gql } from 'graphql-tag'
|
||||||
|
|
||||||
export const subscribeNewsletter = gql`
|
export const subscribeNewsletter = gql`
|
||||||
mutation ($email: String!, $language: String!) {
|
mutation ($email: String!, $language: String!) {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import gql from 'graphql-tag'
|
import { gql } from 'graphql-tag'
|
||||||
|
|
||||||
export const verifyLogin = gql`
|
export const verifyLogin = gql`
|
||||||
query {
|
query {
|
||||||
|
|||||||
@ -5,11 +5,9 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import { backendLogger as logger } from '@/server/logger'
|
|
||||||
import createServer from '../server/createServer'
|
|
||||||
import { createTestClient } from 'apollo-server-testing'
|
import { createTestClient } from 'apollo-server-testing'
|
||||||
|
|
||||||
import { name, internet, datatype } from 'faker'
|
import { name, internet, datatype } from 'faker'
|
||||||
|
import { entities } from '@entity/index'
|
||||||
|
|
||||||
import { users } from './users/index'
|
import { users } from './users/index'
|
||||||
import { creations } from './creation/index'
|
import { creations } from './creation/index'
|
||||||
@ -19,7 +17,8 @@ import { userFactory } from './factory/user'
|
|||||||
import { creationFactory } from './factory/creation'
|
import { creationFactory } from './factory/creation'
|
||||||
import { transactionLinkFactory } from './factory/transactionLink'
|
import { transactionLinkFactory } from './factory/transactionLink'
|
||||||
import { contributionLinkFactory } from './factory/contributionLink'
|
import { contributionLinkFactory } from './factory/contributionLink'
|
||||||
import { entities } from '@entity/index'
|
import createServer from '@/server/createServer'
|
||||||
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
|
|
||||||
CONFIG.EMAIL = false
|
CONFIG.EMAIL = false
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
import { logger } from '@test/testSetup'
|
|
||||||
|
|
||||||
import LogError from './LogError'
|
import LogError from './LogError'
|
||||||
|
import { logger } from '@test/testSetup'
|
||||||
|
|
||||||
describe('LogError', () => {
|
describe('LogError', () => {
|
||||||
it('logs an Error when created', () => {
|
it('logs an Error when created', () => {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { Role } from '@/auth/Role'
|
|
||||||
import { User as dbUser } from '@entity/User'
|
import { User as dbUser } from '@entity/User'
|
||||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { ExpressContext } from 'apollo-server-express'
|
import { ExpressContext } from 'apollo-server-express'
|
||||||
import LogError from './LogError'
|
import LogError from './LogError'
|
||||||
|
import { Role } from '@/auth/Role'
|
||||||
|
|
||||||
export interface Context {
|
export interface Context {
|
||||||
token: string | null
|
token: string | null
|
||||||
|
|||||||
@ -1,35 +1,20 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
/* eslint-disable @typescript-eslint/unbound-method */
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
import 'reflect-metadata'
|
|
||||||
|
|
||||||
import { ApolloServer } from 'apollo-server-express'
|
import { ApolloServer } from 'apollo-server-express'
|
||||||
import express, { Express } from 'express'
|
import express, { Express, json, urlencoded } from 'express'
|
||||||
|
import { Connection } from '@dbTools/typeorm'
|
||||||
// database
|
import { Logger } from 'log4js'
|
||||||
import connection from '@/typeorm/connection'
|
|
||||||
import { checkDBVersion } from '@/typeorm/DBVersion'
|
|
||||||
|
|
||||||
// server
|
|
||||||
import cors from './cors'
|
import cors from './cors'
|
||||||
import serverContext from './context'
|
import serverContext from './context'
|
||||||
import plugins from './plugins'
|
import plugins from './plugins'
|
||||||
|
|
||||||
// config
|
|
||||||
import CONFIG from '@/config'
|
|
||||||
|
|
||||||
// graphql
|
|
||||||
import schema from '@/graphql/schema'
|
|
||||||
|
|
||||||
// webhooks
|
|
||||||
import { elopageWebhook } from '@/webhook/elopage'
|
|
||||||
import { Connection } from '@dbTools/typeorm'
|
|
||||||
|
|
||||||
import { apolloLogger } from './logger'
|
import { apolloLogger } from './logger'
|
||||||
import { Logger } from 'log4js'
|
|
||||||
|
|
||||||
// i18n
|
|
||||||
import { i18n } from './localization'
|
import { i18n } from './localization'
|
||||||
|
import connection from '@/typeorm/connection'
|
||||||
|
import { checkDBVersion } from '@/typeorm/DBVersion'
|
||||||
|
import CONFIG from '@/config'
|
||||||
|
import schema from '@/graphql/schema'
|
||||||
|
import { elopageWebhook } from '@/webhook/elopage'
|
||||||
|
|
||||||
// TODO implement
|
// TODO implement
|
||||||
// import queryComplexity, { simpleEstimator, fieldConfigEstimator } from "graphql-query-complexity";
|
// import queryComplexity, { simpleEstimator, fieldConfigEstimator } from "graphql-query-complexity";
|
||||||
@ -66,9 +51,9 @@ const createServer = async (
|
|||||||
app.use(cors)
|
app.use(cors)
|
||||||
|
|
||||||
// bodyparser json
|
// bodyparser json
|
||||||
app.use(express.json())
|
app.use(json())
|
||||||
// bodyparser urlencoded for elopage
|
// bodyparser urlencoded for elopage
|
||||||
app.use(express.urlencoded({ extended: true }))
|
app.use(urlencoded({ extended: true }))
|
||||||
|
|
||||||
// i18n
|
// i18n
|
||||||
app.use(localization.init)
|
app.use(localization.init)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { backendLogger } from './logger'
|
|
||||||
import i18n from 'i18n'
|
import i18n from 'i18n'
|
||||||
|
import { backendLogger } from './logger'
|
||||||
|
|
||||||
i18n.configure({
|
i18n.configure({
|
||||||
locales: ['en', 'de'],
|
locales: ['en', 'de'],
|
||||||
|
|||||||
@ -1,20 +1,19 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
import log4js from 'log4js'
|
|
||||||
import CONFIG from '@/config'
|
|
||||||
|
|
||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
|
import { configure, getLogger } from 'log4js'
|
||||||
|
import CONFIG from '@/config'
|
||||||
|
|
||||||
const options = JSON.parse(readFileSync(CONFIG.LOG4JS_CONFIG, 'utf-8'))
|
const options = JSON.parse(readFileSync(CONFIG.LOG4JS_CONFIG, 'utf-8'))
|
||||||
|
|
||||||
options.categories.backend.level = CONFIG.LOG_LEVEL
|
options.categories.backend.level = CONFIG.LOG_LEVEL
|
||||||
options.categories.apollo.level = CONFIG.LOG_LEVEL
|
options.categories.apollo.level = CONFIG.LOG_LEVEL
|
||||||
|
|
||||||
log4js.configure(options)
|
configure(options)
|
||||||
|
|
||||||
const apolloLogger = log4js.getLogger('apollo')
|
const apolloLogger = getLogger('apollo')
|
||||||
const backendLogger = log4js.getLogger('backend')
|
const backendLogger = getLogger('backend')
|
||||||
const klickTippLogger = log4js.getLogger('klicktipp')
|
const klickTippLogger = getLogger('klicktipp')
|
||||||
|
|
||||||
backendLogger.addContext('user', 'unknown')
|
backendLogger.addContext('user', 'unknown')
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
// TODO This is super weird - since the entities are defined in another project they have their own globals.
|
// TODO This is super weird - since the entities are defined in another project they have their own globals.
|
||||||
// We cannot use our connection here, but must use the external typeorm installation
|
// We cannot use our connection here, but must use the external typeorm installation
|
||||||
import { Connection, createConnection, FileLogger } from '@dbTools/typeorm'
|
import { Connection, createConnection, FileLogger } from '@dbTools/typeorm'
|
||||||
import CONFIG from '@/config'
|
|
||||||
import { entities } from '@entity/index'
|
import { entities } from '@entity/index'
|
||||||
|
import CONFIG from '@/config'
|
||||||
|
|
||||||
const connection = async (): Promise<Connection | null> => {
|
const connection = async (): Promise<Connection | null> => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
import { Repository, EntityRepository } from '@dbTools/typeorm'
|
import { Repository, EntityRepository } from '@dbTools/typeorm'
|
||||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
@EntityRepository(dbTransactionLink)
|
@EntityRepository(dbTransactionLink)
|
||||||
export class TransactionLinkRepository extends Repository<dbTransactionLink> {
|
export class TransactionLinkRepository extends Repository<dbTransactionLink> {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import SearchUsersFilters from '@/graphql/arg/SearchUsersFilters'
|
|
||||||
import { Brackets, EntityRepository, IsNull, Not, Repository } from '@dbTools/typeorm'
|
import { Brackets, EntityRepository, IsNull, Not, Repository } from '@dbTools/typeorm'
|
||||||
import { User as DbUser } from '@entity/User'
|
import { User as DbUser } from '@entity/User'
|
||||||
|
import SearchUsersFilters from '@/graphql/arg/SearchUsersFilters'
|
||||||
|
|
||||||
@EntityRepository(DbUser)
|
@EntityRepository(DbUser)
|
||||||
export class UserRepository extends Repository<DbUser> {
|
export class UserRepository extends Repository<DbUser> {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
|
|
||||||
import { PasswordEncryptionType } from '@/graphql/enum/PasswordEncryptionType'
|
|
||||||
import { SaveOptions, RemoveOptions } from '@dbTools/typeorm'
|
import { SaveOptions, RemoveOptions } from '@dbTools/typeorm'
|
||||||
import { User as dbUser } from '@entity/User'
|
import { User as dbUser } from '@entity/User'
|
||||||
import { UserContact } from '@entity/UserContact'
|
import { UserContact } from '@entity/UserContact'
|
||||||
|
import { PasswordEncryptionType } from '@/graphql/enum/PasswordEncryptionType'
|
||||||
// import { UserContact as EmailContact } from '@entity/UserContact'
|
// import { UserContact as EmailContact } from '@entity/UserContact'
|
||||||
import { User } from '@model/User'
|
import { User } from '@model/User'
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import 'reflect-metadata' // This might be wise to load in a test setup file
|
|
||||||
import { decayFormula, calculateDecay } from './decay'
|
import { decayFormula, calculateDecay } from './decay'
|
||||||
|
|
||||||
describe('utils/decay', () => {
|
describe('utils/decay', () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import CONFIG from '@/config'
|
import CONFIG from '@/config'
|
||||||
import { Decay } from '@model/Decay'
|
import { Decay } from '@model/Decay'
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
import { User } from '@entity/User'
|
||||||
import connection from '@/typeorm/connection'
|
import connection from '@/typeorm/connection'
|
||||||
import { getKlickTippUser } from '@/apis/KlicktippController'
|
import { getKlickTippUser } from '@/apis/KlicktippController'
|
||||||
import { User } from '@entity/User'
|
|
||||||
import LogError from '@/server/LogError'
|
import LogError from '@/server/LogError'
|
||||||
|
|
||||||
export async function retrieveNotRegisteredEmails(): Promise<string[]> {
|
export async function retrieveNotRegisteredEmails(): Promise<string[]> {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import i18n from 'i18n'
|
import i18n from 'i18n'
|
||||||
|
|
||||||
export const objectValuesToArray = (obj: { [x: string]: string }): Array<string> => {
|
export const objectValuesToArray = (obj: { [x: string]: string }): Array<string> => {
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { calculateDecay } from './decay'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import Decimal from 'decimal.js-light'
|
|
||||||
import { Decay } from '@model/Decay'
|
|
||||||
import { getCustomRepository } from '@dbTools/typeorm'
|
import { getCustomRepository } from '@dbTools/typeorm'
|
||||||
import { TransactionLinkRepository } from '@repository/TransactionLink'
|
|
||||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||||
import { getLastTransaction } from '../graphql/resolver/util/getLastTransaction'
|
import { calculateDecay } from './decay'
|
||||||
|
import { getLastTransaction } from '@/graphql/resolver/util/getLastTransaction'
|
||||||
|
import { TransactionLinkRepository } from '@repository/TransactionLink'
|
||||||
|
import { Decay } from '@model/Decay'
|
||||||
|
|
||||||
function isStringBoolean(value: string): boolean {
|
function isStringBoolean(value: string): boolean {
|
||||||
const lowerValue = value.toLowerCase()
|
const lowerValue = value.toLowerCase()
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import { Transaction } from '@model/Transaction'
|
|
||||||
import { SaveOptions, RemoveOptions } from '@dbTools/typeorm'
|
import { SaveOptions, RemoveOptions } from '@dbTools/typeorm'
|
||||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||||
import { TransactionTypeId } from '@enum/TransactionTypeId'
|
import { Decimal } from 'decimal.js-light'
|
||||||
import { calculateDecay } from './decay'
|
import { calculateDecay } from './decay'
|
||||||
|
import { Transaction } from '@model/Transaction'
|
||||||
|
import { TransactionTypeId } from '@enum/TransactionTypeId'
|
||||||
import { User } from '@model/User'
|
import { User } from '@model/User'
|
||||||
import Decimal from 'decimal.js-light'
|
|
||||||
|
|
||||||
const defaultModelFunctions = {
|
const defaultModelFunctions = {
|
||||||
hasId: function (): boolean {
|
hasId: function (): boolean {
|
||||||
|
|||||||
@ -32,8 +32,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { LoginElopageBuys } from '@entity/LoginElopageBuys'
|
import { LoginElopageBuys } from '@entity/LoginElopageBuys'
|
||||||
import { UserResolver } from '@/graphql/resolver/UserResolver'
|
|
||||||
import { UserContact as dbUserContact } from '@entity/UserContact'
|
import { UserContact as dbUserContact } from '@entity/UserContact'
|
||||||
|
import { UserResolver } from '@/graphql/resolver/UserResolver'
|
||||||
|
|
||||||
export const elopageWebhook = async (req: any, res: any): Promise<void> => {
|
export const elopageWebhook = async (req: any, res: any): Promise<void> => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||||
|
|
||||||
import Decimal from 'decimal.js-light'
|
import { Decimal } from 'decimal.js-light'
|
||||||
|
|
||||||
expect.extend({
|
expect.extend({
|
||||||
decimalEqual(received, value) {
|
decimalEqual(received, value) {
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||||
|
|
||||||
import { createTestClient } from 'apollo-server-testing'
|
import { createTestClient } from 'apollo-server-testing'
|
||||||
import createServer from '../src/server/createServer'
|
|
||||||
import { initialize } from '@dbTools/helpers'
|
import { initialize } from '@dbTools/helpers'
|
||||||
import { entities } from '@entity/index'
|
import { entities } from '@entity/index'
|
||||||
import { i18n, logger } from './testSetup'
|
import { i18n, logger } from './testSetup'
|
||||||
|
import createServer from '@/server/createServer'
|
||||||
|
|
||||||
export const headerPushMock = jest.fn((t) => {
|
export const headerPushMock = jest.fn((t) => {
|
||||||
context.token = t.value
|
context.token = t.value
|
||||||
|
|||||||
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