SudoSOS Back-end API / helpers / QueryFilter
Class: QueryFilter ​
Constructors ​
Constructor ​
ts
new QueryFilter(): QueryFilter;Returns ​
QueryFilter
Methods ​
applyFilter() ​
ts
static applyFilter(
query,
mapping,
params): SelectQueryBuilder<any>;Applies the specified query filtering onto the given query builder.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
query | SelectQueryBuilder<any> | The query builder to which to add where clauses. |
mapping | FilterMapping | The mapping of property names on the parameters object to property names in the query. |
params | FilterParameters | The object containing the actual parameter values. |
Returns ​
SelectQueryBuilder<any>
The resulting query bulider.
createFilterWhereClause() ​
ts
static createFilterWhereClause(mapping, params): FindOptionsWhere<any>;Creates a FindManyOptions object containing the conditions needed to apply the given filter.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
mapping | FilterMapping | The mapping of property names on the parameters object to property names in the query. |
params | FilterParameters | The object containing the actual parameter values. |
Returns ​
FindOptionsWhere<any>
The where clause which can be used in a FindManyOptions object.
createFilterWhereDate() ​
ts
static createFilterWhereDate(fromDate?, tillDate?): Date | FindOperator<Date>;Given a time range, return a find options filter that filters based on this range
Parameters ​
| Parameter | Type | Description |
|---|---|---|
fromDate? | Date | - |
tillDate? | Date | - |
Returns ​
Date | FindOperator<Date>
createFilterWhereDateRange() ​
ts
static createFilterWhereDateRange<Entity>(
rangeStartAttributeName,
rangeEndAttributeName,
rangeFromDate?,
rangeTillDate?): FindOptionsWhere<Entity>[];Return a filter options that only returns the attributes whose timeframe partially overlaps with the given timeframe
Type Parameters ​
| Type Parameter |
|---|
Entity extends BaseEntity |
Parameters ​
| Parameter | Type | Description |
|---|---|---|
rangeStartAttributeName | keyof { [P in string | number | symbol as Entity[P] extends Date ? P : never]: any } | Name of the entity's attribute that defines the start of the timeframe |
rangeEndAttributeName | keyof { [P in string | number | symbol as Entity[P] extends Date ? P : never]: any } | Name of the entity's attribute that defines the end of the timeframe |
rangeFromDate? | Date | Optional start of the selecting timeframe |
rangeTillDate? | Date | Optional end of the selecting timeframe |
Returns ​
FindOptionsWhere<Entity>[]
extractUndefinedNumberOrArray() ​
ts
static extractUndefinedNumberOrArray(query): number | number[];Extract the given query field and parse it to either undefined, a number or an array of numbers
Parameters ​
| Parameter | Type | Description |
|---|---|---|
query | any | - |
Returns ​
number | number[]