The AOC Framework
github logodiscord logo

BACKEND

Filters #

Filters are classes decorated with the @AocFilter decorator and are used to define where conditions for searches.

Filters are typically used from the client's model-configs.

Example #

Filter to obtain customers whose birthday is today

@AocFilter(
  Customer,
  'filterByBirthday',
  _ => {
    const today = startOfToday();
    const offset = today.getTimezoneOffset();
    const todayWithOffset = addMinutes(today, offset);
    return { birthdate: { $startsWithNumber: `\\d\\d\\d\\d-${format(todayWithOffset, 'MM-dd')}.*` }}
  },
  false
)
export class CustomerFilter {}

Complete example at quest-server/src/filters/customer.filter.ts

Api #

Full definition in the API.

Please note, browse Issues and Discussions in Github for more information

© 2024 Atlantis of Code. All rights reserved.
All trademarks are the property of their respective owners.