From a1a840bef28686e8cd4c4c7647603b8c016484a6 Mon Sep 17 00:00:00 2001 From: ikethecoder Date: Thu, 4 Jul 2024 13:43:53 -0700 Subject: [PATCH] fix check availability --- e2e/cypress/tests/19-api-v3/07-endpoints.ts | 4 ++-- src/controllers/v3/EndpointsController.ts | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/e2e/cypress/tests/19-api-v3/07-endpoints.ts b/e2e/cypress/tests/19-api-v3/07-endpoints.ts index 1ca6a1a90..469887276 100644 --- a/e2e/cypress/tests/19-api-v3/07-endpoints.ts +++ b/e2e/cypress/tests/19-api-v3/07-endpoints.ts @@ -11,8 +11,8 @@ describe('Endpoints', () => { names: ['testme', 'testme-dev', 'testme-test'], hosts: [ 'testme.api.gov.bc.ca', - 'testme.api.dev.gov.bc.ca', - 'testme.api.test.gov.bc.ca', + 'testme.dev.api.gov.bc.ca', + 'testme.test.api.gov.bc.ca', 'testme-api-gov-bc-ca.dev.api.gov.bc.ca', 'testme-api-gov-bc-ca.test.api.gov.bc.ca', ], diff --git a/src/controllers/v3/EndpointsController.ts b/src/controllers/v3/EndpointsController.ts index 2f386928f..cd7a36a1b 100644 --- a/src/controllers/v3/EndpointsController.ts +++ b/src/controllers/v3/EndpointsController.ts @@ -11,7 +11,11 @@ import { } from 'tsoa'; import { KeystoneService } from '../ioc/keystoneInjector'; import { inject, injectable } from 'tsyringe'; -import { getRecords, removeEmpty } from '../../batch/feed-worker'; +import { + getRecords, + parseJsonString, + removeEmpty, +} from '../../batch/feed-worker'; import { GatewayRoute, GatewayService } from './types'; interface MatchList { @@ -38,9 +42,9 @@ export class EndpointsController extends Controller { @Request() request: any ): Promise { const ctx = this.keystone.sudo(); - const records = await getRecords(ctx, 'GatewayRoute', 'allGatewayRoutes', [ - 'service', - ]); + const records = ( + await getRecords(ctx, 'GatewayRoute', 'allGatewayRoutes', ['service']) + ).map((o) => parseJsonString(o, ['hosts'])); let counter = 0; let matchHostList: MatchList; @@ -67,8 +71,8 @@ export class EndpointsController extends Controller { names: [`${serviceName}`, `${serviceName}-dev`, `${serviceName}-test`], hosts: [ `${serviceName}.api.gov.bc.ca`, - `${serviceName}.api.dev.gov.bc.ca`, - `${serviceName}.api.test.gov.bc.ca`, + `${serviceName}.dev.api.gov.bc.ca`, + `${serviceName}.test.api.gov.bc.ca`, `${serviceName}-api-gov-bc-ca.dev.api.gov.bc.ca`, `${serviceName}-api-gov-bc-ca.test.api.gov.bc.ca`, ],