mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
fixes
This commit is contained in:
parent
9febdbf81b
commit
721ccecd12
@ -1,4 +1,4 @@
|
||||
import jwt from 'jsonwebtoken'
|
||||
import { verify, sign } from 'jsonwebtoken'
|
||||
import CONFIG from '@/config/'
|
||||
import { CustomJwtPayload } from './CustomJwtPayload'
|
||||
import LogError from '@/server/LogError'
|
||||
@ -6,14 +6,14 @@ import LogError from '@/server/LogError'
|
||||
export const decode = (token: string): CustomJwtPayload | null => {
|
||||
if (!token) throw new LogError('401 Unauthorized')
|
||||
try {
|
||||
return <CustomJwtPayload>jwt.verify(token, CONFIG.JWT_SECRET)
|
||||
return <CustomJwtPayload>verify(token, CONFIG.JWT_SECRET)
|
||||
} catch (err) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
})
|
||||
return token
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
|
||||
|
||||
import dotenv from 'dotenv'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
dotenv.config()
|
||||
|
||||
Decimal.set({
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* 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'
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import CONFIG from '@/config'
|
||||
import { decimalSeparatorByLanguage } from '@/util/utilities'
|
||||
import { sendEmailTranslated } from './sendEmailTranslated'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { EventProtocol as DbEvent } from '@entity/EventProtocol'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { EventProtocolType } from './EventProtocolType'
|
||||
|
||||
export const Event = (
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ArgsType, Field, InputType } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@InputType()
|
||||
@ArgsType()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ArgsType()
|
||||
export default class AdminUpdateContributionArgs {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ArgsType, Field, InputType } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@InputType()
|
||||
@ArgsType()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ArgsType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ArgsType()
|
||||
export default class ContributionLinkArgs {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ArgsType, Field } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ArgsType()
|
||||
export default class TransactionLinkArgs {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ArgsType, Field } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ArgsType()
|
||||
export default class TransactionSendArgs {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ObjectType()
|
||||
export class AdminUpdateContribution {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ObjectType, Field, Int, Float } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ObjectType()
|
||||
export class Balance {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ObjectType()
|
||||
export class DynamicStatisticsFields {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { User } from '@entity/User'
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 CONFIG from '@/config'
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
interface DecayInterface {
|
||||
balance: Decimal
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@ObjectType()
|
||||
export class OpenCreation {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { Decay } from './Decay'
|
||||
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 { User } from './User'
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { User } from './User'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { User } from '@entity/User'
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { User } from '@entity/User'
|
||||
|
||||
@ObjectType()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* 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 { getCustomRepository } from '@dbTools/typeorm'
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* 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 {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { Resolver, Args, Arg, Authorized, Mutation, Query, Int } from 'type-graphql'
|
||||
import { MoreThan, IsNull } from '@dbTools/typeorm'
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
||||
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* 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 { IsNull, getConnection } from '@dbTools/typeorm'
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* 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 { getConnection } from '@dbTools/typeorm'
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ import { listTransactionLinksAdmin } from '@/seeds/graphql/queries'
|
||||
import { ContributionLink as DbContributionLink } from '@entity/ContributionLink'
|
||||
import { User } from '@entity/User'
|
||||
import { UnconfirmedContribution } from '@model/UnconfirmedContribution'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { GraphQLError } from 'graphql'
|
||||
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
|
||||
import { logger } from '@test/testSetup'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { randomBytes } from 'crypto'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import { EventProtocolType } from '@/event/EventProtocolType'
|
||||
import { userFactory } from '@/seeds/factory/user'
|
||||
import {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* eslint-disable new-cap */
|
||||
/* 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 { getCustomRepository, getConnection, In } from '@dbTools/typeorm'
|
||||
|
||||
|
||||
@ -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 FULL_CREATION_AVAILABLE = [
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* 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 { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
|
||||
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
||||
|
||||
@ -4,7 +4,7 @@ import LogError from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
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'
|
||||
|
||||
interface CreationMap {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { GraphQLScalarType, Kind } from 'graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
export default new GraphQLScalarType({
|
||||
name: 'Decimal',
|
||||
|
||||
@ -4,7 +4,7 @@ import path from 'path'
|
||||
|
||||
import isAuthorized from './directive/isAuthorized'
|
||||
import DecimalScalar from './scalar/Decimal'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
const schema = async (): Promise<GraphQLSchema> => {
|
||||
return buildSchema({
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const subscribeNewsletter = gql`
|
||||
mutation ($email: String!, $language: String!) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import gql from 'graphql-tag'
|
||||
import { gql } from 'graphql-tag'
|
||||
|
||||
export const verifyLogin = gql`
|
||||
query {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Role } from '@/auth/Role'
|
||||
import { User as dbUser } from '@entity/User'
|
||||
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 LogError from './LogError'
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
import 'reflect-metadata'
|
||||
|
||||
import { ApolloServer } from 'apollo-server-express'
|
||||
import express, { Express } from 'express'
|
||||
import express, { Express, json, urlencoded } from 'express'
|
||||
|
||||
// database
|
||||
import connection from '@/typeorm/connection'
|
||||
@ -66,9 +66,9 @@ const createServer = async (
|
||||
app.use(cors)
|
||||
|
||||
// bodyparser json
|
||||
app.use(express.json())
|
||||
app.use(json())
|
||||
// bodyparser urlencoded for elopage
|
||||
app.use(express.urlencoded({ extended: true }))
|
||||
app.use(urlencoded({ extended: true }))
|
||||
|
||||
// i18n
|
||||
app.use(localization.init)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import log4js from 'log4js'
|
||||
import { configure, getLogger } from 'log4js'
|
||||
import CONFIG from '@/config'
|
||||
|
||||
import { readFileSync } from 'fs'
|
||||
@ -10,11 +10,11 @@ const options = JSON.parse(readFileSync(CONFIG.LOG4JS_CONFIG, 'utf-8'))
|
||||
options.categories.backend.level = CONFIG.LOG_LEVEL
|
||||
options.categories.apollo.level = CONFIG.LOG_LEVEL
|
||||
|
||||
log4js.configure(options)
|
||||
configure(options)
|
||||
|
||||
const apolloLogger = log4js.getLogger('apollo')
|
||||
const backendLogger = log4js.getLogger('backend')
|
||||
const klickTippLogger = log4js.getLogger('klicktipp')
|
||||
const apolloLogger = getLogger('apollo')
|
||||
const backendLogger = getLogger('backend')
|
||||
const klickTippLogger = getLogger('klicktipp')
|
||||
|
||||
backendLogger.addContext('user', 'unknown')
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { Repository, EntityRepository } from '@dbTools/typeorm'
|
||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
@EntityRepository(dbTransactionLink)
|
||||
export class TransactionLinkRepository extends Repository<dbTransactionLink> {
|
||||
|
||||
@ -1,4 +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'
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import CONFIG from '@/config'
|
||||
import { Decay } from '@model/Decay'
|
||||
import LogError from '@/server/LogError'
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
import i18n from 'i18n'
|
||||
|
||||
export const objectValuesToArray = (obj: { [x: string]: string }): Array<string> => {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { TransactionLinkRepository } from '@repository/TransactionLink'
|
||||
|
||||
@ -5,7 +5,7 @@ import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
import { TransactionTypeId } from '@enum/TransactionTypeId'
|
||||
import { calculateDecay } from './decay'
|
||||
import { User } from '@model/User'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
const defaultModelFunctions = {
|
||||
hasId: function (): boolean {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-empty-interface */
|
||||
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Decimal } from 'decimal.js-light'
|
||||
|
||||
expect.extend({
|
||||
decimalEqual(received, value) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user