mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
include decimal with precision definition
This commit is contained in:
parent
67cddadd1e
commit
9c27568f77
@ -1,16 +1,8 @@
|
||||
// ATTENTION: DO NOT PUT ANY SECRETS IN HERE (or the .env)
|
||||
|
||||
import dotenv from 'dotenv'
|
||||
import Decimal from 'decimal.js-light'
|
||||
dotenv.config()
|
||||
|
||||
// Set precision value
|
||||
// TODO test if this works here
|
||||
Decimal.set({
|
||||
precision: 25,
|
||||
rounding: Decimal.ROUND_HALF_UP,
|
||||
})
|
||||
|
||||
const constants = {
|
||||
DB_VERSION: '0028-clean_transaction_table',
|
||||
DECAY_START_TIME: new Date('2021-05-13 17:46:31'), // GMT+0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ArgsType, Field } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from '../../util/decimal'
|
||||
|
||||
@ArgsType()
|
||||
export default class TransactionSendArgs {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import Decimal from '../../util/decimal'
|
||||
|
||||
@ObjectType()
|
||||
export class Balance {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import Decimal from '../../util/decimal'
|
||||
|
||||
@ObjectType()
|
||||
export class Decay {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import { Decay } from './Decay'
|
||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
import Decimal from '../../util/decimal'
|
||||
import { TransactionTypeId } from '../enum/TransactionTypeId'
|
||||
import { User } from './User'
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { ObjectType, Field } from 'type-graphql'
|
||||
import CONFIG from '../../config'
|
||||
import Decimal from '../../util/decimal'
|
||||
import { Transaction } from './Transaction'
|
||||
|
||||
@ObjectType()
|
||||
|
||||
@ -27,7 +27,7 @@ import { hasElopageBuys } from '../../util/hasElopageBuys'
|
||||
import { LoginEmailOptIn } from '@entity/LoginEmailOptIn'
|
||||
import { User } from '@entity/User'
|
||||
import { TransactionTypeId } from '../enum/TransactionTypeId'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from '../../util/decimal'
|
||||
|
||||
// const EMAIL_OPT_IN_REGISTER = 1
|
||||
// const EMAIL_OPT_UNKNOWN = 3 // elopage?
|
||||
|
||||
@ -8,7 +8,7 @@ import { UserRepository } from '../../typeorm/repository/User'
|
||||
import { calculateDecay } from '../../util/decay'
|
||||
import { RIGHTS } from '../../auth/RIGHTS'
|
||||
import { Transaction } from '@entity/Transaction'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from '../../util/decimal'
|
||||
|
||||
@Resolver()
|
||||
export class BalanceResolver {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { GraphQLSchema } from 'graphql'
|
||||
import { buildSchema } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import path from 'path'
|
||||
|
||||
import isAuthorized from './directive/isAuthorized'
|
||||
import DecimalScalar from './scalar/Decimal'
|
||||
import Decimal from '../util/decimal'
|
||||
|
||||
const schema = async (): Promise<GraphQLSchema> => {
|
||||
return buildSchema({
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { sendTransactionReceivedEmail } from './sendTransactionReceivedEmail'
|
||||
import { sendEMail } from './sendEMail'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from '../util/decimal'
|
||||
|
||||
jest.mock('./sendEMail', () => {
|
||||
return {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from '../util/decimal'
|
||||
import { sendEMail } from './sendEMail'
|
||||
import { transactionReceived } from './text/transactionReceived'
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from '../../util/decimal'
|
||||
|
||||
export const transactionReceived = {
|
||||
de: {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from './decimal'
|
||||
import 'reflect-metadata' // This might be wise to load in a test setup file
|
||||
import { decayFormula, calculateDecay } from './decay'
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { calculateDecay } from './decay'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from './decimal'
|
||||
import { Transaction } from '@entity/Transaction'
|
||||
|
||||
function isStringBoolean(value: string): boolean {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import Decimal from 'decimal.js-light'
|
||||
import Decimal from './decimal'
|
||||
import { SaveOptions, RemoveOptions } from '@dbTools/typeorm'
|
||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
import { calculateDecay } from './decay'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user