0.0.17 • Published 6 months ago

@imagineapps/nest-criteria v0.0.17

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

nest-criteria

Abstração de filtro e paginação para o NestJS com TypeORM

Example

TypeORM Entity

import { Entity, PrimaryGeneratedColumn, Column, ManyToMany } from 'typeorm';
import { CriteriaFields } from '@imagineapps/nest-criteria';

@CriteriaFields({
  name: ['IN', 'LIKE']
})
@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @ManyToMany()
  profiles: Profile[];
}

NestJS Controller

import { Controller, Get } from '@nestjs/common';
import { UseCriteria } from '@imagineapps/nest-criteria';
import { User } from './user.entity';

@Controller('users')
export class UsersController {
  @Get()
  async find(@UseCriteria(User) criteria: Criteria<User>): Promise<User[]> {
    return criteria
      .relations({
        profiles: true,
      })
      .get();
  }
}
0.0.11

10 months ago

0.0.12

10 months ago

0.0.13

10 months ago

0.0.14

10 months ago

0.0.15

10 months ago

0.0.16

10 months ago

0.0.17

6 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

1 year ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.6

2 years ago

0.0.1

2 years ago