diff --git a/backend/src/graphql/arg/Paginated.ts b/backend/src/graphql/arg/Paginated.ts index f365165de..97326caf2 100644 --- a/backend/src/graphql/arg/Paginated.ts +++ b/backend/src/graphql/arg/Paginated.ts @@ -11,10 +11,4 @@ export default class Paginated { @Field(() => Order, { nullable: true }) order?: Order - - @Field(() => Boolean, { nullable: true }) - onlyCreations?: boolean - - @Field(() => Int, { nullable: true }) - userId?: number } diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 258ea9da6..03640817f 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -17,7 +17,6 @@ import Paginated from '@arg/Paginated' import { Order } from '@enum/Order' -import { UserRepository } from '@repository/User' import { TransactionRepository } from '@repository/Transaction' import { TransactionLinkRepository } from '@repository/TransactionLink' @@ -131,22 +130,11 @@ export class TransactionResolver { @Query(() => TransactionList) async transactionList( @Args() - { - currentPage = 1, - pageSize = 25, - order = Order.DESC, - onlyCreations = false, - userId, - }: Paginated, + { currentPage = 1, pageSize = 25, order = Order.DESC }: Paginated, @Ctx() context: any, ): Promise { const now = new Date() - // find user - const userRepository = getCustomRepository(UserRepository) - // TODO: separate those usecases - this is a security issue - const user = userId - ? await userRepository.findOneOrFail({ id: userId }, { withDeleted: true }) - : await userRepository.findByPubkeyHex(context.pubKey) + const user = context.user // find current balance const lastTransaction = await dbTransaction.findOne( @@ -182,7 +170,6 @@ export class TransactionResolver { pageSize, offset, order, - onlyCreations, ) // find involved users; I am involved @@ -208,7 +195,7 @@ export class TransactionResolver { await transactionLinkRepository.summary(user.id, now) // decay & link transactions - if (!onlyCreations && currentPage === 1 && order === Order.DESC) { + if (currentPage === 1 && order === Order.DESC) { transactions.push( virtualDecayTransaction(lastTransaction.balance, lastTransaction.balanceDate, now, self), ) diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 5887d585a..c2efe34d8 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -43,18 +43,8 @@ export const logout = gql` ` export const transactionsQuery = gql` - query( - $currentPage: Int = 1 - $pageSize: Int = 25 - $order: Order = DESC - $onlyCreations: Boolean = false - ) { - transactionList( - currentPage: $currentPage - pageSize: $pageSize - order: $order - onlyCreations: $onlyCreations - ) { + query($currentPage: Int = 1, $pageSize: Int = 25, $order: Order = DESC) { + transactionList(currentPage: $currentPage, pageSize: $pageSize, order: $order) { balanceGDT count linkCount