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,
|
||||
TaxConfigurationsListQueryVariables,
|
||||
} from "../../../generated/graphql";
|
||||
import { createLogger } from "../../lib/logger";
|
||||
|
||||
export class ChannelsFetcher {
|
||||
constructor(private client: Client) {}
|
||||
|
||||
fetchChannels() {
|
||||
return this.client
|
||||
const logger = createLogger({ service: "ChannelsFetcher" });
|
||||
|
||||
logger.fatal("fetchChannels called");
|
||||
|
||||
const response = this.client
|
||||
.query(TaxConfigurationsListDocument, {
|
||||
first: 10,
|
||||
} as TaxConfigurationsListQueryVariables)
|
||||
.toPromise()
|
||||
.then((r) => {
|
||||
logger.fatal({ response: r.data }, "raw fetchChannels response");
|
||||
return (
|
||||
r.data?.taxConfigurations?.edges
|
||||
.filter(({ node }) => node.taxCalculationStrategy === "TAX_APP")
|
||||
.map(({ node }) => node.channel) ?? []
|
||||
);
|
||||
});
|
||||
|
||||
logger.fatal({ response }, "filtered fetchChannels response");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue