Closed detwait closed 5 months ago
I've never worked with microservices but maybe if you added a user resolver in your complaints module, you could make it work. Something like this:
// complaints.module.ts
@Module({
imports: [
NestjsQueryGraphQLModule.forFeature({
imports: [/* ... */],
resolvers: [
{
DTOClass: ComplaintDto,
// ...
},
{ // Add this
DTOClass: UserDto,
// Maybe also provide a ServiceClass?
},
],
services: [/* ... */],
}),
],
// ...
})
export class ComplaintModule {}
You would also get rid of your @ResolveField()
for user.
Otherwise, microservices are also mentioned in the Assemblers section of the docs.
I hope that helps.
I also have never worked with microservices of NestJs, please try the suggestion of @GP4cK.
If still an issue you can re-open the ticket.
Let say we have 2 microservices: users and complaints.
UserDto in user ms has @FilterableUnPagedRelation('roles', () => UserDto, { nullable: true })
In complaints ms we have ComplaintDto with id, userId and "user" field. User field is handled in the same resolver via @ResolveField('user', () => UserDto, { nullable: true }) (UserDto is stored in shared package and imported to both microservices)
Expected behavior To see in Complaint MS "roles" array in user schema. But it just see fields that was defined inside UserDto class itself.
How to get those "roles" field ? Define it inside UserDto explicitly as well as via FilterableUnPagedRelation() ? And how to solve it for @FilterableOffsetConnection() too ?
@TriPSs ?