Skip to content

Commit

Permalink
feat(TransactionQuery): Use transaction reference input as query argu…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
gustavlrsn committed May 7, 2024
1 parent 58aecf5 commit 7067cc6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/graphql/v2/query/TransactionQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { GraphQLString } from 'graphql';

import models from '../../../models';
import { NotFound } from '../../errors';
import { fetchTransactionWithReference, GraphQLTransactionReferenceInput } from '../input/TransactionReferenceInput';
import { GraphQLTransaction } from '../interface/Transaction';

const TransactionQuery = {
Expand All @@ -11,11 +12,17 @@ const TransactionQuery = {
id: {
type: GraphQLString,
description: 'The public id identifying the transaction (ie: rvelja97-pkzqbgq7-bbzyx6wd-50o8n4rm)',
deprecationReason: '2024-05-07: Please use the `trannsaction` field.',
},
transaction: {
type: GraphQLTransactionReferenceInput,
},
},
async resolve(_, args) {
let transaction;
if (args.id) {
if (args.expense) {
transaction = await fetchTransactionWithReference(args.transaction, req);

Check failure on line 24 in server/graphql/v2/query/TransactionQuery.ts

View workflow job for this annotation

GitHub Actions / typescript

Cannot find name 'req'.
} else if (args.id) {
transaction = await models.Transaction.findOne({ where: { uuid: args.id } });
} else {
return new Error('Please provide an id');
Expand Down

0 comments on commit 7067cc6

Please sign in to comment.