Using RepositoryQuery
import { RepositoryQuery, FindParams, Where } from '@soapjs/soap';
export class ThreatsQuery extends RepositoryQuery<FindParams> {
constructor(private readonly universe?: string) { super(); }
build(): FindParams {
const where = new Where()
.brackets(w => w.valueOf('alignment').isEq('villain').or.valueOf('alignment').isEq('anti-hero'));
if (this.universe) where.and.valueOf('universe').isEq(this.universe);
return FindParams.create({ where, sort: { name: 1 } });
}
}const result = await repo.find(new ThreatsQuery('dc'));Last updated