Relative Content

Tag Archive for node.jstypescriptexpressbackendprisma

Trying to use a “contains” inside a “hasSome” using prisma to filter results based on substrings inside array fields

async listProduct({ type, origin, name, order }: IProductFilterDTO): Promise<ProductEntity[]> { const where: Prisma.ProductWhereInput = {}; if (name) where.name = { contains: name, mode: “insensitive” }; if (type) where.type = { contains: type, mode: “insensitive” }; if (origin) { where.nativeFrom = { hasSome: [ origin ] }; } const orderByOptions: Prisma.ProductOrderByWithRelationInput = { name: order === […]