feat: scope type by productGroupId
This commit is contained in:
parent
96f49ab12c
commit
e6dd2c6e6e
1 changed files with 2 additions and 1 deletions
|
|
@ -43,8 +43,9 @@ export class ProductType extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
async getProductType(@Query() query: string = "") {
|
async getProductType(@Query() query: string = "", @Query() productGroupId?: string) {
|
||||||
const where = {
|
const where = {
|
||||||
|
AND: { productGroupId },
|
||||||
OR: [{ name: { contains: query } }, { detail: { contains: query } }],
|
OR: [{ name: { contains: query } }, { detail: { contains: query } }],
|
||||||
} satisfies Prisma.ProductTypeWhereInput;
|
} satisfies Prisma.ProductTypeWhereInput;
|
||||||
const result = prisma.productType.findMany({ orderBy: { createdAt: "asc" }, where });
|
const result = prisma.productType.findMany({ orderBy: { createdAt: "asc" }, where });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue