-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(2739): review updates and suggestions from Blair.
- Loading branch information
Showing
13 changed files
with
173 additions
and
129 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
bruno/collections/Rafiki/Rafiki Admin APIs/Get Wallet Address Additional Properties.bru
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,29 @@ | ||
meta { | ||
name: Get Wallet Address Additional Properties | ||
type: graphql | ||
seq: 21 | ||
} | ||
|
||
post { | ||
url: {{RafikiGraphqlHost}}/graphql | ||
body: graphql | ||
auth: none | ||
} | ||
|
||
body:graphql { | ||
query GetWalletAddressAdditionalProperties { | ||
additionalProperties { | ||
properties { | ||
key | ||
value | ||
visibleInOpenPayments | ||
} | ||
} | ||
} | ||
} | ||
|
||
script:pre-request { | ||
const scripts = require('./scripts'); | ||
|
||
scripts.addApiSignatureHeader(); | ||
} |
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
14 changes: 9 additions & 5 deletions
14
localenv/mock-account-servicing-entity/generated/graphql.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
55 changes: 30 additions & 25 deletions
55
packages/backend/src/graphql/generated/graphql.schema.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
39 changes: 39 additions & 0 deletions
39
packages/backend/src/graphql/resolvers/walletAddressAdditionalProperties.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,39 @@ | ||
import { | ||
ResolversTypes, | ||
AdditionalProperty, | ||
QueryResolvers | ||
} from '../generated/graphql' | ||
import { ApolloContext } from '../../app' | ||
import { WalletAddressAdditionalProperty } from '../../open_payments/wallet_address/additional_property/model' | ||
|
||
export const getWalletAddressAdditionalProperties: QueryResolvers<ApolloContext>['additionalProperties'] = | ||
async ( | ||
parent, | ||
args, | ||
ctx | ||
): Promise<ResolversTypes['AdditionalPropertyConnection']> => { | ||
if (!args.walletAddressId) { | ||
throw new Error('missing wallet address id') | ||
} | ||
const walletAddressService = await ctx.container.use('walletAddressService') | ||
const additionalProperties = | ||
await walletAddressService.getAdditionalProperties( | ||
args.walletAddressId, | ||
false // Include all Additional Properties | ||
) | ||
if (!additionalProperties) return { properties: [] } | ||
|
||
return { | ||
properties: additionalProperties.map((itm) => | ||
additionalPropertyToGraphql(itm) | ||
) | ||
} | ||
} | ||
|
||
export const additionalPropertyToGraphql = ( | ||
addProp: WalletAddressAdditionalProperty | ||
): AdditionalProperty => ({ | ||
key: addProp.fieldKey, | ||
value: addProp.fieldValue, | ||
visibleInOpenPayments: addProp.visibleInOpenPayments | ||
}) |
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
Oops, something went wrong.