©️
Cross api
En-US
En-US
  • Introduction
  • Compatibility
  • Extensions
  • Usage
    • Tools
      • Config
      • ListProvider
      • Language
      • Help
    • Structure
      • MakeApi
      • MakeModule
      • MakeProvider
      • Revert
  • Structure
    • Root
    • Src
    • @Types
    • Assets
    • Config
    • Dtos
    • Jobs
    • Keys
    • Middlewares
    • Modules
    • Routes
    • Shared
    • Utils
  • Services
    • Transactions
    • Exists
    • FindBy
    • FindIn
    • FindLike
    • FindAll
    • Create
    • CreateMany
    • Update
    • UpdateMany
    • Delete
    • DeleteMany
    • SoftDelete
    • SoftDeleteMany
  • Mappers
    • CloneAttribute
    • UpdateAttribute
    • PatchAttribute
    • UpdateString
    • PatchString
    • InsertAttribute
  • Providers
    • Cache
    • Crypto
    • Hash
    • Lead
    • MailTemplate
    • Mail
    • Queue
    • Notification
    • Storage
Powered by GitBook
On this page

Was this helpful?

  1. Services

FindAll

Exactly the same functionality as findBy, but also receiving paging and limiting and returns an array of the entity and the amount of items returned.

const page = 3;
const limit = 500;
const select = { name: true }

const exampleArray = await this.examplesRepository.findAll(
  {
    page,
    limit,
    where: { name: "example" },
    ["relation-1", "relation-2.nested-relation"] // or { "relation-1": true, "relation-2": { nested-relation: true } }
    order: { id: 'ASC' },
    select,
  },
  trx,
);

/** Find all where name = "example"
 * Select name only
 * Filter where index is between 1000 and 1500
 * Load their relations (use . to load nested relations)
 * Count the amount of items
 * Sorts the result from the lowest value to the highest value
 */

output: { examples: [exampleArray], amount: 500 }

PreviousFindLikeNextCreate

Was this helpful?