- createGetStockList
- createGetSingleStock
- getStockList
- getSingleStock
- getFields
- DatabaseWrapper
- searchStocks
Factory function for the getStockList resolver.
getFields
Function To extract what fields requested in the query (optional, defaultrequire('../helpers/fieldsHelper').getFields
)DatabaseWrapper
Class To handle all the db functions (optional, defaultrequire('../../database/DatabaseWrapper')
)searchStocks
Function To filter all the stocks by the args provided. (optional, defaultrequire('../helpers/stockSearcher').searchStocks
)
Returns Function getStockList
Factory function for getSingleStock
getFields
Function To extract what fields requested in the query (optional, defaultrequire('../helpers/fieldsHelper').getFields
)DatabaseWrapper
Class To handle all the db functions (optional, defaultrequire('../../database/DatabaseWrapper')
)
Returns Function getSingleStock
Resolver function to get list of stocks. Searches by all the parameters given and fetches only the fields needed to minimize data usage.
root
Objectargs
Object Arguments provided in the querycontext
Objectinfo
Object Information about the fields requested etc.
Returns Array<Object> List of stocks
Resolve function to get a single stock with the fields specified in the query.
root
Objectargs
Object Arguments provided with the queryargs.id
number Id of the stock to get
context
Objectinfo
Object Information about the fields requested etc.
Helper function to extract the fields requested in a query
info
Object theinfo
object that gets passed to the resolver
Wrapper for database functions
Firestore
Class The Firestore library (optional, defaultrequire('@google-cloud/firestore')
)secrets
Object Credentials to Firestore (optional, defaultrequire('../../secrets.json')
)
Gets the summary document from the database with info such as name and list of each stock.
Returns Object Object with information about each stock
Fetches all the stocks and the fields specified. If no fields are specified all will be fetched.
Fetches stocks by Id and the fields specified. If no fields are specified all will be fetched.
idsToGet
Array<Number>fields
Array<String> The fields that should be fetched from the database (optional, default[]
)
Fetches single stock by id from the database with the fields provided.
Returns Object A single stock
Function to filter down a list of stocks by the arguments passed to the query. It uses the AND operator, ie. that if both name and list is provided both args must match.