Skip to content

Commit

Permalink
Replace iso-3166 with i18n-iso-countries #2559
Browse files Browse the repository at this point in the history
  • Loading branch information
iamleeg committed Mar 14, 2022
1 parent 4e66dc4 commit 632ab41
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 30 deletions.
11 changes: 0 additions & 11 deletions verification/curator-service/api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion verification/curator-service/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"express-openapi-validator": "^4.9.0",
"express-session": "^1.17.1",
"i18n-iso-countries": "^7.3.0",
"iso-3166-1": "^2.1.1",
"jsonwebtoken": "^8.5.1",
"jszip": "^3.7.0",
"lodash": "^4.17.21",
Expand Down
4 changes: 2 additions & 2 deletions verification/curator-service/api/src/model/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { DateFilterDocument, dateFilterSchema } from './date-filter';
import { OriginDocument, originSchema } from './origin';
import { UploadDocument, uploadSchema } from './upload';
import iso from 'iso-3166-1';
import countries from 'i18n-iso-countries';
import mongoose from 'mongoose';

interface ISource {
Expand All @@ -32,7 +32,7 @@ type ISourceInstanceCreation = mongoose.Model<ISource>;

const validCountryCode = function(cc: string): boolean {
// use ZZ to represent all countries
return (iso.whereAlpha2(cc) !== undefined || cc.toUpperCase() === "ZZ")
return (countries.getName(cc, 'en') !== undefined || cc.toUpperCase() === "ZZ")
}

const sourceSchema = new mongoose.Schema<
Expand Down
13 changes: 1 addition & 12 deletions verification/curator-service/ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions verification/curator-service/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"formik-material-ui-pickers": "^0.0.12",
"history": "^4.10.1",
"http-proxy-middleware": "^2.0.1",
"i18n-iso-countries": "^7.2.0",
"iso-3166-1": "^2.1.1",
"i18n-iso-countries": "^7.3.0",
"lodash": "^4.17.21",
"material-table": "^1.69.3",
"material-ui-chip-input": "^2.0.0-beta.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Switch,
} from '@material-ui/core';
import MaterialTable, { QueryResult } from 'material-table';
import iso from 'iso-3166-1';
import { nameCountry } from './util/countryNames';

import MuiAlert from '@material-ui/lab/Alert';
import Paper from '@material-ui/core/Paper';
Expand Down Expand Up @@ -286,7 +286,7 @@ class SourceTable extends React.Component<Props, SourceTableState> {

validateCountryCode(cc: string): boolean {
// use ZZ to represent all countries
return iso.whereAlpha2(cc) !== undefined || cc.toUpperCase() === 'ZZ';
return nameCountry(cc) !== undefined || cc.toUpperCase() === 'ZZ';
}

validateCountryCodes(field: string | undefined): boolean {
Expand Down

0 comments on commit 632ab41

Please sign in to comment.