mirror of
https://github.com/wassname/talk.git
synced 2026-07-29 11:28:24 +08:00
Added explicit joinBy to dataLoader reponse
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
const DataLoader = require('dataloader');
|
||||
|
||||
const util = require('./util');
|
||||
|
||||
const UsersService = require('../../services/users');
|
||||
|
||||
const genUserByIDs = (context, ids) => UsersService.findByIdArray(ids);
|
||||
const genUserByIDs = (context, ids) => UsersService
|
||||
.findByIdArray(ids)
|
||||
.then(util.arrayJoinBy(ids, 'id'));
|
||||
|
||||
/**
|
||||
* Creates a set of loaders based on a GraphQL context.
|
||||
|
||||
Reference in New Issue
Block a user