feat: order by status field
This commit is contained in:
parent
0bd2c1ecf2
commit
09cf32d3c7
8 changed files with 14 additions and 8 deletions
|
|
@ -58,7 +58,10 @@ export class ProductGroup extends Controller {
|
|||
{ detail: { contains: query }, ...filterStatus(status) },
|
||||
],
|
||||
} satisfies Prisma.ProductGroupWhereInput;
|
||||
return prisma.productGroup.findMany({ orderBy: { createdAt: "asc" }, where });
|
||||
return prisma.productGroup.findMany({
|
||||
orderBy: [{ statusOrder: "asc" }, { createdAt: "asc" }],
|
||||
where,
|
||||
});
|
||||
}
|
||||
|
||||
@Get("{groupId}")
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ export class ProductController extends Controller {
|
|||
|
||||
const [result, total] = await prisma.$transaction([
|
||||
prisma.product.findMany({
|
||||
orderBy: { createdAt: "asc" },
|
||||
orderBy: [{ statusOrder: "asc" }, { createdAt: "asc" }],
|
||||
where,
|
||||
take: pageSize,
|
||||
skip: (page - 1) * pageSize,
|
||||
|
|
|
|||
|
|
@ -64,7 +64,10 @@ export class ProductType extends Controller {
|
|||
{ detail: { contains: query }, ...filterStatus(status) },
|
||||
],
|
||||
} satisfies Prisma.ProductTypeWhereInput;
|
||||
const result = prisma.productType.findMany({ orderBy: { createdAt: "asc" }, where });
|
||||
const result = prisma.productType.findMany({
|
||||
orderBy: [{ statusOrder: "asc" }, { createdAt: "asc" }],
|
||||
where,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue