Backend
Accounts are now customized to add multiple fields.
- Accounts module is imported from
adminide-stack/accounts-api-serverthe module has basic fields likeemail, phone number, etcand those are added to graphql schema and mongo schema like below.
Mongo Schema

Graphql Schema

- We can inject the default mongo schema through the module.


- But if we need to customize accounts to add more fields, we can skip the default module.
a) Add extended fields in mongo scheme like below.

b) As well graphql extension. Make sure to add the directives @isAuthenticated @addAccountContext at the end.

Generate graphql types by running yarn generateGraphql and all the new files generated need to be compiled in those specific packages.
c) Write service

d) Add necessary types to refer in the Container

e) Bind to the IAccountMongoExtSchema in Container for extending Account's Mongo Schema. Also bind ExtendedAccountServce for accessing in the resolvers.

d) Write the resolver to get the specific field data

f) Include it in the modules

Frontend
On frontend you can write queries how you want.
For example if you need to get Composite Account data including the basic account field + exntended account fields, you can query in one gql
Fragment

Query

Also you can call individual queries

After any changes to .gql or .graphql make sure to run yarn generateGraphql to generate types.