File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ export function discardQuery(...fieldNames: string[]): Hook;
142
142
*/
143
143
export function existsByDot ( object : any , path : string ) : boolean ;
144
144
145
- export type SimpleResolver < T > = ( ...args : any [ ] ) => ( item : T ) => Promise < any > ;
145
+ export type SimpleResolver < T > = ( ...args : any [ ] ) => ( item : T , context : HookContext ) => Promise < any > ;
146
146
147
147
export interface RecursiveResolver < T > {
148
148
resolver : SimpleResolver < T > ;
Original file line number Diff line number Diff line change @@ -182,6 +182,21 @@ const postResolvers: ResolverMap<any> = {
182
182
}
183
183
} ;
184
184
185
+ const userResolvers = {
186
+ joins : {
187
+ memberships : ( ) => async ( user : any , context : HookContext ) => {
188
+ const memberships : any = ( await context . app ! . service
189
+ ( 'memberships' ) . find ( { query : {
190
+ user : user . _id ,
191
+ $populate : 'role' ,
192
+ } } ) ) ;
193
+ user . memberships = memberships . data ;
194
+ }
195
+ }
196
+ } ;
197
+
198
+ // $ExpectType Hook
199
+ fastJoin ( userResolvers ) ;
185
200
// $ExpectType Hook
186
201
fastJoin ( postResolvers ) ;
187
202
// $ExpectType Hook
You can’t perform that action at this time.
0 commit comments