Tag manager for project: NestJs, TypeORM, PostgresQL
npm install crm-tags
# With yarn
yarn add crm-tags
@Module({
imports: [
ResourceTagModule.register(Mock), // + Add this
TypeOrmModule.forFeature([Mock]),
],
controllers: [MockController],
})
export class MockModule {}
@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
},
},
});