Skip to content

Commit

Permalink
mongoose not used in database connection #2559
Browse files Browse the repository at this point in the history
  • Loading branch information
iamleeg committed Apr 19, 2022
1 parent 60fb1bc commit 9356f05
Show file tree
Hide file tree
Showing 10 changed files with 454 additions and 433 deletions.
10 changes: 5 additions & 5 deletions verification/curator-service/api/src/controllers/geocode.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Request, Response } from 'express';

import axios, { AxiosError, AxiosResponse } from 'axios';
import axios, { AxiosResponse } from 'axios';
import countries from 'i18n-iso-countries';
import mongoose from 'mongoose';
import db from '../model/database';

import { logger } from '../util/logger';

Expand Down Expand Up @@ -55,9 +55,9 @@ export default class GeocodeProxy {
* @param res Express response
*/
countryNames = async (req: Request, res: Response): Promise<void> => {
const mongoClient = mongoose.connection.getClient();
const locationCountryCodes = await mongoClient.db().collection('cases').distinct('location.country');
const travelHistoryCodes = await mongoClient.db().collection('cases').distinct('travelHistory.travel.location.country');
const database = db();
const locationCountryCodes = await database.collection('cases').distinct('location.country');
const travelHistoryCodes = await database.collection('cases').distinct('travelHistory.travel.location.country');
const allCodes = new Set<string>(locationCountryCodes.concat(travelHistoryCodes));
const namesMap: {
[key: string]: string[] | undefined
Expand Down
Loading

0 comments on commit 9356f05

Please sign in to comment.