fix test, remove not longer used files

This commit is contained in:
einhorn_b 2023-12-07 13:56:43 +01:00
parent c961ddaf21
commit c113d95a3c
6 changed files with 19 additions and 50 deletions

View File

@ -1,9 +0,0 @@
export enum AddressType {
NONE = 0, // if no address was found
COMMUNITY_HUMAN = 1, // creation account for human
COMMUNITY_GMW = 2, // community public budget account
COMMUNITY_AUF = 3, // community compensation and environment founds account
COMMUNITY_PROJECT = 4, // no creations allowed
SUBACCOUNT = 5, // no creations allowed
CRYPTO_ACCOUNT = 6, // user control his keys, no creations
}

View File

@ -1,7 +0,0 @@
export enum CrossGroupType {
LOCAL = 0,
INBOUND = 1,
OUTBOUND = 2,
// for cross group transaction which haven't a direction like group friend update
// CROSS = 3,
}

View File

@ -1,3 +1,4 @@
import { LogError } from '@/server/LogError'
import { registerEnumType } from 'type-graphql'
export enum InputTransactionType {
@ -10,3 +11,14 @@ registerEnumType(InputTransactionType, {
name: 'InputTransactionType', // this one is mandatory
description: 'Type of the transaction', // this one is optional
})
// from ChatGPT
export function getTransactionTypeString(id: InputTransactionType): string {
const key = Object.keys(InputTransactionType).find(
(key) => InputTransactionType[key as keyof typeof InputTransactionType] === id,
)
if (key === undefined) {
throw new LogError('invalid transaction type id: ' + id.toString())
}
return key
}

View File

@ -1,27 +0,0 @@
// https://www.npmjs.com/package/@apollo/protobufjs
import { Decimal } from 'decimal.js-light'
import { TransactionType } from '../enum/TransactionType'
import { InputType, Field } from 'type-graphql'
import { IsEnum, IsInt, Min } from 'class-validator'
import { IsPositiveDecimal } from '../validator/Decimal'
@InputType()
export class TransactionInput {
@Field(() => TransactionType)
@IsEnum(TransactionType)
type: TransactionType
@Field(() => Decimal)
@IsPositiveDecimal()
amount: Decimal
@Field(() => Number)
@IsInt()
@Min(978346800)
createdAt: number
// @protoField.d(4, 'string')
// @Field(() => Decimal)
// communitySum: Decimal
}

View File

@ -10,11 +10,11 @@ import { CONFIG } from '@/config'
import { UserFactory } from '@/data/User.factory'
import { UserAccountDraft } from '../input/UserAccountDraft'
import { UserLogic } from '@/data/User.logic'
import { AccountType } from '../enum/AccountType'
import { AccountType } from '@enum/AccountType'
import { UserIdentifier } from '../input/UserIdentifier'
import { CommunityDraft } from '../input/CommunityDraft'
import { AddCommunityContext } from '@/interactions/backendToDb/community/AddCommunity.context'
import { InputTransactionType } from '../enum/InputTransactionType'
import { InputTransactionType, getTransactionTypeString } from '../enum/InputTransactionType'
CONFIG.IOTA_HOME_COMMUNITY_SEED = 'aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899'
@ -82,7 +82,7 @@ describe('Transaction Resolver Test', () => {
input: {
senderUser,
recipientUser,
type: InputTransactionType.SEND,
type: getTransactionTypeString(InputTransactionType.SEND),
amount: '10',
createdAt: '2012-04-17T17:12:00Z',
backendTransactionId: 1,
@ -130,7 +130,7 @@ describe('Transaction Resolver Test', () => {
input: {
senderUser,
recipientUser,
type: InputTransactionType.SEND,
type: getTransactionTypeString(InputTransactionType.SEND),
amount: 'no number',
createdAt: '2012-04-17T17:12:00Z',
backendTransactionId: 1,
@ -156,7 +156,7 @@ describe('Transaction Resolver Test', () => {
input: {
senderUser,
recipientUser,
type: InputTransactionType.SEND,
type: getTransactionTypeString(InputTransactionType.SEND),
amount: '10',
createdAt: 'not valid',
backendTransactionId: 1,
@ -192,7 +192,7 @@ describe('Transaction Resolver Test', () => {
input: {
senderUser,
recipientUser,
type: InputTransactionType.CREATION,
type: getTransactionTypeString(InputTransactionType.CREATION),
amount: '10',
createdAt: '2012-04-17T17:12:00Z',
backendTransactionId: 1,

View File

@ -7,8 +7,8 @@ import { logger } from '@/server/logger'
import { TransactionError } from '@/graphql/model/TransactionError'
import { TransactionErrorType } from '@/graphql/enum/TransactionErrorType'
import { AccountType } from '@/graphql/enum/AccountType'
import { AddressType } from '@/graphql/enum/AddressType'
import { LogError } from '@/server/LogError'
import { AddressType } from '@/data/proto/3_3/enum/AddressType'
export const uuid4ToBuffer = (uuid: string): Buffer => {
// Remove dashes from the UUIDv4 string