-
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Plaid): ability to reconnect account
- Loading branch information
Showing
3 changed files
with
91 additions
and
13 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
server/graphql/v2/input/TransactionsImportReferenceInput.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { GraphQLInputObjectType, GraphQLNonNull } from 'graphql'; | ||
import { GraphQLNonEmptyString } from 'graphql-scalars'; | ||
|
||
import { TransactionsImport } from '../../../models'; | ||
import { idDecode } from '../identifiers'; | ||
|
||
export type GraphQLTransactionsImportReferenceInputFields = { | ||
id: string; | ||
}; | ||
|
||
export const GraphQLTransactionsImportReferenceInput = new GraphQLInputObjectType({ | ||
name: 'TransactionsImportReferenceInput', | ||
fields: () => ({ | ||
id: { | ||
type: new GraphQLNonNull(GraphQLNonEmptyString), | ||
description: 'The id of the row', | ||
}, | ||
}), | ||
}); | ||
|
||
export const fetchTransactionsImportWithReference = async ( | ||
input: { id: string }, | ||
{ throwIfMissing = false, ...sequelizeOpts } = {}, | ||
): Promise<TransactionsImport> => { | ||
let row; | ||
if (input.id) { | ||
const decodedId = idDecode(input.id, 'transactions-import-row'); | ||
row = await TransactionsImport.findByPk(decodedId, sequelizeOpts); | ||
} | ||
|
||
if (!row && throwIfMissing) { | ||
throw new Error(`TransactionsImport not found`); | ||
} | ||
|
||
return row; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters