import { SelectQueryBuilder } from 'typeorm'; export class BetweenQueryHelper { constructor( protected baseQuery: SelectQueryBuilder, protected moduleName: string, protected columnName: string, protected from: any, protected to: any, protected valueAlias: string, ) {} getQuery(): SelectQueryBuilder { return this.baseQuery.andWhere( `${this.moduleName}.${this.columnName} BETWEEN :from${this.valueAlias} AND :to${this.valueAlias}`, { [`from${this.valueAlias}`]: this.from, [`to${this.valueAlias}`]: this.to, }, ); } }