@@ -586,38 +586,38 @@ Join related records.
586586 const { fastJoin } = require (' feathers-hooks-common' );
587587
588588 const postResolvers = {
589- joins: {
590- author : (... args ) => async post => post .author = (await users .find ({
591- query: { id: post .userId },
592- paginate: false
593- }))[0 ],
589+ joins: {
590+ author : (... args ) => async post => post .author = (await users .find ({
591+ query: { id: post .userId },
592+ paginate: false
593+ }))[0 ],
594594
595- starers : $select => async post => post .starers = await users .find ({
595+ starers : $select => async post => post .starers = await users .find ({
596596 query: { id: { $in: post .starIds }, $select: $select || [' name' ] },
597- paginate: false
598- }),
599- }
597+ paginate: false
598+ }),
599+ }
600600 };
601601
602602 const query = {
603- author: true ,
604- starers: [[' id' , ' name' ]]
603+ author: true ,
604+ starers: [[' id' , ' name' ]]
605605 };
606606
607607 module .exports = { after: {
608- all: [ fastJoin (postResolvers, query) ],
608+ all: [ fastJoin (postResolvers, query) ],
609609 } };
610610
611611 // Original record
612612 [ { id: 1 , body: ' John post' , userId: 101 , starIds: [102 , 103 , 104 ] } ]
613613
614614 // Result
615615 [ { id: 1 ,
616- body: ' John post' ,
617- userId: 101 ,
618- starIds: [ 102 , 103 , 104 ],
619- author: { id: 101 , name: ' John' },
620- starers: [ { name: ' Marshall' }, { name: ' Barbara' }, { name: ' Aubree' } ]
616+ body: ' John post' ,
617+ userId: 101 ,
618+ starIds: [ 102 , 103 , 104 ],
619+ author: { id: 101 , name: ' John' },
620+ starers: [ { name: ' Marshall' }, { name: ' Barbara' }, { name: ' Aubree' } ]
621621 }]
622622
623623 ` ` `
0 commit comments