Sammy/t 190 aau i see other filters city on people (#101)
* feature: add email filter * feature: add city filter * test: fix company search tests * test: use the right value in test * refactor: test all the filters in a loop
This commit is contained in:
@ -5,6 +5,12 @@ import {
|
||||
People_Bool_Exp,
|
||||
Users_Bool_Exp,
|
||||
} from '../../../generated/graphql';
|
||||
import { GraphqlQueryCompany } from '../../../interfaces/company.interface';
|
||||
import {
|
||||
SEARCH_COMPANY_QUERY,
|
||||
SEARCH_PEOPLE_QUERY,
|
||||
} from '../../../services/search/search';
|
||||
import { GraphqlQueryPerson } from '../../../interfaces/person.interface';
|
||||
|
||||
export type SortType<SortKey = string> = {
|
||||
label: string;
|
||||
@ -46,3 +52,25 @@ export type SelectedFilterType<WhereTemplate> = FilterType<WhereTemplate> & {
|
||||
operand: FilterOperandType;
|
||||
where: WhereTemplate;
|
||||
};
|
||||
|
||||
export function assertFilterUseCompanySearch<FilterValue>(
|
||||
filter: FilterType<People_Bool_Exp>,
|
||||
): filter is FilterType<People_Bool_Exp> & {
|
||||
searchResultMapper: (data: GraphqlQueryCompany) => {
|
||||
displayValue: string;
|
||||
value: FilterValue;
|
||||
};
|
||||
} {
|
||||
return filter.searchQuery === SEARCH_COMPANY_QUERY;
|
||||
}
|
||||
|
||||
export function assertFilterUsePeopleSearch<FilterValue>(
|
||||
filter: FilterType<People_Bool_Exp>,
|
||||
): filter is FilterType<People_Bool_Exp> & {
|
||||
searchResultMapper: (data: GraphqlQueryPerson) => {
|
||||
displayValue: string;
|
||||
value: FilterValue;
|
||||
};
|
||||
} {
|
||||
return filter.searchQuery === SEARCH_PEOPLE_QUERY;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user