Skip to content

Commit

Permalink
Merge pull request #135 from Tusharmahajan12/new_oblf
Browse files Browse the repository at this point in the history
remove limit 200 by default
  • Loading branch information
vijaykhollam authored Jan 17, 2025
2 parents 1e4a3ff + 910154f commit 86905eb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/adapters/postgres/cohort-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,17 @@ export class PostgresCohortService {
let { limit, sort, offset, filters } = cohortSearchDto;

offset = offset || 0;
limit = limit || 200;
// limit = limit || 200;
limit = limit || null;

const emptyValueKeys = {};
let emptyKeysString = "";

const MAX_LIMIT = 200;

// Validate the limit parameter
if (limit > MAX_LIMIT) {
if (limit !== undefined && limit > MAX_LIMIT) {

return APIResponse.error(
response,
apiId,
Expand Down Expand Up @@ -613,8 +615,12 @@ export class PostgresCohortService {
const [data, totalCount] =
await this.cohortMembersRepository.findAndCount({
where: whereClause,

});
const userExistCohortGroup = data.slice(offset, offset + limit);

// const userExistCohortGroup = data.slice(offset, offset + limit);
const userExistCohortGroup = limit ? data.slice(offset, offset + limit) : data;

count = totalCount;

let cohortIds = userExistCohortGroup.map(cohortId => cohortId.cohortId);
Expand Down Expand Up @@ -655,8 +661,8 @@ export class PostgresCohortService {
where: whereClause,
order,
});

const cohortData = data.slice(offset, offset + limit);
const cohortData = limit ? data.slice(offset, offset + limit) : data;
//const cohortData = data.slice(offset, offset + limit);
count = totalCount;

for (let data of cohortData) {
Expand Down

0 comments on commit 86905eb

Please sign in to comment.