create-graphql-server-find-by-ids
Adds to the original findByIds an authorization enhancement for the GraphQL-Server-Generator: create-graphql-server
The original tmeasday/mongo-find-by-ids you find here.
Usage
It provides just one function "findByIds", and it adds to the original version of tmeasday the authQuery and later combination of baseQuery and authQuery.
: any { const baseQuery = _id: $in: ids ; const finalQuery = ...baseQuery ...authQuery ; return collection ;}
Installation
Please add the following lines to your create-graphql-server project in server/authenticate.js. If you've forked the original create-graphql-server then don't forget to add it also to the authenticate file in the "skel" folder, otherwise your tests will fail.
;;;;;;; // <===; // <=== const KEY = 'test-key';let Loader; // <=== { if !jwtPayloaduserId throw 'No userId in JWT'; return await Loader; // <===} passport; { Loader = ; // <=== app; app;}