nestjs-prisma-querybuilder-interface
v1.4.0
Published
Frontend interface to nestjs-prisma-querybuilder
Downloads
926
Maintainers
Readme
Nestjs/prisma-querybuilder-interface
Use case
this is a frontend interface to nestjs-prisma-querybuilder
What's new
Filter in Populate
You can filter inside populate
Insensitive Case
now in the filter you can search with insensitive case
Documentation
How to install it?
npm
npm install --save nestjs-prisma-querybuilder-interface
yarn
yarn add nestjs-prisma-querybuilder-interface
Properties
Usage
| Name | Type | exemple | | -------- | ---------- | ------------------------------------------------ | | select | string | select: 'name email', | | page | number | page: 2, | | limit | number | limit: 20, | | sort | SortFields | sort: {field: string, criteria: 'asc'}, | | populate | Populate | populate: [{path: 'car', select: 'model plate'}] | | filter | Filter | filter: [{name: 'jonas'}, {value: { gte: 4 }}] |
Exported Interfaces
import { Query, Populate, Filter } from 'nestjs-prisma-querybuilder-interface';
Query
all types
Populate
Filter
Operators
contains, endsWith, startsWith, equals, gt, gte, in, lt, lte ,not, notIn, hasEvery, hasSome, has, isEmpty;
Full usage exemple
QueryString({ select: 'firstName picture', populate: [ { path: 'car', select: 'model plate', populate: [ { path: 'brand', select: 'name' } ] } ], filter: [ { path: 'plate', value: 'XFS1T67' } ] });
Populate
const populate: Populate = [ { path: 'car', select: 'model plate', filter: [{ path: 'name', value: 'ford', operator: 'contains' }], populate: [ { path: 'brand', select: 'name' } ], primaryKey: 'yourTablePrimaryKey' // default 'id' } ];
Filter
const filter: Filter = [ { path: 'createdAt', value: new Date(), operator: 'lte' }, { or: [ { path: 'role', value: 'admin', operator: 'equals' }, { path: 'role', value: 'system', operator: 'equals' } ] }, { and: [ { path: 'name', value: 'Ricky', operator: 'equals', insensitive: true }, { path: 'lastName', value: 'Morty', operator: 'contains', insensitive: true } ] } ];
END
- Nestjs/Prisma Querybuilder Interface is ISC licensed.