feat: ⚗️ add logging to channels-fetcher
This commit is contained in:
parent
b0eb078eea
commit
b49451d6e6
1 changed files with 10 additions and 1 deletions
|
@ -3,22 +3,31 @@ import {
|
||||||
TaxConfigurationsListDocument,
|
TaxConfigurationsListDocument,
|
||||||
TaxConfigurationsListQueryVariables,
|
TaxConfigurationsListQueryVariables,
|
||||||
} from "../../../generated/graphql";
|
} from "../../../generated/graphql";
|
||||||
|
import { createLogger } from "../../lib/logger";
|
||||||
|
|
||||||
export class ChannelsFetcher {
|
export class ChannelsFetcher {
|
||||||
constructor(private client: Client) {}
|
constructor(private client: Client) {}
|
||||||
|
|
||||||
fetchChannels() {
|
fetchChannels() {
|
||||||
return this.client
|
const logger = createLogger({ service: "ChannelsFetcher" });
|
||||||
|
|
||||||
|
logger.fatal("fetchChannels called");
|
||||||
|
|
||||||
|
const response = this.client
|
||||||
.query(TaxConfigurationsListDocument, {
|
.query(TaxConfigurationsListDocument, {
|
||||||
first: 10,
|
first: 10,
|
||||||
} as TaxConfigurationsListQueryVariables)
|
} as TaxConfigurationsListQueryVariables)
|
||||||
.toPromise()
|
.toPromise()
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
|
logger.fatal({ response: r.data }, "raw fetchChannels response");
|
||||||
return (
|
return (
|
||||||
r.data?.taxConfigurations?.edges
|
r.data?.taxConfigurations?.edges
|
||||||
.filter(({ node }) => node.taxCalculationStrategy === "TAX_APP")
|
.filter(({ node }) => node.taxCalculationStrategy === "TAX_APP")
|
||||||
.map(({ node }) => node.channel) ?? []
|
.map(({ node }) => node.channel) ?? []
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
logger.fatal({ response }, "filtered fetchChannels response");
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue