Loopback 4中Where & Count不能一起实现

Where & Count cant be implemented together in Loopback 4

我正在实施一个 API 可以取出所有数据 user_id: user_id 但它不起作用请帮我实现它。

这是我的 Follow_api 控制器代码:

@get('/follow-masters/count/{id}')
  @response(200, {
    description: 'FollowMaster model count',
    content: {'application/json': {schema: CountSchema}},
  })
  async findCount(
    @param.path.string('user_id') user_id: string,
    @param.where(FollowMaster) where?: Where<FollowMaster>,
  ): Promise<Count> {
    return this.followMasterRepository.count();
  }

使用此代码解决:

@get('/follow-masters/count/{user_id}')
  @response(200, {
    description: 'FollowMaster model count',
    content: {'application/json': {
      schema: FollowMaster
    }
  },
  })
  async findCount(
    @param.path.string('user_id') user_id: string,
    @param.where(FollowMaster) where?: Where<FollowMaster>,
  ): Promise<NonVoid> {
    return this.followMasterRepository.find({
      where: {
        user_id: user_id, ...where,
      },
    });
  }