1.1.4 • Published 4 months ago

@relationc/tags v1.1.4

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

Tag Service

Tag manager for project: NestJs, TypeORM, PostgresQL

Install

npm install crm-tags
# With yarn
yarn add crm-tags

Usage

Register module
@Module({
  imports: [
    ResourceTagModule.register(Mock), // + Add this
    TypeOrmModule.forFeature([Mock]),
  ],
  controllers: [MockController],
})
export class MockModule {}
Update entity
@Entity('mock_tags')
export class Mock {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  description: string;

  // + Add this
  @TagRelation(Mock)
  tags: ResourceTag[];

  // + Add this
  @FilterTag('mock_tags')
  async filterTag() {}
}
Add where in query ( This will be upgrade and make auto )
this.mockRepository.find({
  where: {
    tags: {
      resource: 'mock_tags', // + Add this
    },
  },
});