fix: list customers query error (#1226)
* fix: list customers generated query * fix: consistency Co-authored-by: fPolic <frane@medusajs.com>
This commit is contained in:
1 parent
e2423020c0
commit
932f4b29a8
2 files changed
+5
-5
No files matched your search
@@ -3,10 +3,7 @@ import { Customer } from "../models/customer"
|
|||||||
|
|
||||||
@EntityRepository(Customer)
|
@EntityRepository(Customer)
|
||||||
export class CustomerRepository extends Repository<Customer> {
|
export class CustomerRepository extends Repository<Customer> {
|
||||||
async listAndCount(query): Promise<[Customer[], number]> {
|
async listAndCount(query, groups): Promise<[Customer[], number]> {
|
||||||
const groups = query?.where?.groups
|
|
||||||
delete query?.where?.groups
|
|
||||||
|
|
||||||
let qb = this.createQueryBuilder("customer")
|
let qb = this.createQueryBuilder("customer")
|
||||||
.where(query.where)
|
.where(query.where)
|
||||||
.skip(query.skip)
|
.skip(query.skip)
|
||||||
|
|||||||
@@ -190,6 +190,9 @@ class CustomerService extends BaseService {
|
|||||||
|
|
||||||
const query = this.buildQuery_(selector, config)
|
const query = this.buildQuery_(selector, config)
|
||||||
|
|
||||||
|
const groups = query.where.groups
|
||||||
|
delete query.where.groups
|
||||||
|
|
||||||
if (q) {
|
if (q) {
|
||||||
const where = query.where
|
const where = query.where
|
||||||
|
|
||||||
@@ -209,7 +212,7 @@ class CustomerService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await customerRepo.listAndCount(query)
|
return await customerRepo.listAndCount(query, groups)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user