import { SelectQueryBuilder } from 'typeorm';

export class WhereInQueryHelper {
  constructor(
    protected baseQuery: SelectQueryBuilder<any>,
    protected moduleName: string,
    protected columnName: string,
    protected values: string[],
    protected valueAliases: string,
  ) {}

  getQuery(): SelectQueryBuilder<any> {
    return this.baseQuery.andWhere(
      `${this.moduleName}.${this.columnName} IN (:...${this.valueAliases})`,
      {
        [this.valueAliases]: this.values,
      },
    );
  }
}
