Add paged orders API and infinite scroll, short order numbers, and align the guest invite card with the logged-in hero shell. Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
788 B
TypeScript
28 lines
788 B
TypeScript
import { PrismaClient } from '@prisma/client'
|
|
|
|
const prisma = new PrismaClient()
|
|
|
|
async function main() {
|
|
const counts = await prisma.order.groupBy({
|
|
by: ['status'],
|
|
_count: { _all: true },
|
|
where: { orderNumber: { startsWith: 'MOCK-ORD' } },
|
|
})
|
|
const total = counts.reduce((s, c) => s + c._count._all, 0)
|
|
const sample = await prisma.order.findFirst({
|
|
where: { orderNumber: { startsWith: 'MOCK-ORD' } },
|
|
select: {
|
|
orderNumber: true,
|
|
status: true,
|
|
customer: { select: { mobile: true, fullName: true } },
|
|
},
|
|
})
|
|
console.log(JSON.stringify({ total, byStatus: Object.fromEntries(counts.map((c) => [c.status, c._count._all])), sample }, null, 2))
|
|
await prisma.$disconnect()
|
|
}
|
|
|
|
main().catch((e) => {
|
|
console.error(e)
|
|
process.exit(1)
|
|
})
|