Тип от Многих Ко Многим жаждет

#node.js #postgresql #nestjs #typeorm

Вопрос:

У меня есть объекты post и tag. Я устанавливаю eager: true , но не действует. это мой findAll метод:

 async findAll(getPostsDto: GetPostsDto): Promise<Paginated<Post>> {
    const { search, page = 1, limit = 10 } = getPostsDto;

    const query = Post.createQueryBuilder('post');

    if (search) {
      query.andWhere('post.title LIKE :search', { search: `%${search}%` });
    }

    const limitCount =  limit > 10 ? 10 :  limit;
    const skippedItems = ( page - 1) * limitCount;
    const totalCount = await query.getCount();

    query.offset(skippedItems);
    query.limit(limitCount);

    const posts = await query
      .orderBy('created_at', 'DESC')
      .getMany();

    return {
      data: posts,
      page:  page,
      limit:  limit,
      totalCount,
      totalPages: Math.ceil(totalCount /  limit),
    };
  }
 

Должность.сущность:

 export class Post {
  @Column()
  title: string;

  @ManyToMany(() => Tag, (tag) => tag.posts, { cascade: true, eager: true })
  @JoinTable()
  tags: Tag[];
}
 

Тег.сущность:

 export class Tag {
  @Column()
  title: string;

  @ManyToMany(() => Post, (post) => post.tags)
  posts: Post[];
}
 

Я не знаю, что случилось.