Skip to content

Commit

Permalink
update customer query
Browse files Browse the repository at this point in the history
  • Loading branch information
sadmann7 committed Jan 27, 2024
1 parent 2a50d19 commit f9ee83d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/fetchers/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ export async function getCustomers(input: {
totalSpent: sql<number>`sum(${orders.amount})`,
})
.from(orders)
.limit(limit)
.offset(offset)
.where(
and(
eq(orders.storeId, storeId),
Expand All @@ -418,8 +420,6 @@ export async function getCustomers(input: {
)
.groupBy(orders.email, orders.name, orders.createdAt)
.orderBy(desc(orders.createdAt))
.limit(limit)
.offset(offset)

const customerCount = await tx
.select({
Expand Down

0 comments on commit f9ee83d

Please sign in to comment.