data source options builder
This commit is contained in:
parent
44def3a9fc
commit
a6e3f0999e
@ -40,6 +40,7 @@ export class GraphQLDataSourceOptionsBuilder<TModel, TKey> {
|
|||||||
let ret: IDataSourceQueryAdapterOptions<TModel> = {
|
let ret: IDataSourceQueryAdapterOptions<TModel> = {
|
||||||
adapter: <IAdvanceQueryAdapter<IQueryCriteria, TModel>>{
|
adapter: <IAdvanceQueryAdapter<IQueryCriteria, TModel>>{
|
||||||
handle: (query: IQueryCriteria) => {
|
handle: (query: IQueryCriteria) => {
|
||||||
|
|
||||||
const advanceQuery = this.createGraphQLQueryCriteria(query);
|
const advanceQuery = this.createGraphQLQueryCriteria(query);
|
||||||
const o$ = this.apollo.query<any>({
|
const o$ = this.apollo.query<any>({
|
||||||
query: this.createGraphQLQuery(query),
|
query: this.createGraphQLQuery(query),
|
||||||
@ -47,14 +48,11 @@ export class GraphQLDataSourceOptionsBuilder<TModel, TKey> {
|
|||||||
criteria: advanceQuery
|
criteria: advanceQuery
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return o$.pipe(
|
return o$.pipe(
|
||||||
map(result => {
|
map(result => {
|
||||||
const queryResult = result.data[this.queryName] as IGraphQLAdvanceQueryResult<TModel>;
|
const queryResult = result.data[this.queryName] as IGraphQLAdvanceQueryResult<TModel>;
|
||||||
return this.queryResultFromGraphQLAdvancedResult(query, queryResult);
|
return this.queryResultFromGraphQLAdvancedResult(query, queryResult);
|
||||||
}),
|
|
||||||
catchError(err => {
|
|
||||||
console.error(err);
|
|
||||||
return err;
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user