2.0.0 • Published 3 years ago

lucid-fetch-helper v2.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

lucid-fetch-helper

Installation

npm install --save lucid-fetch-helper

or using yarn

yarn add lucid-fetch-helper

Usage

import lucidFetchHelper from "lucid-fetch-helper"

const response = await lucidFetchHelper({LucidModel,columnsSettings, pagination, orderBy, searchQuery, filters, dateRange, customColumnsSelectionList,excludedSearchColumns})
...

API

ParameterDescription
LucidModelLucid Orm Model
columnsSettings{ customColumnsSelectionList : 'columnName1',..., method : 'include''exclude' }
paginationobject defines pagination settings {page:number,perPage:number(defaults to 15)}
orderByobject defines column to order by {filed:"columnName" ,direction:"asc""desc"}
searchQuerystring to search with in all database columns (generic search)
filtersan array of key:value pairs defines filtration criteria {gender:"male"}
dateRangedate range to filter by {from:"YYYY/MM/DD",to:"YYYY/MM/DD"} note that from and to are optional witch means you can define dateRange object as follows {from:"YYYY/MM/DD"} Or {to:"YYYY/MM/DD"}
excludedSearchColumnslist of columns that should be excluded from generic search i.e. any non string values ex 'isActive','id',... Note by default 'id','updated_at','created_at' columns are excluded
2.0.0

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago