Skip to content

Commit

Permalink
fixes #1688
Browse files Browse the repository at this point in the history
  • Loading branch information
koskimas committed Jul 16, 2021
1 parent e56cc26 commit 144f292
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 132 deletions.
8 changes: 4 additions & 4 deletions tests/ts/custom-query-builder.ts
Expand Up @@ -34,25 +34,25 @@ class Person extends BaseModel {
pets!: Animal[];
}

const people: Promise<Person[]> = Person.query()
const people: CustomQueryBuilder<Person, Person[]> = Person.query()
.someCustomMethod()
.where('firstName', 'lol')
.someCustomMethod()
.with('someAlias', (qb) => qb.someCustomMethod().from('lol').select('id'))
.modifyEager<Animal>('pets', (qb) => qb.someCustomMethod().where('id', 1).someCustomMethod());

const pets: Promise<Animal> = new Person()
const pets: CustomQueryBuilder<Animal, Animal> = new Person()
.$relatedQuery('pets')
.someCustomMethod()
.where('id', 1)
.first()
.someCustomMethod();

const numUpdated: Promise<number> = Person.query()
const numUpdated: CustomQueryBuilder<Person, number> = Person.query()
.someCustomMethod()
.patch({ firstName: 'test' })
.someCustomMethod();

const allPets: Promise<Animal[]> = Person.relatedQuery('pets')
const allPets: PromiseLike<Animal[]> = Person.relatedQuery('pets')
.for(Person.query().select('id'))
.someCustomMethod();

0 comments on commit 144f292

Please sign in to comment.