#Execute a raw sql query in listAndCount Method

6 messages · Page 1 of 1 (latest)

rare dew
#

We are trying to extend the customerservice since customers can belong to multiple stores. So we want to show the store their own customers.

We have a raw query in listAndCount that looks like below

#

That log returns the proper results which is 4 customers

#

But the result from function returns 2 results and the word "count". I think might be a bug or I am not using the function properly. Somebody help me out here

sterile current
#

async listAndCount(
    query: ExtendedFindConfig<Customer> & {
      where: FindOptionsWhere<Customer & { groups?: FindOperator<string[]> }>
    },
    q: string | undefined = undefined
  ): Promise<[Customer[], number]> 

You need to return an array of customers and a count number

rare dew
#

Nice, that works