From 0c73e886f268c46f689a382a092db8c9395dcc17 Mon Sep 17 00:00:00 2001 From: Thanh Pham Date: Fri, 31 Jan 2020 15:43:48 +0700 Subject: [PATCH] chore: #96 add api version to apollo server (#152) --- packages/graphql-server/src/constants/api.ts | 1 + .../graphql-server/src/resolvers/contact-identity-check/api.ts | 2 ++ packages/graphql-server/src/resolvers/contact/api.ts | 3 +++ 3 files changed, 6 insertions(+) create mode 100644 packages/graphql-server/src/constants/api.ts diff --git a/packages/graphql-server/src/constants/api.ts b/packages/graphql-server/src/constants/api.ts new file mode 100644 index 0000000000..e875c19706 --- /dev/null +++ b/packages/graphql-server/src/constants/api.ts @@ -0,0 +1 @@ +export const API_VERSION = '2020-01-31' diff --git a/packages/graphql-server/src/resolvers/contact-identity-check/api.ts b/packages/graphql-server/src/resolvers/contact-identity-check/api.ts index bafb0b2983..74d6d9e86e 100644 --- a/packages/graphql-server/src/resolvers/contact-identity-check/api.ts +++ b/packages/graphql-server/src/resolvers/contact-identity-check/api.ts @@ -3,6 +3,7 @@ import { CreateContactIdentityCheckArgs } from './contact-identity-check' import logger from '../../logger' import { ServerContext } from '../../app' import errors from '../../errors' +import { API_VERSION } from '../../constants/api' export const REAPIT_API_BASE_URL = 'https://dev.platform.reapit.net' @@ -18,6 +19,7 @@ export const callCreateIdentityCheckAPI = async (args: CreateContactIdentityChec const headers = { Authorization: context.authorization, 'Content-Type': 'application/json', + 'api-version': API_VERSION, } const createResponse = await fetcher({ url: `${URLS.contacts}/${args.contactId}${URLS.identityChecks}`, diff --git a/packages/graphql-server/src/resolvers/contact/api.ts b/packages/graphql-server/src/resolvers/contact/api.ts index ae8a45bd92..11366174c3 100644 --- a/packages/graphql-server/src/resolvers/contact/api.ts +++ b/packages/graphql-server/src/resolvers/contact/api.ts @@ -3,6 +3,7 @@ import logger from '../../logger' import { ServerContext } from '../../app' import { GetContactByIdArgs, CreateContactArgs, GetContactsArgs } from './contact' import errors from '../../errors' +import { API_VERSION } from '@/constants/api' export const REAPIT_API_BASE_URL = 'https://dev.platform.reapit.net' export const CONTACTS_PER_PAGE = 10 @@ -22,6 +23,7 @@ export const callGetContactByIdAPI = async (args: GetContactByIdArgs, context: S headers: { Authorization: context.authorization, 'Content-Type': 'application/json', + 'api-version': API_VERSION, }, }) return getResponse @@ -42,6 +44,7 @@ export const callGetContactsAPI = async (args: GetContactsArgs, context: ServerC headers: { Authorization: context.authorization, 'Content-Type': 'application/json', + 'api-version': API_VERSION, }, }) return response