Open
Description
How to convert the result of the database into a relay-connection style response? This is a workaround that I am currently using:
@Query(() => ActivitiesViewConnection)
async activitiesViews(
@Args() query: ActivitiesViewQuery,
): Promise<ConnectionType<ActivitiesView>> {
// custom and complex querying logic
let qb = this.filterQueryBuilder.select(query);
const [result, total] = await qb.getManyAndCount();
return ActivitiesViewConnection.createFromPromise(
(q) => Promise.resolve(result),
query,
(q) => Promise.resolve(total),
);
}
I would prefer a cleaner way of mapping the result into a relay-connection style response