diff --git a/backend/src/graphql/resolver/AdminResolver.ts b/backend/src/graphql/resolver/AdminResolver.ts index 12cad529c..84ae09cf8 100644 --- a/backend/src/graphql/resolver/AdminResolver.ts +++ b/backend/src/graphql/resolver/AdminResolver.ts @@ -54,11 +54,11 @@ import { updateCreations, } from './util/creations' import { - CONTRIBUTIONLINK_MEMO_MAX_CHARS, - CONTRIBUTIONLINK_MEMO_MIN_CHARS, CONTRIBUTIONLINK_NAME_MAX_CHARS, CONTRIBUTIONLINK_NAME_MIN_CHARS, FULL_CREATION_AVAILABLE, + MEMO_MAX_CHARS, + MEMO_MIN_CHARS, } from './const/const' // const EMAIL_OPT_IN_REGISTER = 1 @@ -595,11 +595,8 @@ export class AdminResolver { logger.error(`The memo must be initialized!`) throw new Error(`The memo must be initialized!`) } - if ( - memo.length < CONTRIBUTIONLINK_MEMO_MIN_CHARS || - memo.length > CONTRIBUTIONLINK_MEMO_MAX_CHARS - ) { - const msg = `The value of 'memo' with a length of ${memo.length} did not fulfill the requested bounderies min=${CONTRIBUTIONLINK_MEMO_MIN_CHARS} and max=${CONTRIBUTIONLINK_MEMO_MAX_CHARS}` + if (memo.length < MEMO_MIN_CHARS || memo.length > MEMO_MAX_CHARS) { + const msg = `The value of 'memo' with a length of ${memo.length} did not fulfill the requested bounderies min=${MEMO_MIN_CHARS} and max=${MEMO_MAX_CHARS}` logger.error(`${msg}`) throw new Error(`${msg}`) } diff --git a/backend/src/graphql/resolver/ContributionResolver.ts b/backend/src/graphql/resolver/ContributionResolver.ts index c6b129b5f..a22715fb4 100644 --- a/backend/src/graphql/resolver/ContributionResolver.ts +++ b/backend/src/graphql/resolver/ContributionResolver.ts @@ -11,9 +11,7 @@ import { Contribution, ContributionListResult } from '@model/Contribution' import { UnconfirmedContribution } from '@model/UnconfirmedContribution' import { User } from '@model/User' import { validateContribution, getUserCreation, updateCreations } from './util/creations' - -const MEMO_MAX_CHARS = 255 -const MEMO_MIN_CHARS = 5 +import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const' @Resolver() export class ContributionResolver { diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 023e5b2ff..bc062a1f4 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -34,9 +34,7 @@ import { virtualLinkTransaction, virtualDecayTransaction } from '@/util/virtualT import Decimal from 'decimal.js-light' import { BalanceResolver } from './BalanceResolver' - -const MEMO_MAX_CHARS = 255 -const MEMO_MIN_CHARS = 5 +import { MEMO_MAX_CHARS, MEMO_MIN_CHARS } from './const/const' export const executeTransaction = async ( amount: Decimal, diff --git a/backend/src/graphql/resolver/const/const.ts b/backend/src/graphql/resolver/const/const.ts index d5ba08784..e4eb9a13b 100644 --- a/backend/src/graphql/resolver/const/const.ts +++ b/backend/src/graphql/resolver/const/const.ts @@ -8,5 +8,5 @@ export const FULL_CREATION_AVAILABLE = [ ] export const CONTRIBUTIONLINK_NAME_MAX_CHARS = 100 export const CONTRIBUTIONLINK_NAME_MIN_CHARS = 5 -export const CONTRIBUTIONLINK_MEMO_MAX_CHARS = 255 -export const CONTRIBUTIONLINK_MEMO_MIN_CHARS = 5 +export const MEMO_MAX_CHARS = 255 +export const MEMO_MIN_CHARS = 5