0

I am implementing an API that can take out all the data where user_id: user_id but it is not working please help me to implement the same.

here is my code of Follow_api controller:

@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();
  }

1 Answers1

0

Solved using this code:

@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,
      },
    });
  }