-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict between ServiceClass and AssemblerClass #167
Comments
I have to say that I personally do not use assembles, looking at the code I have the feeling that the docs are either missing some information on how to make this work (As I have the feeling the I would need to take a deeper look into how these parts work before I could help you with the issue. |
Yeah. In my POC with assemblers, I got the automation along with the assembler working by extending the @Assembler(UserDTO, UserEntity)
export class UserAssembler extends ClassTransformerAssembler<UserDTO, UserEntity> {}
@Injectable()
@QueryService(UserDTO)
export class UserService extends AssemblerQueryService<UserDTO, UserEntity> {
constructor (
readonly assembler: UserAssembler,
@InjectQueryService(UserEntity) private readonly userService: QueryService<UserEntity>
) {
super(assembler, userService)
} And of course, I entered my Seems the Edit: Yeah, I probably just took a look at this and said to myself, why not just extend it? Scott |
Closing, if still an issue please reopen. |
Describe the bug
When using
AutoResolver
and bothServiceClass
andAssemblerClass
are set, onlyAssemblerClass
will take effect andServiceClass
will not work.Have you read the Contributing Guidelines?
Yes
To Reproduce
Steps to reproduce the behavior:
Define the following resources.
Calling the GQL Mutation API
createOneTest
and observing the terminal, I only seeAssembler convertToCreateEntity!
.https://github.com/TriPSs/nestjs-query/blob/master/packages/query-graphql/src/providers/resolver.provider.ts#L167-L185
According to its logic, Assembler and CustomService are mutually exclusive, and the Assembler takes precedence over the Service to take effect.
Expected behavior
When using Custom Service and Assembler at the same time, make them automatically form a chain call, i.e. the Service automatically uses the Assembler for data conversion.
According to the documentation, the Assembler acts as a bridge between the DTO and the Service, and the Custom Service is apparently not included here, which is a bit strange, to be honest.
I noticed that this project's predecessor was also implemented this way, was this by any particular design?
Users often use Custom Services for purposes such as soft deletion, but Assembler still has a role to play, such as injecting foreign keys into the entity, such as
createdBy
.Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: