wesleyyoung / perch-query-builder

Dynamically build TypeORM queries based on GraphQL queries for NestJS and TypeORM
GNU General Public License v3.0
46 stars 9 forks source link

Usage for mutation #16

Open nikitakoschelenko opened 3 years ago

nikitakoschelenko commented 3 years ago

Describe the bug My code is:

image image

In console I'm getting an error: image image

In query it's working perfectly.

wesleyyoung commented 3 years ago

I'll look into the issue as soon as I can.

Question though, why are you using PerchQueryBuilder for this at all if you are going to append

.select()
.where({ id: family.id })
.getOne()

to the query? You are removing all previous selections and joins made by perch and rendering any where clauses added by the package completely useless. If that is all that you need from the resolver then this package isn't necessary

wesleyyoung commented 3 years ago

If your desire is to force the query into selection of a single record, try appending

.andWhere({ id: family.id })
.getOne()
nikitakoschelenko commented 3 years ago

If your desire is to force the query into selection of a single record, try appending

.andWhere({ id: family.id })
.getOne()

Not working :(

return PerchQueryBuilder.generateQueryBuilder<Family>(
  this.familiesRepository,
  info
)
  .andWhere({ id: family.id })
  .getOne();

image

wesleyyoung commented 3 years ago

Fixed in PR #17

nikitakoschelenko commented 3 years ago

Same in version 1.3.2

nikitakoschelenko commented 3 years ago

@wesleyyoung reopen please

gaghan430 commented 2 years ago

@wesleyyoung hi, I don't know is it only me or not, but because of that PR, the pagination & sorting do not work anymore Im using PerchQueryBuilder.find()

confirmed: I tried to comment it out, and it worked