Skip to content

Commit

Permalink
Merge pull request #324 from infinitybase/feat/predicates/fields
Browse files Browse the repository at this point in the history
feat: add fields to return on external predicate route
  • Loading branch information
guimroque authored Oct 29, 2024
2 parents 7c7eebe + 29f7ac3 commit f048bd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/api/src/modules/predicate/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,13 @@ export class PredicateController {
const response = await this.predicateService
.paginate({ page, perPage })
.filter({
select: ['p.id', 'p.predicateAddress', 'p.createdAt'],
select: [
'p.id',
'p.predicateAddress',
'p.createdAt',
'p.root',
'owner.id',
],
})
.listDateMoreThan(d ? new Date(d) : undefined);

Expand Down
5 changes: 4 additions & 1 deletion packages/api/src/modules/predicate/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ export class PredicateService implements IPredicateService {
}

async listDateMoreThan(d?: Date) {
const queryBuilder = Predicate.createQueryBuilder('p');
const queryBuilder = Predicate.createQueryBuilder('p').innerJoin(
'p.owner',
'owner',
);

if (d) {
queryBuilder.where({
Expand Down

0 comments on commit f048bd3

Please sign in to comment.