fix: isolate where option query (#97)
This commit is contained in:
		
							parent
							
								
									2feb8740e8
								
							
						
					
					
						commit
						dfbadfb4ce
					
				@ -13,6 +13,7 @@ import {
 | 
				
			|||||||
    LessThanOrEqual,
 | 
					    LessThanOrEqual,
 | 
				
			||||||
    Not,
 | 
					    Not,
 | 
				
			||||||
    ILike,
 | 
					    ILike,
 | 
				
			||||||
 | 
					    Brackets
 | 
				
			||||||
} from 'typeorm'
 | 
					} from 'typeorm'
 | 
				
			||||||
import { PaginateQuery } from './decorator'
 | 
					import { PaginateQuery } from './decorator'
 | 
				
			||||||
import { ServiceUnavailableException } from '@nestjs/common'
 | 
					import { ServiceUnavailableException } from '@nestjs/common'
 | 
				
			||||||
@ -116,7 +117,7 @@ export async function paginate<T>(
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (config.where) {
 | 
					    if (config.where) {
 | 
				
			||||||
        queryBuilder = queryBuilder.andWhere(config.where)
 | 
					        queryBuilder = queryBuilder.andWhere(new Brackets(queryBuilder => queryBuilder.andWhere(config.where))) // Postgres fix (https://github.com/ppetzold/nestjs-paginate/pull/97)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (query.search && config.searchableColumns) {
 | 
					    if (query.search && config.searchableColumns) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user