This may be a very stupid question, but I am kinda stuck.
When I want to get all the project queries based on a project id, everything works like a charm. What I want to do is to get only the project queries within a certain timeframe.
Where can I specify additional arguments for that?
I am using MongoDB, Apollo and Graphql, all in Typescript.
Thanks!
Query
const GET_QUERY_DATA = gql`
query getQueryData($projectId: String!) {
projectQueries(id: $projectId) {
number
latency
complexity
loggedOn
depth
timestamp
tokens
success
}
}
`;
Resolver:
projectQueries: (parent: undefined, args: QueryByID): Promise<ProjectQuery[] | Error> => {
const { id } = args;
return QueryDB.find({ projectID: id })
.then((queries: ProjectQuery[]): ProjectQuery[] => queries)
.catch((err: Error): Error => new Error(`DB query failed: ${err}`));
}