If customFields config is empty all related mutations and queries should not be visible by api clients.
You can validate this running make start-main
(no changes to schema files)
accounts:
initialStatus: active
customFields:
- name: "nationalId"
type: "integer"
defaultValue: 0
- name: "firstName"
type: "string"
required: true
editable: true
- name: "lastName"
type: "string"
editable: true
- name: "isPEP"
type: "boolean"
editable: true
defaultValue: false
- name: "preferences"
type: "boolean"
array: true
editable: true
In the main server (make start-main
) run the next:
mutation AccountCustomFieldsUpdate($input: AccountCustomFieldsUpdateInput!) {
accountCustomFieldsUpdate(input: $input) {
errors {
message
}
accountCustomFields {
firstName
lastName
isPEP
preferences
}
}
}
Input
{"input": { "firstName": "Juan", "lastName": "Lopez", "isPEP": true, "preferences": [true, false, true] }}
Note: please notice that nationalId
can only be updated as an editor (admin api)
query me {
me {
defaultAccount {
defaultWalletId
wallets {
id
walletCurrency
}
customFields {
firstName
lastName
isPEP
preferences
}
}
}
}
Note: please notice that nationalId
is only visible as an editor (admin api)
In the admin server (make start-admin
) as an editor run the next:
mutation AccountCustomFieldsUpdate($input: AccountCustomFieldsUpdateInput!) {
accountCustomFieldsUpdate(input: $input) {
errors {
message
}
accountCustomFields {
nationalId
firstName
lastName
isPEP
preferences
}
}
}
Input
{"input": { "accountId": "<accountId from db>", "nationalId": 123456, "firstName": "Juan", "lastName": "Lopez", "isPEP": true, "preferences": [true, false, true] }}
query getAccountDetailsByUserPhone($phone: Phone!) {
accountDetails: accountDetailsByUserPhone(phone: $phone) {
id
customFields {
nationalId
firstName
lastName
isPEP
preferences
}
createdAt
}
}
Input (updated user's phone)
{"phone": "+16505554322"}
query getAccountDetailsByUsername($username: Username!) {
accountDetails: accountDetailsByUsername(username: $username) {
id
customFields {
nationalId
firstName
lastName
isPEP
preferences
}
createdAt
}
}
Input (updated user's username)
{"username": "userB"}
query AccountsDetailsByCustomField($field: CustomField, $value: String!) {
accountsDetails: accountsDetailsByCustomField(field: $field, value: $value) {
id
username
customFields {
nationalId
firstName
lastName
isPEP
preferences
}
createdAt
}
}
Input
{ "field": "nationalId", "value": "123"}
or
{ "field": "firstName", "value": "jua"}
Note: field is validated similar to the price query, only valid field names are valid values