Function LRPCLimit

  • This decorator is used specify which model and what query should be used to apply limit in user permissions example usage: if user permissions is permission: { limit: 10, resources: [] } @LRPCLimit(User, ['userId', 'id']) so in payload { id: '123' } the query will be prisma.model.count{ where: { userId: '123' } The first index in the array specifies the database property you want to use in the query and the second argument is the name of the property in the payload that carries the result of the database property you want to use to limit the query if nothing is provided it uses the id in the context object of the request.

    Parameters

    • model: any

      The prisma model to make use of

    • Optionalquery: string[]

      The query to be used for fetching list e.g { id: string, name: string }

    Returns (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void