1.4.0 • Published 5 months ago

nestjs-prisma-querybuilder-interface v1.4.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

Nestjs/prisma-querybuilder-interface

https://nestjs.com/img/logo_text.svg

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

  • 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.

Hits

1.4.0

5 months ago

1.3.2

11 months ago

1.2.0

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.1.4

1 year ago

1.3.1

1 year ago

1.1.3

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.1.2

1 year ago

1.0.2

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago