Skip to content

Commit

Permalink
fix check availability
Browse files Browse the repository at this point in the history
  • Loading branch information
ikethecoder committed Jul 4, 2024
1 parent 1db929d commit a1a840b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions e2e/cypress/tests/19-api-v3/07-endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
Expand Down
16 changes: 10 additions & 6 deletions src/controllers/v3/EndpointsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -38,9 +42,9 @@ export class EndpointsController extends Controller {
@Request() request: any
): Promise<any> {
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;
Expand All @@ -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`,
],
Expand Down

0 comments on commit a1a840b

Please sign in to comment.